Expand description
MMR primitives for the Speculative Messaging protocol.
Hashing is SpecHasher with the crate’s domain tags: leaves by leaf_hash, inner nodes by
SpecMerge::merge, peak bagging by SpecMerge::merge_peaks (mmr_lib calls it only when
bagging), stream roots by MmrRoot::from_bag.
SpecMerge is the mmr_lib::Merge for inclusion proofs (gen_proof / MerkleProof::verify)
and ancestry proofs (gen_ancestry_proof / verify_incremental). MmrFrontier is the
peaks-only state: the sender’s on-chain accumulator, and what proofs extend from.
Structs§
- Frontier
Full MmrFrontier::try_appendrefused a leaf: the frontier already holdsMAX_MMR_LEAF_COUNT.- Message
Position - A leaf position within a stream’s MMR.
- MmrExtension
Proof - An append-only MMR extension proof: O(log n) connecting nodes that, with a frontier’s own peaks,
reconstruct a newer root. The
mmr_libgen_ancestry_proofform of the design’sconnecting_nodes. Verification computes the new root; it is never declared alongside the proof. It holds node hashes only, no message payloads. - MmrFrontier
- A peaks-only MMR frontier: the O(log n) state a stream continues from, and the accumulator that
continues it.
leaf_countfixes where an extension proof’s connecting nodes go. - MmrRoot
- A stream’s committed root at some point in its history (
Self::from_bag). A newtype so it cannot be confused with aStreamsRoot, the commitment-tree root. - Spec
Merge - Domain-tagged
mmr_lib::Mergefor the speculative-messaging MMR.
Enums§
- Proof
Error - Why an MMR proof verification rejected its input. Typed so callers can tell a malformed or forged proof from a non-forward or out-of-range one.
Constants§
- MAX_
MMR_ HASHES - Upper bound on a peak set or connecting-node list: one hash per bit of
MAX_MMR_LEAF_COUNT. - MAX_
MMR_ LEAF_ COUNT - Upper bound on any leaf count node positions are derived from;
mmr_lib’s node count overflowsu64above 2^63. Peer-supplied counts are checked against this first.
Functions§
- bag_
peaks - Bag the peaks (highest to lowest) with
mmr_lib’s own bagging, so the result equalsMMR::get_root. Not a stream root (seeMmrRoot::from_bag). No peaks bag to zero. - empty_
root - The root of an empty MMR.
- leaf_
hash - Hash a payload into a stream MMR leaf at
LEAF_VERSION. Source, stream and position are structural and not in the preimage. - leaf_
hash_ with_ version - Hash a payload into a stream MMR leaf at an explicit leaf version. Used to test format disjointness across format revisions.