pub struct StandardMerkleTree { /* private fields */ }
Expand description
Represents a standard Merkle tree with methods for proof generation and verification.
Implementations§
Source§impl StandardMerkleTree
impl StandardMerkleTree
Sourcepub fn new(tree: Vec<B256>, values: Vec<(&DynSolValue, usize)>) -> Self
pub fn new(tree: Vec<B256>, values: Vec<(&DynSolValue, usize)>) -> Self
Creates a new StandardMerkleTree
with the given tree nodes and values.
pub fn of(values: &[DynSolValue]) -> Self
pub fn of_sorted(values: &[DynSolValue]) -> Self
Sourcepub fn get_proof(
&self,
value: &DynSolValue,
) -> Result<Vec<B256>, MerkleTreeError>
pub fn get_proof( &self, value: &DynSolValue, ) -> Result<Vec<B256>, MerkleTreeError>
Generates a Merkle proof for a given leaf value.
Sourcepub fn verify_proof(&self, leaf: &DynSolValue, proof: Vec<B256>) -> bool
pub fn verify_proof(&self, leaf: &DynSolValue, proof: Vec<B256>) -> bool
Verifies a Merkle proof for a given leaf value.
Trait Implementations§
Source§impl Debug for StandardMerkleTree
impl Debug for StandardMerkleTree
Auto Trait Implementations§
impl Freeze for StandardMerkleTree
impl RefUnwindSafe for StandardMerkleTree
impl Send for StandardMerkleTree
impl Sync for StandardMerkleTree
impl Unpin for StandardMerkleTree
impl UnwindSafe for StandardMerkleTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more