|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <merkle_tree.hpp>
Public Types | |
| typedef uint256_t | index_t |
Public Member Functions | |
| MerkleTree (Store &store, size_t depth, uint8_t tree_id=0) | |
| MerkleTree (MerkleTree const &other)=delete | |
| MerkleTree (MerkleTree &&other) | |
| ~MerkleTree () | |
| fr_hash_path | get_hash_path (index_t index) |
| fr_sibling_path | get_sibling_path (index_t index) |
| fr | update_element (index_t index, fr const &value) |
| fr | root () const |
| size_t | depth () const |
| index_t | size () const |
Protected Member Functions | |
| void | load_metadata () |
| fr | update_element (fr const &root, fr const &value, index_t index, size_t height) |
| fr | get_element (fr const &root, index_t index, size_t height) |
| fr | compute_zero_path_hash (size_t height, index_t index, fr const &value) |
| fr | binary_put (index_t a_index, fr const &a, fr const &b, size_t height) |
| fr | fork_stump (fr const &value1, index_t index1, fr const &value2, index_t index2, size_t height, size_t stump_height) |
| void | put (fr const &key, fr const &left, fr const &right) |
| void | put_stump (fr const &key, index_t index, fr const &value) |
| void | remove (fr const &key) |
Protected Attributes | |
| Store & | store_ |
| std::vector< fr > | zero_hashes_ |
| size_t | depth_ |
| uint8_t | tree_id_ |
Definition at line 23 of file merkle_tree.hpp.
| typedef uint256_t bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::index_t |
Definition at line 25 of file merkle_tree.hpp.
| bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::MerkleTree | ( | Store & | store, |
| size_t | depth, | ||
| uint8_t | tree_id = 0 |
||
| ) |
Definition at line 120 of file merkle_tree.hpp.
|
delete |
| bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::MerkleTree | ( | MerkleTree< Store, HashingPolicy > && | other | ) |
Definition at line 138 of file merkle_tree.hpp.
| bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::~MerkleTree | ( | ) |
Definition at line 145 of file merkle_tree.hpp.
|
protected |
Given child nodes a and b and index of a, compute their parent node p and store [p : (a, b)].
| a_index | the index of the child node a |
| a | child node |
| b | child node |
| height | the height of the parent node |
Definition at line 319 of file merkle_tree.hpp.
|
protected |
Computes the root hash of a tree of height, that is empty other than value at index.
| height | The tree depth |
| index | the index of the non-empty leaf |
| value | the value to be stored in the non-empty leaf |
Definition at line 413 of file merkle_tree.hpp.
|
inline |
Definition at line 40 of file merkle_tree.hpp.
|
protected |
Definition at line 330 of file merkle_tree.hpp.
|
protected |
| fr_hash_path bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::get_hash_path | ( | index_t | index | ) |
Definition at line 165 of file merkle_tree.hpp.
| fr_sibling_path bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::get_sibling_path | ( | index_t | index | ) |
Definition at line 238 of file merkle_tree.hpp.
|
protected |
|
protected |
Stores a parent node and child nodes in the database as [key : (left, right)].
| key | The node value to be stored as key |
| left | the left child node |
| right | the right child node |
Definition at line 432 of file merkle_tree.hpp.
|
protected |
Stores a stump [key : (value, index, true)] in the memory. The additional byte true is to denote this is a stump.
| key | The node value to be stored as key |
| value | value of the non-empty leaf in the stump |
| index | the index of the non-empty leaf in the stump |
Definition at line 441 of file merkle_tree.hpp.
|
protected |
Definition at line 451 of file merkle_tree.hpp.
| fr bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::root | ( | ) | const |
Definition at line 147 of file merkle_tree.hpp.
| MerkleTree< Store, HashingPolicy >::index_t bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::size | ( | ) | const |
Definition at line 156 of file merkle_tree.hpp.
|
protected |
Computes the root hash of a tree of height, that is empty other than value at index.
| height | The tree depth |
| index | the index of the non-empty leaf |
| value | the value to be stored in the non-empty leaf |
Definition at line 356 of file merkle_tree.hpp.
| fr bb::crypto::merkle_tree::MerkleTree< Store, HashingPolicy >::update_element | ( | index_t | index, |
| fr const & | value | ||
| ) |
Definition at line 298 of file merkle_tree.hpp.
|
protected |
Definition at line 106 of file merkle_tree.hpp.
|
protected |
Definition at line 104 of file merkle_tree.hpp.
|
protected |
Definition at line 107 of file merkle_tree.hpp.
|
protected |
Definition at line 105 of file merkle_tree.hpp.