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§
- Exported for Anchor / Solita Conurrent Merkle Tree is a Merkle Tree that allows multiple tree operations targeted for the same tree root to succeed.
- Exported for Anchor / Solita Arguments structure for filling an empty leaf or appending a new leaf to the tree.
- Exported for Anchor / Solita Arguments structure for initializing a tree with a root.
- Exported for Anchor / Solita Arguments structure for proving a leaf in the tree.
- Exported for Anchor / Solita Arguments structure for setting a leaf in the tree.
Enums§
- Exported for Anchor / Solita Concurrent merkle tree operation errors
Constants§
- Exported for Anchor / Solita An empty node is a 32 byte array of zeroes
Functions§
- Checks whether the tree in not initialized yet without doing the deserialization. A rought equivalent to deserializing the tree and calling is_initialized() on it without the heavy lifting with macros. An empty account is a zero’d account. The tree is considered empty if the tree_bytes are all 0. A regular non-batch initialized tree is initialized early on when the init_empty_merkle_tree is called. A batch initialized tree stays uninitialized until the init_prepared_tree_with_root is called.
Type Aliases§
- Exported for Anchor / Solita Abstract type for 32 byte leaf data