referrerpolicy=no-referrer-when-downgrade

Module mmr

Module mmr 

Source
Expand description

MMR primitives for the Speculative Messaging protocol.

Hashing is SpecHasher with domain tags: leaves by crate::message::leaf_hash (LEAF_TAG), inner nodes by SpecMerge::merge (INNER_TAG), peak bagging by SpecMerge::merge_peaks (PEAK_TAG). mmr_lib calls merge for tree nodes and merge_peaks when bagging, so no two roles collide. The stream root binds the leaf count over the bagged peaks (ROOT_TAG, 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.
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: the leaf count bound over the bagged peaks. 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.

Constants§

MAX_MMR_HASHES
Upper bound on a peak set or other hash list that a leaf count determines: one per bit of a u64.
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: MmrRoot::from_bag binds the leaf count over it. No peaks bag to zero.
empty_root
The root of an empty MMR.