pub type WalletSmt<'a> = SparseMerkleTree<'static, SMT_FP_DEPTH, { _ }, Base, PoseidonFp, WalletStorage<'a>>;
Expand description
Wallet SMT definition
Aliased Type§
struct WalletSmt<'a> { /* private fields */ }
Implementations
§impl<'a, const N: usize, const M: usize, F, H, S> SparseMerkleTree<'a, N, M, F, H, S>where
F: FieldElement,
H: FieldHasher<F, 2>,
S: StorageAdapter<Value = F>,
impl<'a, const N: usize, const M: usize, F, H, S> SparseMerkleTree<'a, N, M, F, H, S>where
F: FieldElement,
H: FieldHasher<F, 2>,
S: StorageAdapter<Value = F>,
pub fn new(
store: S,
hasher: H,
empty_nodes: &'a [F; M],
) -> SparseMerkleTree<'a, N, M, F, H, S>
pub fn new( store: S, hasher: H, empty_nodes: &'a [F; M], ) -> SparseMerkleTree<'a, N, M, F, H, S>
Creates a new SMT
pub fn insert_batch(&mut self, leaves: Vec<(F, F)>) -> Result<(), ContractError>
pub fn insert_batch(&mut self, leaves: Vec<(F, F)>) -> Result<(), ContractError>
Takes a batch of field elements, inserts these hashes into the tree, and updates the Merkle root.
pub fn remove_leaves( &mut self, leaves: Vec<(F, F)>, ) -> Result<(), ContractError>
pub fn root(&self) -> F
pub fn root(&self) -> F
Returns the Merkle tree root.
pub fn prove_membership(&self, pos: &F) -> Path<N, F, H>
pub fn prove_membership(&self, pos: &F) -> Path<N, F, H>
Give the path leading from the leaf at index
up to the root. This is
a “proof” in the sense of “valid path in a Merkle tree”, not a ZK argument.