Crate ab_sparse_merkle_tree

Source
Expand description

Sparse Merkle Tree and related data structures.

Sparse Merkle Tree is essentially a huge Balanced Merkle Tree, where most of the leaves are empty. By “empty” here we mean [0u8; 32]. In order to optimize proofs and their verification, hashing function is customized and returns [0u8; 32] when both left and right branch are [0u8; 32], otherwise BLAKE3 hash is used like in a Balanced Merkle Tree.

Structs§

SparseMerkleTree
Sparse Merkle Tree variant that has hash-sized leaves, with most leaves being empty (have value [0u8; 32]).

Enums§

Leaf
Sparse Merkle Tree Leaf

Constants§

INNER_NODE_DOMAIN_SEPARATOR
Used as a key in keyed blake3 hash for inner nodes of Merkle Trees.

Functions§

ensure_supported_bits
Ensuring only supported NUM_BITS can be specified for SparseMerkleTree.
hash_pair
Helper function to hash two nodes together using [ab_blake3::single_block_keyed_hash()] and INNER_NODE_DOMAIN_SEPARATOR