Trait MmrHasher

Source
trait MmrHasher {
    type Word: Copy + PartialEq;

    // Required methods
    fn from_b256(x: &B256) -> Self::Word;
    fn hash_pair(left: &Self::Word, right: &Self::Word) -> Self::Word;
    fn leaf_from_header_hash(header_hash: &B256) -> Self::Word;
    fn mmr_root(elements_count: u128, bag: &Self::Word) -> Self::Word;

    // Provided method
    fn bag_peaks(peaks: &[Self::Word]) -> Self::Word { ... }
}

Required Associated Types§

Required Methods§

Source

fn from_b256(x: &B256) -> Self::Word

Convert a 32-byte value from proofs into the internal word type.

Source

fn hash_pair(left: &Self::Word, right: &Self::Word) -> Self::Word

Hash an ordered pair (left, right).

Source

fn leaf_from_header_hash(header_hash: &B256) -> Self::Word

Compute the leaf from the raw header hash.

Source

fn mmr_root(elements_count: u128, bag: &Self::Word) -> Self::Word

Compute the MMR root from the elements count and bagged peaks.

Provided Methods§

Source

fn bag_peaks(peaks: &[Self::Word]) -> Self::Word

Bag peaks right-to-left: H(peak1, H(peak2, ... H(peakN))).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§