referrerpolicy=no-referrer-when-downgrade

Module mmr

Module mmr 

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

FrontierFull
MmrFrontier::try_append refused a leaf: the frontier already holds MAX_MMR_LEAF_COUNT.
MessagePosition
A leaf position within a stream’s MMR.
MmrExtensionProof
An append-only MMR extension proof: O(log n) connecting nodes that, with a frontier’s own peaks, reconstruct a newer root. The mmr_lib gen_ancestry_proof form of the design’s connecting_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_count fixes 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 a StreamsRoot, the commitment-tree root.
SpecMerge
Domain-tagged mmr_lib::Merge for the speculative-messaging MMR.

Enums§

ProofError
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 overflows u64 above 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 equals MMR::get_root. Not a stream root (see MmrRoot::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.