For the complete documentation index, see llms.txt.
aztec-nr - protocol_types::merkle_tree::merkle_tree

Struct MerkleTree

pub struct MerkleTree<let N: u32> {
    pub leaves: [Field; N],
    pub nodes: [Field; N - 1],
}

Fields

leaves: [Field; N]
nodes: [Field; N - 1]

Implementations

impl<let N: u32> MerkleTree<N>

pub fn new(leaves: [Field; N]) -> Self pub fn new_with_hasher(leaves: [Field; N], hasher: fn(Field, Field) -> Field) -> Self pub fn new_sha(leaves: [Field; N]) -> Self pub fn get_root(self) -> Field pub fn get_sibling_path<let K: u32>(self, leaf_index: u32) -> [Field; K]

impl<let N: u32> MerkleTree<N>

pub fn update_leaf_unsafe<let TreeHeight: u32>(&mut self, index: u32, value: Field)

This function is intended for testing purposes only. It is neither optimized nor audited.

pub fn update_leaf_unsafe_with_hasher<let TreeHeight: u32>( &mut self, index: u32, value: Field, hasher: fn(Field, Field) -> Field, )

This function is intended for testing purposes only. It is neither optimized nor audited.

Trait implementations

impl<let N: u32> Empty for MerkleTree<N>

pub fn empty() -> Self pub fn is_empty(self: Self) -> bool
where Self: Eq
pub fn assert_empty<let S: u32>(self: Self, msg: str<S>)
where Self: Eq

impl<let N: u32> Eq for MerkleTree<N>

pub fn eq(_self: Self, _other: Self) -> bool