Expand description
§Grillo manifest layer
Grillo parses Hopper’s byte-level mutation contracts. Each instruction can declare authorized data ranges and, when enabled, lamport permissions.
This crate is the parser and commitment half. It reads the
hopper.manifest.json emitted by hopper compile --emit manifest
(renderer: hopper_schema::codama::ManifestJson) into a
MutationManifest and can commit to
that contract with a stable SHA-256. The separately runnable verifier
checks caller-supplied account snapshots and touch evidence against this
contract. Neither crate authenticates or completes the supplied evidence.
Within the supplied evidence scope, Grillo checks:
changed subset acquired subset authorized
where acquired-but-unchanged is legal because access is not modification. This
crate supplies the authorized set; grillo-verifier supplies acquired
(from the touch map) and changed (from pre/post byte snapshots).
use grillo_manifest::MutationManifest;
let json = r#"{
"name": "p", "version": "1.0.0",
"instructions": [
{ "name": "pause", "tag": 1, "strictWrites": true,
"writeRanges": [
{ "accountIndex": 1, "offset": 114, "size": 1 },
{ "accountIndex": 1, "offset": 115, "size": 8 }
],
"accounts": [
{ "name": "admin", "signer": true },
{ "name": "config", "writable": true }
] }
]
}"#;
let m = MutationManifest::from_json(json).unwrap();
let pause = m.instruction("pause").unwrap();
assert!(pause.strict_writes);
assert_eq!(pause.authorized.len(), 2);
let _commitment: [u8; 32] = m.commitment();Modules§
- authority
- Upgrade authority diff between two Hopper program manifests.
Structs§
- Account
Role - The role an account plays in an instruction, from the manifest’s positional account list.
- Account
Role Contract V2 - One account role, reused by fixed and remaining-account grammar entries.
- ArgContract
- Instruction-argument metadata needed to decode parametric selectors from the real invocation payload.
- Contract
Completeness V2 - Dimensions for which the producer claims the contract is complete.
- CpiAccount
Binding V2 - Map one child position to one concrete parent position.
- CpiEnvelope
V2 - One declared child invocation shape.
- Data
Policy V2 - Byte writes permitted within data that exists after the invocation.
- Data
Range V2 - Half-open data range
[offset, offset + size)within one role. - Effect
Contract V2 - A complete program effect contract.
- Instruction
Contract - The mutation contract for one instruction.
- Instruction
Effect Contract V2 - One fully identified instruction contract.
- Mutation
Manifest - A Hopper program manifest, parsed down to its mutation contract.
- Parametric
Range Contract - One invocation-parametric byte-range rule from a Hopper manifest.
- Range
Contract - One authorized byte-range write permission on a single account.
- Remaining
Accounts Contract V2 - Deterministic account-suffix grammar.
- Remaining
Group V2 - One fixed-width role group repeated a statically bounded number of times.
- Resolved
Instruction Contract - A concrete instruction effect contract after all parametric rules have been bound to invocation arguments.
- Resolved
Selector - One selector value bound from an invocation.
- Transition
Policy V2 - All state-transition dimensions for one account role.
Enums§
- Address
Constraint V2 - Address identity for one role.
- ArgEncoding
Contract - Wire encoding of one instruction argument, narrowed from Hopper’s manifest descriptor.
- CpiPolicy
V2 - Complete CPI policy for an instruction.
- Deployment
Binding V2 - How a portable contract binds to deployed executable code.
- Duplicate
Policy V2 - Alias policy for the complete fixed + remaining account list.
- Effect
Contract V2Error - Strict v0.2 parse/validation failure.
- Executable
Policy V2 - Executable-bit transition.
- Lamport
Policy V2 - Permitted balance direction.
- Length
Policy V2 - Data-length transition.
- Owner
Policy V2 - Owner transition.
- Owner
Target V2 - Resolved owner target.
- Parse
Error - Why a manifest could not be parsed into a
MutationManifest. - Presence
Policy V2 - Logical account presence transition. A close tombstone can be represented as a present zeroed/System-owned post-state; it is not inferred as absent.
- Privilege
Requirement V2 - Required/forbidden/optional effective privilege.
- Resolve
Error - Why an invocation-specific effect contract could not be resolved.
Constants§
- EFFECT_
ABI_ V2 - Exact Effect ABI version accepted by this module.
Traits§
- Mutation
Contract View - Read-only view shared by unresolved and invocation-resolved effect contracts.
Functions§
- sha256
- One-shot SHA-256 over
data.