Skip to main content

Module ledger

Module ledger 

Source
Expand description

Atom-buffer + merkle-tree snapshot types for ledger reads.

The async ledger field readers (read_counter_atoms, read_cell_atoms, read_map_atoms, read_set_atoms, read_list_atoms, read_merkle_tree_atoms, read_historic_merkle_tree_atoms) live in [moonproof_contracts::ledger_readers] — they require a PublicDataProvider which would pull a heavy network dep into this wasm-friendly crate.

Each AtomBuffer is the language-agnostic surface produced by storage-shape readers; the descriptor walker in crate::ir::descriptor turns it into a typed moonproof_runtime_ir::RuntimeValue.

Structs§

AtomBuffer
Raw atom buffer — sequence of moonproof_ledger::base_crypto::fab::ValueAtom values. Wraps Vec<ValueAtom> directly so downstream walkers can pass &buf.atoms straight into crate::ir::descriptor::decode_aligned_value without reconstructing a second Vec<ValueAtom> per read.
HistoricMerkleTreeSnapshot
Snapshot of a HistoricMerkleTree<depth, T> storage field — the live tree plus a bounded history window of prior roots.
MerkleTreeSnapshot
Snapshot of a MerkleTree<depth, T> storage field — the live root + height. Mirrors the midnight-js MerkleTree view surface.

Functions§

cell_atoms
Decode a Cell<T>-storage cell into its AtomBuffer.
counter_atoms
Decode a Counter-storage cell into its AtomBuffer.
field_at
Pull the cell at index from the contract’s root state array.
historic_merkle_tree_snapshot
Decode a HistoricMerkleTree<depth, T>-storage cell into its snapshot.
list_entries
Decode a List<T>-storage cell into one entry per slot.
map_entries
Decode a Map<K, V>-storage cell into one entry per stored key.
merkle_tree_snapshot
Decode a MerkleTree<depth, T>-storage cell into its snapshot.
project_atoms_as_json
Project atoms through the descriptor-aware decoder for display purposes only (CLI contract read --json, REPL c.ledger.<field>()).
set_entries
Decode a Set<T>-storage cell into one entry per element.