Skip to main content

Crate grillo_manifest

Crate grillo_manifest 

Source
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§

AccountRole
The role an account plays in an instruction, from the manifest’s positional account list.
AccountRoleContractV2
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.
ContractCompletenessV2
Dimensions for which the producer claims the contract is complete.
CpiAccountBindingV2
Map one child position to one concrete parent position.
CpiEnvelopeV2
One declared child invocation shape.
DataPolicyV2
Byte writes permitted within data that exists after the invocation.
DataRangeV2
Half-open data range [offset, offset + size) within one role.
EffectContractV2
A complete program effect contract.
InstructionContract
The mutation contract for one instruction.
InstructionEffectContractV2
One fully identified instruction contract.
MutationManifest
A Hopper program manifest, parsed down to its mutation contract.
ParametricRangeContract
One invocation-parametric byte-range rule from a Hopper manifest.
RangeContract
One authorized byte-range write permission on a single account.
RemainingAccountsContractV2
Deterministic account-suffix grammar.
RemainingGroupV2
One fixed-width role group repeated a statically bounded number of times.
ResolvedInstructionContract
A concrete instruction effect contract after all parametric rules have been bound to invocation arguments.
ResolvedSelector
One selector value bound from an invocation.
TransitionPolicyV2
All state-transition dimensions for one account role.

Enums§

AddressConstraintV2
Address identity for one role.
ArgEncodingContract
Wire encoding of one instruction argument, narrowed from Hopper’s manifest descriptor.
CpiPolicyV2
Complete CPI policy for an instruction.
DeploymentBindingV2
How a portable contract binds to deployed executable code.
DuplicatePolicyV2
Alias policy for the complete fixed + remaining account list.
EffectContractV2Error
Strict v0.2 parse/validation failure.
ExecutablePolicyV2
Executable-bit transition.
LamportPolicyV2
Permitted balance direction.
LengthPolicyV2
Data-length transition.
OwnerPolicyV2
Owner transition.
OwnerTargetV2
Resolved owner target.
ParseError
Why a manifest could not be parsed into a MutationManifest.
PresencePolicyV2
Logical account presence transition. A close tombstone can be represented as a present zeroed/System-owned post-state; it is not inferred as absent.
PrivilegeRequirementV2
Required/forbidden/optional effective privilege.
ResolveError
Why an invocation-specific effect contract could not be resolved.

Constants§

EFFECT_ABI_V2
Exact Effect ABI version accepted by this module.

Traits§

MutationContractView
Read-only view shared by unresolved and invocation-resolved effect contracts.

Functions§

sha256
One-shot SHA-256 over data.