Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <memory_tree.hpp>
Public Member Functions | |
MemoryTree (size_t depth) | |
fr_hash_path | get_hash_path (size_t index) const |
fr_sibling_path | get_sibling_path (size_t index) const |
fr | update_element (size_t index, fr const &value) |
fr | root () const |
fr | get_node (uint32_t level, size_t index) const |
Public Attributes | |
size_t | depth_ |
size_t | total_size_ |
bb::fr | root_ |
std::vector< bb::fr > | hashes_ |
A MemoryTree is structured as follows: hashes_ +---------------------------------------------------------------------------—+ | 0 -> h_{0,0} h_{0,1} h_{0,2} h_{0,3} h_{0,4} h_{0,5} h_{0,6} h_{0,7} | i | | n | 8 -> h_{1,0} h_{1,1} h_{1,2} h_{1,3} | d | | e | 12 -> h_{2,0} h_{2,1} | x | | | 14 -> h_{3,0} | +---------------------------------------------------------------------------—+
Here, depth_ = 3 and {h_{0,j}}_{i=0..7} are leaf values. Also, root_ = h_{3,0} and total_size_ = (2 * 8 - 2) = 14. Lastly, h_{i,j} = hash( h_{i-1,2j}, h_{i-1,2j+1} ) where i > 1.
Definition at line 30 of file memory_tree.hpp.
bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::MemoryTree | ( | size_t | depth | ) |
Definition at line 52 of file memory_tree.hpp.
fr_hash_path bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::get_hash_path | ( | size_t | index | ) | const |
Definition at line 83 of file memory_tree.hpp.
fr bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::get_node | ( | uint32_t | level, |
size_t | index | ||
) | const |
Definition at line 74 of file memory_tree.hpp.
fr_sibling_path bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::get_sibling_path | ( | size_t | index | ) | const |
Definition at line 98 of file memory_tree.hpp.
|
inline |
Definition at line 40 of file memory_tree.hpp.
fr bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::update_element | ( | size_t | index, |
fr const & | value | ||
) |
Definition at line 116 of file memory_tree.hpp.
size_t bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::depth_ |
Definition at line 45 of file memory_tree.hpp.
std::vector<bb::fr> bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::hashes_ |
Definition at line 48 of file memory_tree.hpp.
bb::fr bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::root_ |
Definition at line 47 of file memory_tree.hpp.
size_t bb::crypto::merkle_tree::MemoryTree< HashingPolicy >::total_size_ |
Definition at line 46 of file memory_tree.hpp.