Expand description
Wasm-friendly Compact contract runtime core — IR walker, IR executor, contract state, and the runtime value type.
Pure compute. No network, no disk, no proving. The lifecycle layer
(deploy / call / maintenance / submission / providers) lives in
the [moonproof_contracts] crate, which depends on this one.
§What lives here
ir— descriptor walker, interpreter, witnesses, vm-decode.walker— storage-shape readers (Cell / Map / Set / List /MerkleTree/HistoricMerkleTree).ir_executable— IR-driven circuit executor.cross_contract— call trees: circuits that call circuits of other deployed contracts.executable— executor inputs/outputs (CircuitCallContext,ConstructorContext,ExecuteCircuitResult,InitializeResult).state—state::ContractRuntimeStatestruct + accessors. Indexer-driven fold lives in [moonproof_contracts::state_fold].ledger—ledger::AtomBuffer+ Merkle snapshot types + the descriptor-aware projector. Async readers live in [moonproof_contracts::ledger_readers].zswap_local—CompactZswapLocalState+CompactZswapOutput, the per-circuit-execution zswap view consumed by the executor.compact_types— typed wrappers (CompactMap,CompactSet,CompactList, views,ContractAddress,JubjubPoint, …) for codegen-emitted contract bindings.
Re-exports§
pub use error::ContractRuntimeError;pub use error::Result;pub use types::BlockHash;pub use types::CircuitId;pub use types::CoinPublicKey;pub use types::EncPublicKey;pub use types::PrivateStateId;pub use types::ProverKey;pub use types::TransactionHash;pub use types::TransactionId;pub use types::VerifierKey;pub use types::ZkConfig;pub use types::Zkir;pub use compact_types::Curve25519Point;pub use compact_types::JubjubPoint;pub use compact_types::Secp256k1Point;pub use compact_types::Secp256r1Point;pub use executable::CircuitCallContext;pub use executable::ConstructorContext;pub use executable::ExecuteCircuitResult;pub use executable::InitializeResult;pub use ir::descriptor::decode_aligned_value_full;pub use ir::descriptor::encode_literal;pub use ir::error::IrDriverError;pub use ir::error::Result as IrResult;pub use ir::witnesses;pub use ir::witnesses::NoWitnesses;pub use ir::witnesses::ScriptedWitnesses;pub use ir::witnesses::Witnesses;pub use ir_executable::IrExecutable;pub use cross_contract::CallTreeOutcome;pub use cross_contract::CallTreeResult;pub use cross_contract::CalleeCall;pub use cross_contract::CalleeContract;pub use cross_contract::CrossContractSession;pub use coverage::AssertCoverage;pub use coverage::BranchCoverage;pub use coverage::BranchKind;pub use coverage::CircuitIrCoverage;pub use coverage::EmitCoverage;pub use coverage::IrCoverageCollector;pub use coverage::IrCoverageMap;pub use coverage::IrCoverageSnapshot;pub use coverage::IrCoverageTotals;pub use coverage::LedgerOpCoverage;pub use state::contract_address_to_hex;pub use state::ContractRuntimeState;pub use trace::ExecutionTrace;pub use trace::TraceEvent;pub use trace::TraceLevel;pub use zswap_local::CompactZswapLocalState;pub use zswap_local::CompactZswapOutput;pub use hex;pub use moonproof_runtime_ir as runtime_ir;
Modules§
- compact_
types - Typed wrappers + named shapes returned by the Rust source emitted
by
moonproof-codegen. Mirrors compactc’scompact-types.tstype SET; the projection from atom buffers happens throughcrate::walker(single source of truth across every binding language). - coverage
- Zero-cost-when-disabled IR execution coverage collector.
- cross_
contract - Cross-contract calls: a circuit that calls a circuit of another deployed contract.
- error
- Runtime error type — pure-compute side.
- executable
- Data types describing the result of running a contract’s constructor or a provable circuit off-chain.
- ir
- IR-driver: walks a parsed
contract.mpirto execute a contract’s constructor and circuits without per-contract codegen. - ir_
executable IrExecutable— the runtime-ir-driven off-chain executor.- ledger
- Atom-buffer + merkle-tree snapshot types for ledger reads.
- ledger_
read - Generic typed ledger field readers shared by all generated Rust contract bindings. Eliminates repeating 35–55 lines of schema lookup, walker invocation, and error wrapping per ledger field.
- state
ContractRuntimeState— the per-contract client-side view.- trace
- Structured execution tracing for the Compact runtime IR interpreter.
- types
- Pure data types — wasm-friendly subset.
- walker
- Single-source data walker for descriptor ↔
RuntimeValue↔AlignedValueround trips. - zswap_
local - Compact-runtime-side zswap local state — the per-circuit-execution view of “outputs the circuit just produced + inputs it spent + the caller’s coin public key”.
Macros§
- define_
contract_ wrapper - Define a typed contract front-end struct wrapping
IrExecutable<W>plus its standard constructors and accessors (new,with_verifier_keys,witnesses,executable,initial_state).
Structs§
- Contract
State - InMemoryDB
- An in-memory database
Enums§
- Ledger
Field Schema - Parsed-once schema for one ledger field. Re-export of the IR’s
typed
Storage— kept as a public alias under the historicalLedgerFieldSchemaname so generated code referring tomoonproof_runtime::ir_executable::LedgerFieldSchemakeeps resolving without an emitter rebuild. Storage shape of a ledger field. Discriminated on a"storage"JSON tag — the wire format compactc emits is: