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§
- Frontier
Full MmrFrontier::try_appendrefused a leaf: the frontier already holdsMAX_MMR_LEAF_COUNT.- Message
Position - 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_countfixes 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. - Spec
Merge - Domain-tagged
mmr_lib::Mergefor 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 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:MmrRoot::from_bagbinds the leaf count over it. No peaks bag to zero. - empty_
root - The root of an empty MMR.