Module concurrent_tree_wrapper

Module concurrent_tree_wrapper 

Source
Expand description

This module provides a wrapper around the ConcurrentMerkleTree struct from the spl_concurrent_merkle_tree crate. It provides a set of functions that can be called from the Anchor program to interact with the tree. The functions are used to initialize the tree, set a leaf, fill empty or append a leaf, and prove a leaf. As the tree is generic over the depth and buffer size, the functions are implemented using macros that infer the depth and buffer size from the header information stored on-chain. Usage of the macros directly is discouraged, as they have huge match statements with every case taking it’s own stack frame. Instead, use the exported functions from this module and refenrece or Box the arguments to the functions to avoid the stack frame explosion.

Re-exports§

pub use crate::error::AccountCompressionError;

Structs§

ConcurrentMerkleTree
Exported for Anchor / Solita Conurrent Merkle Tree is a Merkle Tree that allows multiple tree operations targeted for the same tree root to succeed.
FillEmptyOrAppendArgs
Exported for Anchor / Solita Arguments structure for filling an empty leaf or appending a new leaf to the tree.
InitializeWithRootArgs
Exported for Anchor / Solita Arguments structure for initializing a tree with a root.
ProveLeafArgs
Exported for Anchor / Solita Arguments structure for proving a leaf in the tree.
SetLeafArgs
Exported for Anchor / Solita Arguments structure for setting a leaf in the tree.

Enums§

ConcurrentMerkleTreeError
Exported for Anchor / Solita Concurrent merkle tree operation errors

Constants§

EMPTY
Exported for Anchor / Solita An empty node is a 32 byte array of zeroes

Functions§

merkle_tree_append_leaf
merkle_tree_fill_empty_or_append
merkle_tree_initialize_empty
merkle_tree_initialize_with_root
merkle_tree_prove_leaf
merkle_tree_prove_tree_is_empty
merkle_tree_set_leaf

Type Aliases§

Node
Exported for Anchor / Solita Abstract type for 32 byte leaf data