For the complete documentation index, see llms.txt.
aztec-nr - noir_aztec::protocol::merkle_tree::append_only_tree

Function insert_subtree_root_to_snapshot_with_hasher

pub fn insert_subtree_root_to_snapshot_with_hasher<let TreeHeight: u32, let SubtreeHeight: u32>(
    snapshot: AppendOnlyTreeSnapshot,
    sibling_path: [Field; TreeHeight - SubtreeHeight],
    subtree_root_to_insert: Field,
    hasher: fn(Field, Field) -> Field,
) -> AppendOnlyTreeSnapshot

Inserts a subtree root into an append-only tree snapshot.

SubtreeHeight must be strictly less than 64: the leaf index is shifted right by SubtreeHeight as a u64 (and the subtree leaf count is computed as 1 << SubtreeHeight), and a u64 shift amount of 64 or more is out of range. As a consequence the whole tree cannot be replaced in a single call (that would require SubtreeHeight == TreeHeight). Supporting SubtreeHeight >= 64 would require wider integer types and is out of scope; in practice every protocol tree uses a far smaller subtree height.