Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include "./content_addressed_indexed_tree.hpp"
#include "../fixtures.hpp"
#include "../hash.hpp"
#include "../node_store/array_store.hpp"
#include "../nullifier_tree/nullifier_memory_tree.hpp"
#include "../test_fixtures.hpp"
#include "./fixtures.hpp"
#include "barretenberg/common/streams.hpp"
#include "barretenberg/common/test.hpp"
#include "barretenberg/common/thread_pool.hpp"
#include "barretenberg/crypto/merkle_tree/hash_path.hpp"
#include "barretenberg/crypto/merkle_tree/indexed_tree/indexed_leaf.hpp"
#include "barretenberg/crypto/merkle_tree/lmdb_store/lmdb_tree_store.hpp"
#include "barretenberg/crypto/merkle_tree/node_store/cached_content_addressed_tree_store.hpp"
#include "barretenberg/crypto/merkle_tree/response.hpp"
#include "barretenberg/crypto/merkle_tree/types.hpp"
#include "barretenberg/numeric/random/engine.hpp"
#include <algorithm>
#include <cstdint>
#include <filesystem>
#include <future>
#include <memory>
#include <optional>
#include <stdexcept>
#include <vector>
Go to the source code of this file.
Classes | |
class | PersistedContentAddressedIndexedTreeTest |
Typedefs | |
using | HashPolicy = Poseidon2HashPolicy |
using | Store = ContentAddressedCachedTreeStore< NullifierLeafValue > |
using | TreeType = ContentAddressedIndexedTree< Store, HashPolicy > |
using | PublicDataStore = ContentAddressedCachedTreeStore< PublicDataLeafValue > |
using | PublicDataTreeType = ContentAddressedIndexedTree< PublicDataStore, Poseidon2HashPolicy > |
using | CompletionCallback = TreeType::AddCompletionCallbackWithWitness |
using | SequentialCompletionCallback = TreeType::AddSequentiallyCompletionCallbackWithWitness |
Functions | |
std::unique_ptr< TreeType > | create_tree (const std::string &rootDirectory, uint64_t mapSize, uint64_t maxReaders, uint32_t depth, uint32_t batchSize, ThreadPoolPtr workers) |
template<typename TypeOfTree > | |
void | check_size (TypeOfTree &tree, index_t expected_size, bool includeUncommitted=true) |
template<typename TypeOfTree > | |
fr | get_root (TypeOfTree &tree, bool includeUncommitted=true) |
template<typename TypeOfTree > | |
void | check_root (TypeOfTree &tree, fr expected_root, bool includeUncommitted=true) |
template<typename TypeOfTree > | |
fr_sibling_path | get_historic_sibling_path (TypeOfTree &tree, block_number_t blockNumber, index_t index, bool includeUncommitted=true, bool expected_success=true) |
template<typename LeafValueType , typename TypeOfTree > | |
IndexedLeaf< LeafValueType > | get_leaf (TypeOfTree &tree, index_t index, bool includeUncommitted=true, bool expected_success=true) |
template<typename LeafValueType , typename TypeOfTree > | |
GetLowIndexedLeafResponse | get_low_leaf (TypeOfTree &tree, const LeafValueType &leaf, bool includeUncommitted=true) |
template<typename LeafValueType , typename TypeOfTree > | |
GetLowIndexedLeafResponse | get_historic_low_leaf (TypeOfTree &tree, block_number_t blockNumber, const LeafValueType &leaf, bool includeUncommitted=true) |
template<typename LeafValueType , typename TypeOfTree > | |
void | check_historic_leaf (TypeOfTree &tree, const LeafValueType &leaf, index_t expected_index, block_number_t blockNumber, bool expected_success, bool includeUncommitted=true) |
template<typename TypeOfTree > | |
void | check_historic_sibling_path (TypeOfTree &tree, index_t index, block_number_t blockNumber, const fr_sibling_path &expected_sibling_path, bool includeUncommitted=true, bool expected_success=true) |
template<typename TypeOfTree > | |
void | check_sibling_path (TypeOfTree &tree, index_t index, const fr_sibling_path &expected_sibling_path, bool includeUncommitted=true, bool expected_success=true) |
template<typename TypeOfTree > | |
void | check_unfinalized_block_height (TypeOfTree &tree, index_t expected_block_height) |
template<typename TypeOfTree > | |
void | commit_tree (TypeOfTree &tree, bool expectedSuccess=true) |
template<typename LeafValueType , typename TypeOfTree > | |
void | add_value (TypeOfTree &tree, const LeafValueType &value, bool expectedSuccess=true) |
template<typename LeafValueType , typename TypeOfTree > | |
void | add_value_sequentially (TypeOfTree &tree, const LeafValueType &value, bool expectedSuccess=true) |
template<typename LeafValueType , typename TypeOfTree > | |
void | add_values (TypeOfTree &tree, const std::vector< LeafValueType > &values, bool expectedSuccess=true) |
template<typename LeafValueType , typename TypeOfTree > | |
void | add_values_sequentially (TypeOfTree &tree, const std::vector< LeafValueType > &values, bool expectedSuccess=true) |
template<typename LeafValueType , typename TypeOfTree > | |
void | block_sync_values (TypeOfTree &tree, const std::vector< LeafValueType > &values, bool expectedSuccess=true) |
template<typename LeafValueType , typename TypeOfTree > | |
void | block_sync_values_sequential (TypeOfTree &tree, const std::vector< LeafValueType > &values, bool expectedSuccess=true) |
template<typename TypeOfTree > | |
void | remove_historic_block (TypeOfTree &tree, const block_number_t &blockNumber, bool expected_success=true) |
template<typename TypeOfTree > | |
void | finalize_block (TypeOfTree &tree, const block_number_t &blockNumber, bool expected_success=true) |
template<typename TypeOfTree > | |
void | unwind_block (TypeOfTree &tree, const block_number_t &blockNumber, bool expected_success=true) |
template<typename TypeOfTree > | |
void | check_block_height (TypeOfTree &tree, index_t expected_block_height) |
TEST_F (PersistedContentAddressedIndexedTreeTest, can_create) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, can_only_recreate_with_same_name_and_depth) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_size) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, indexed_tree_must_have_at_least_2_initial_size) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, reports_an_error_if_tree_is_overfilled) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_get_sibling_path) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_find_leaf_index) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, can_commit_and_restore) | |
void | test_batch_insert (uint32_t batchSize, std::string directory, uint64_t mapSize, uint64_t maxReaders) |
void | test_batch_insert_with_commit_restore (uint32_t batchSize, std::string directory, uint64_t mapSize, uint64_t maxReaders) |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_batch_insert) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_batch_insert_with_commit_restore) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_compare_batch_inserts_different_sized_thread_pools) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, reports_an_error_if_batch_contains_duplicate) | |
void | test_sequential_insert_vs_batch (uint32_t batchSize, std::string directory, uint64_t mapSize, uint64_t maxReaders) |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_sequential_insert_vs_batch) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, sequential_insert_allows_multiple_inserts_to_the_same_key) | |
template<typename LeafValueType > | |
fr | hash_leaf (const IndexedLeaf< LeafValueType > &leaf) |
bool | verify_sibling_path (TreeType &tree, const IndexedNullifierLeafType &leaf_value, const uint32_t idx) |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_indexed_memory) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_indexed_tree) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, can_add_single_whilst_reading) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_indexed_memory_with_public_data_writes) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_indexed_memory_with_sequential_public_data_writes) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, returns_low_leaves) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, duplicates) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_historic_sibling_path_retrieval) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_historical_leaves) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_inserting_a_duplicate_committed_nullifier_should_fail) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_inserting_a_duplicate_uncommitted_nullifier_should_fail) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_can_create_forks_at_historic_blocks) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_remove_historical_blocks) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_unwind_blocks) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_unwind_duplicate_block) | |
void | test_nullifier_tree_unwind (std::string directory, std::string name, uint64_t mapSize, uint64_t maxReaders, uint32_t depth, uint32_t blockSize, uint32_t numBlocks, uint32_t numBlocksToUnwind, std::vector< fr > values) |
TEST_F (PersistedContentAddressedIndexedTreeTest, can_sync_and_unwind_blocks) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, can_sync_and_unwind_empty_blocks) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_prefilled_public_data) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_full_prefilled_public_data) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_prefilled_unsorted_public_data_should_fail) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_prefilled_default_public_data_should_fail) | |
TEST_F (PersistedContentAddressedIndexedTreeTest, test_can_commit_and_revert_checkpoints) | |
void | advance_state (TreeType &fork, uint32_t size) |
TEST_F (PersistedContentAddressedIndexedTreeTest, nullifiers_can_be_inserted_after_revert) | |
using CompletionCallback = TreeType::AddCompletionCallbackWithWitness |
Definition at line 38 of file content_addressed_indexed_tree.test.cpp.
using HashPolicy = Poseidon2HashPolicy |
Definition at line 30 of file content_addressed_indexed_tree.test.cpp.
Definition at line 35 of file content_addressed_indexed_tree.test.cpp.
Definition at line 36 of file content_addressed_indexed_tree.test.cpp.
using SequentialCompletionCallback = TreeType::AddSequentiallyCompletionCallbackWithWitness |
Definition at line 39 of file content_addressed_indexed_tree.test.cpp.
Definition at line 32 of file content_addressed_indexed_tree.test.cpp.
using TreeType = ContentAddressedIndexedTree<Store, HashPolicy> |
Definition at line 33 of file content_addressed_indexed_tree.test.cpp.
void add_value | ( | TypeOfTree & | tree, |
const LeafValueType & | value, | ||
bool | expectedSuccess = true |
||
) |
Definition at line 251 of file content_addressed_indexed_tree.test.cpp.
void add_value_sequentially | ( | TypeOfTree & | tree, |
const LeafValueType & | value, | ||
bool | expectedSuccess = true |
||
) |
Definition at line 264 of file content_addressed_indexed_tree.test.cpp.
void add_values | ( | TypeOfTree & | tree, |
const std::vector< LeafValueType > & | values, | ||
bool | expectedSuccess = true |
||
) |
Definition at line 278 of file content_addressed_indexed_tree.test.cpp.
void add_values_sequentially | ( | TypeOfTree & | tree, |
const std::vector< LeafValueType > & | values, | ||
bool | expectedSuccess = true |
||
) |
Definition at line 291 of file content_addressed_indexed_tree.test.cpp.
void advance_state | ( | TreeType & | fork, |
uint32_t | size | ||
) |
Definition at line 3162 of file content_addressed_indexed_tree.test.cpp.
void block_sync_values | ( | TypeOfTree & | tree, |
const std::vector< LeafValueType > & | values, | ||
bool | expectedSuccess = true |
||
) |
Definition at line 304 of file content_addressed_indexed_tree.test.cpp.
void block_sync_values_sequential | ( | TypeOfTree & | tree, |
const std::vector< LeafValueType > & | values, | ||
bool | expectedSuccess = true |
||
) |
Definition at line 317 of file content_addressed_indexed_tree.test.cpp.
void check_block_height | ( | TypeOfTree & | tree, |
index_t | expected_block_height | ||
) |
Definition at line 367 of file content_addressed_indexed_tree.test.cpp.
void check_historic_leaf | ( | TypeOfTree & | tree, |
const LeafValueType & | leaf, | ||
index_t | expected_index, | ||
block_number_t | blockNumber, | ||
bool | expected_success, | ||
bool | includeUncommitted = true |
||
) |
Definition at line 182 of file content_addressed_indexed_tree.test.cpp.
void check_historic_sibling_path | ( | TypeOfTree & | tree, |
index_t | index, | ||
block_number_t | blockNumber, | ||
const fr_sibling_path & | expected_sibling_path, | ||
bool | includeUncommitted = true , |
||
bool | expected_success = true |
||
) |
Definition at line 203 of file content_addressed_indexed_tree.test.cpp.
void check_root | ( | TypeOfTree & | tree, |
fr | expected_root, | ||
bool | includeUncommitted = true |
||
) |
Definition at line 103 of file content_addressed_indexed_tree.test.cpp.
void check_sibling_path | ( | TypeOfTree & | tree, |
index_t | index, | ||
const fr_sibling_path & | expected_sibling_path, | ||
bool | includeUncommitted = true , |
||
bool | expected_success = true |
||
) |
Definition at line 217 of file content_addressed_indexed_tree.test.cpp.
void check_size | ( | TypeOfTree & | tree, |
index_t | expected_size, | ||
bool | includeUncommitted = true |
||
) |
Definition at line 78 of file content_addressed_indexed_tree.test.cpp.
void check_unfinalized_block_height | ( | TypeOfTree & | tree, |
index_t | expected_block_height | ||
) |
Definition at line 227 of file content_addressed_indexed_tree.test.cpp.
void commit_tree | ( | TypeOfTree & | tree, |
bool | expectedSuccess = true |
||
) |
Definition at line 239 of file content_addressed_indexed_tree.test.cpp.
std::unique_ptr< TreeType > create_tree | ( | const std::string & | rootDirectory, |
uint64_t | mapSize, | ||
uint64_t | maxReaders, | ||
uint32_t | depth, | ||
uint32_t | batchSize, | ||
ThreadPoolPtr | workers | ||
) |
Definition at line 62 of file content_addressed_indexed_tree.test.cpp.
void finalize_block | ( | TypeOfTree & | tree, |
const block_number_t & | blockNumber, | ||
bool | expected_success = true |
||
) |
Definition at line 344 of file content_addressed_indexed_tree.test.cpp.
GetLowIndexedLeafResponse get_historic_low_leaf | ( | TypeOfTree & | tree, |
block_number_t | blockNumber, | ||
const LeafValueType & | leaf, | ||
bool | includeUncommitted = true |
||
) |
Definition at line 165 of file content_addressed_indexed_tree.test.cpp.
fr_sibling_path get_historic_sibling_path | ( | TypeOfTree & | tree, |
block_number_t | blockNumber, | ||
index_t | index, | ||
bool | includeUncommitted = true , |
||
bool | expected_success = true |
||
) |
Definition at line 110 of file content_addressed_indexed_tree.test.cpp.
IndexedLeaf< LeafValueType > get_leaf | ( | TypeOfTree & | tree, |
index_t | index, | ||
bool | includeUncommitted = true , |
||
bool | expected_success = true |
||
) |
Definition at line 131 of file content_addressed_indexed_tree.test.cpp.
GetLowIndexedLeafResponse get_low_leaf | ( | TypeOfTree & | tree, |
const LeafValueType & | leaf, | ||
bool | includeUncommitted = true |
||
) |
Definition at line 151 of file content_addressed_indexed_tree.test.cpp.
fr get_root | ( | TypeOfTree & | tree, |
bool | includeUncommitted = true |
||
) |
Definition at line 90 of file content_addressed_indexed_tree.test.cpp.
fr hash_leaf | ( | const IndexedLeaf< LeafValueType > & | leaf | ) |
Definition at line 1053 of file content_addressed_indexed_tree.test.cpp.
void remove_historic_block | ( | TypeOfTree & | tree, |
const block_number_t & | blockNumber, | ||
bool | expected_success = true |
||
) |
Definition at line 332 of file content_addressed_indexed_tree.test.cpp.
void test_batch_insert | ( | uint32_t | batchSize, |
std::string | directory, | ||
uint64_t | mapSize, | ||
uint64_t | maxReaders | ||
) |
Definition at line 637 of file content_addressed_indexed_tree.test.cpp.
void test_batch_insert_with_commit_restore | ( | uint32_t | batchSize, |
std::string | directory, | ||
uint64_t | mapSize, | ||
uint64_t | maxReaders | ||
) |
Definition at line 721 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
can_add_single_whilst_reading | |||
) |
Definition at line 1286 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
can_commit_and_restore | |||
) |
Definition at line 574 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
can_create | |||
) |
Definition at line 379 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
can_only_recreate_with_same_name_and_depth | |||
) |
Definition at line 394 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
can_sync_and_unwind_blocks | |||
) |
Definition at line 2749 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
can_sync_and_unwind_empty_blocks | |||
) |
Definition at line 2765 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
duplicates | |||
) |
Definition at line 1669 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
indexed_tree_must_have_at_least_2_initial_size | |||
) |
Definition at line 424 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
nullifiers_can_be_inserted_after_revert | |||
) |
Definition at line 3172 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
reports_an_error_if_batch_contains_duplicate | |||
) |
Definition at line 879 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
reports_an_error_if_tree_is_overfilled | |||
) |
Definition at line 436 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
returns_low_leaves | |||
) |
Definition at line 1645 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
sequential_insert_allows_multiple_inserts_to_the_same_key | |||
) |
Definition at line 1033 of file content_addressed_indexed_tree.test.cpp.
Definition at line 812 of file content_addressed_indexed_tree.test.cpp.
Definition at line 821 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_can_commit_and_revert_checkpoints | |||
) |
Intial state:
slot 0 1 0 0 0 0 0 0 val 0 0 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 1 0 0 0 0 0 0 0
Add new slot:value 30:5:
slot 0 1 30 0 0 0 0 0 val 0 0 5 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Add new slot:value 10:20:
slot 0 1 30 10 0 0 0 0 val 0 0 5 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Update value at slot 30 to 6:
slot 0 1 30 10 0 0 0 0 val 0 0 6 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Add new value slot:value 50:8:
slot 0 1 30 10 50 0 0 0 val 0 0 6 20 8 0 0 0 nextIdx 1 3 4 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Add new value slot:value 50:8:
slot 0 1 30 10 50 0 0 0 val 0 0 6 20 8 0 0 0 nextIdx 1 3 4 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Update the value in slot 30 to 12:
slot 0 1 30 10 50 0 0 0 val 0 0 12 20 8 0 0 0 nextIdx 1 3 4 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Add a value at slot 45:15
slot 0 1 30 10 50 45 0 0 val 0 0 12 20 8 15 0 0 nextIdx 1 3 5 2 0 4 0 0 nextVal 1 10 45 30 0 50 0 0
We should revert to this state:
slot 0 1 30 10 50 0 0 0 val 0 0 6 20 8 0 0 0 nextIdx 1 3 4 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Definition at line 2877 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_can_create_forks_at_historic_blocks | |||
) |
Definition at line 1950 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_compare_batch_inserts_different_sized_thread_pools | |||
) |
Definition at line 830 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_find_leaf_index | |||
) |
Definition at line 509 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_full_prefilled_public_data | |||
) |
Intial state:
slot 0 1 3 5 0 0 0 0 val 0 0 9 7 0 0 0 0 nextIdx 1 2 3 0 0 0 0 0 nextVal 1 3 5 0 0 0 0 0
Definition at line 2814 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_get_sibling_path | |||
) |
Definition at line 466 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_historic_sibling_path_retrieval | |||
) |
Definition at line 1692 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_historical_leaves | |||
) |
Intial state:
slot 0 1 0 0 0 0 0 0 val 0 0 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 1 0 0 0 0 0 0 0
Add new slot:value 30:5:
slot 0 1 30 0 0 0 0 0 val 0 0 5 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Add new slot:value 10:20:
slot 0 1 30 10 0 0 0 0 val 0 0 5 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Update value at slot 30 to 6:
slot 0 1 30 10 0 0 0 0 val 0 0 6 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Add new value slot:value 50:8:
slot 0 1 30 10 50 0 0 0 val 0 0 6 20 8 0 0 0 nextIdx 1 3 4 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Definition at line 1752 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_indexed_memory | |||
) |
Intial state:
val 1 1 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 0 0 0 0 0 0 0 0
Add new value 30:
val 0 1 30 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Add new value 10:
val 0 1 30 10 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Add new value 20:
val 0 1 30 10 20 0 0 0 nextIdx 1 3 0 4 2 0 0 0 nextVal 1 10 0 20 30 0 0 0
Add new value 50:
val 0 1 30 10 20 50 0 0 nextIdx 1 3 5 4 2 0 0 0 nextVal 1 10 50 20 30 0 0 0
Definition at line 1074 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_indexed_memory_with_public_data_writes | |||
) |
Intial state:
slot 0 1 0 0 0 0 0 0 val 0 0 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 1 0 0 0 0 0 0 0
Add new slot:value 30:5:
slot 0 1 30 0 0 0 0 0 val 0 0 5 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Add new slot:value 10:20:
slot 0 1 30 10 0 0 0 0 val 0 0 5 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Update value at slot 30 to 6:
slot 0 1 30 10 0 0 0 0 val 0 0 6 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Add new value slot:value 50:8:
slot 0 1 30 10 0 50 0 0 val 0 0 6 20 0 8 0 0 nextIdx 1 3 5 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Definition at line 1325 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_indexed_memory_with_sequential_public_data_writes | |||
) |
Intial state:
slot 0 1 0 0 0 0 0 0 val 0 0 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 1 0 0 0 0 0 0 0
Add new slot:value 30:5:
slot 0 1 30 0 0 0 0 0 val 0 0 5 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Add new slot:value 10:20:
slot 0 1 30 10 0 0 0 0 val 0 0 5 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Update value at slot 30 to 6:
slot 0 1 30 10 0 0 0 0 val 0 0 6 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Add new value slot:value 50:8:
slot 0 1 30 10 50 0 0 0 val 0 0 6 20 8 0 0 0 nextIdx 1 3 4 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Definition at line 1486 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_indexed_tree | |||
) |
Definition at line 1236 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_inserting_a_duplicate_committed_nullifier_should_fail | |||
) |
Definition at line 1889 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_inserting_a_duplicate_uncommitted_nullifier_should_fail | |||
) |
Definition at line 1920 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_prefilled_default_public_data_should_fail | |||
) |
Definition at line 2863 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_prefilled_public_data | |||
) |
Intial state:
slot 0 1 3 5 0 0 0 0 val 0 0 9 7 0 0 0 0 nextIdx 1 2 3 0 0 0 0 0 nextVal 1 3 5 0 0 0 0 0
Definition at line 2781 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_prefilled_unsorted_public_data_should_fail | |||
) |
Definition at line 2849 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_remove_historical_blocks | |||
) |
Intial state:
slot 0 1 0 0 0 0 0 0 val 0 0 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 1 0 0 0 0 0 0 0
Add new slot:value 30:5:
slot 0 1 30 0 0 0 0 0 val 0 0 5 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Add new slot:value 10:20:
slot 0 1 30 10 0 0 0 0 val 0 0 5 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Update value at slot 30 to 6:
slot 0 1 30 10 0 0 0 0 val 0 0 6 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Add new value slot:value 50:8:
slot 0 1 30 10 50 0 0 0 val 0 0 6 20 8 0 0 0 nextIdx 1 3 4 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Definition at line 2053 of file content_addressed_indexed_tree.test.cpp.
Definition at line 1024 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_size | |||
) |
Definition at line 405 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_unwind_blocks | |||
) |
Intial state:
slot 0 1 0 0 0 0 0 0 val 0 0 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 1 0 0 0 0 0 0 0
Add new slot:value 30:5:
slot 0 1 30 0 0 0 0 0 val 0 0 5 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Add new slot:value 10:20:
slot 0 1 30 10 0 0 0 0 val 0 0 5 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Update value at slot 30 to 6:
slot 0 1 30 10 0 0 0 0 val 0 0 6 20 0 0 0 0 nextIdx 1 3 0 2 0 0 0 0 nextVal 1 10 0 30 0 0 0 0
Add new value slot:value 50:8:
slot 0 1 30 10 50 0 0 0 val 0 0 6 20 8 0 0 0 nextIdx 1 3 4 2 0 0 0 0 nextVal 1 10 50 30 0 0 0 0
Definition at line 2217 of file content_addressed_indexed_tree.test.cpp.
TEST_F | ( | PersistedContentAddressedIndexedTreeTest | , |
test_unwind_duplicate_block | |||
) |
Intial state:
slot 0 1 0 0 0 0 0 0 val 0 0 0 0 0 0 0 0 nextIdx 1 0 0 0 0 0 0 0 nextVal 1 0 0 0 0 0 0 0
Add new slot:value 30:5:
slot 0 1 30 0 0 0 0 0 val 0 0 5 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Update slot:value 30:8:
slot 0 1 30 0 0 0 0 0 val 0 0 8 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Revert slot:value 30:5:
slot 0 1 30 0 0 0 0 0 val 0 0 5 0 0 0 0 0 nextIdx 1 2 0 0 0 0 0 0 nextVal 1 30 0 0 0 0 0 0
Definition at line 2462 of file content_addressed_indexed_tree.test.cpp.
void test_nullifier_tree_unwind | ( | std::string | directory, |
std::string | name, | ||
uint64_t | mapSize, | ||
uint64_t | maxReaders, | ||
uint32_t | depth, | ||
uint32_t | blockSize, | ||
uint32_t | numBlocks, | ||
uint32_t | numBlocksToUnwind, | ||
std::vector< fr > | values | ||
) |
Definition at line 2624 of file content_addressed_indexed_tree.test.cpp.
void test_sequential_insert_vs_batch | ( | uint32_t | batchSize, |
std::string | directory, | ||
uint64_t | mapSize, | ||
uint64_t | maxReaders | ||
) |
Definition at line 909 of file content_addressed_indexed_tree.test.cpp.
void unwind_block | ( | TypeOfTree & | tree, |
const block_number_t & | blockNumber, | ||
bool | expected_success = true |
||
) |
Definition at line 356 of file content_addressed_indexed_tree.test.cpp.
bool verify_sibling_path | ( | TreeType & | tree, |
const IndexedNullifierLeafType & | leaf_value, | ||
const uint32_t | idx | ||
) |
Definition at line 1058 of file content_addressed_indexed_tree.test.cpp.