Expand description
MMR (Merkle Mountain Range) proof verification
Functions for verifying that headers are committed in MMRs using inclusion proofs.
Structsยง
- Keccak
Hasher ๐ - Keccak-based hasher using
B256as the word type. - MmrVerifier
- Poseidon
Hasher ๐ - Poseidon-based hasher using
Feltas the word type.
Traitsยง
- MmrHasher ๐
Functionsยง
- assert_
mmr_ ๐size_ is_ valid - Validates that an MMR size can be decomposed into distinct peaks of the form
(2^k - 1). - bit_
length ๐ - Returns the number of bits required to represent
n(0 => 0, 1.. => floor(log2(n)) + 1). - compute_
expected_ ๐peaks_ len - Computes how many peaks an MMR of
mmr_sizeelements should have. - compute_
height ๐ - Computes the height in the implicit binary tree for a 1-indexed position
x. - get_
peak_ ๐info - Returns
(peak_index, peak_height)for the 1-indexedelement_indexin an MMR withelements_counttotal elements. The height is the number of edges from the leaf to the peak. - hash_
subtree_ ๐path_ iter - Iterative subtree path hashing generic over the hasher.
- verify_
with_ ๐hasher - Generic verification with a concrete
MmrHasherimplementation.