Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
content_addressed_indexed_tree.test.cpp File Reference

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< TreeTypecreate_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< LeafValueTypeget_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)
 

Typedef Documentation

◆ CompletionCallback

using CompletionCallback = TreeType::AddCompletionCallbackWithWitness

Definition at line 38 of file content_addressed_indexed_tree.test.cpp.

◆ HashPolicy

◆ PublicDataStore

◆ PublicDataTreeType

◆ SequentialCompletionCallback

using SequentialCompletionCallback = TreeType::AddSequentiallyCompletionCallbackWithWitness

Definition at line 39 of file content_addressed_indexed_tree.test.cpp.

◆ Store

◆ TreeType

Function Documentation

◆ add_value()

template<typename LeafValueType , typename TypeOfTree >
void add_value ( TypeOfTree &  tree,
const LeafValueType value,
bool  expectedSuccess = true 
)

Definition at line 251 of file content_addressed_indexed_tree.test.cpp.

◆ add_value_sequentially()

template<typename LeafValueType , typename TypeOfTree >
void add_value_sequentially ( TypeOfTree &  tree,
const LeafValueType value,
bool  expectedSuccess = true 
)

Definition at line 264 of file content_addressed_indexed_tree.test.cpp.

◆ add_values()

template<typename LeafValueType , typename TypeOfTree >
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.

◆ add_values_sequentially()

template<typename LeafValueType , typename TypeOfTree >
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.

◆ advance_state()

void advance_state ( TreeType fork,
uint32_t  size 
)

Definition at line 3162 of file content_addressed_indexed_tree.test.cpp.

◆ block_sync_values()

template<typename LeafValueType , typename TypeOfTree >
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.

◆ block_sync_values_sequential()

template<typename LeafValueType , typename TypeOfTree >
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.

◆ check_block_height()

template<typename TypeOfTree >
void check_block_height ( TypeOfTree &  tree,
index_t  expected_block_height 
)

Definition at line 367 of file content_addressed_indexed_tree.test.cpp.

◆ check_historic_leaf()

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 
)

Definition at line 182 of file content_addressed_indexed_tree.test.cpp.

◆ check_historic_sibling_path()

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 
)

Definition at line 203 of file content_addressed_indexed_tree.test.cpp.

◆ check_root()

template<typename TypeOfTree >
void check_root ( TypeOfTree &  tree,
fr  expected_root,
bool  includeUncommitted = true 
)

Definition at line 103 of file content_addressed_indexed_tree.test.cpp.

◆ check_sibling_path()

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 
)

Definition at line 217 of file content_addressed_indexed_tree.test.cpp.

◆ check_size()

template<typename TypeOfTree >
void check_size ( TypeOfTree &  tree,
index_t  expected_size,
bool  includeUncommitted = true 
)

Definition at line 78 of file content_addressed_indexed_tree.test.cpp.

◆ check_unfinalized_block_height()

template<typename TypeOfTree >
void check_unfinalized_block_height ( TypeOfTree &  tree,
index_t  expected_block_height 
)

Definition at line 227 of file content_addressed_indexed_tree.test.cpp.

◆ commit_tree()

template<typename TypeOfTree >
void commit_tree ( TypeOfTree &  tree,
bool  expectedSuccess = true 
)

Definition at line 239 of file content_addressed_indexed_tree.test.cpp.

◆ create_tree()

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.

◆ finalize_block()

template<typename TypeOfTree >
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.

◆ get_historic_low_leaf()

template<typename LeafValueType , typename TypeOfTree >
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.

◆ get_historic_sibling_path()

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 
)

Definition at line 110 of file content_addressed_indexed_tree.test.cpp.

◆ get_leaf()

template<typename LeafValueType , typename TypeOfTree >
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.

◆ get_low_leaf()

template<typename LeafValueType , typename TypeOfTree >
GetLowIndexedLeafResponse get_low_leaf ( TypeOfTree &  tree,
const LeafValueType leaf,
bool  includeUncommitted = true 
)

Definition at line 151 of file content_addressed_indexed_tree.test.cpp.

◆ get_root()

template<typename TypeOfTree >
fr get_root ( TypeOfTree &  tree,
bool  includeUncommitted = true 
)

Definition at line 90 of file content_addressed_indexed_tree.test.cpp.

◆ hash_leaf()

template<typename LeafValueType >
fr hash_leaf ( const IndexedLeaf< LeafValueType > &  leaf)

Definition at line 1053 of file content_addressed_indexed_tree.test.cpp.

◆ remove_historic_block()

template<typename TypeOfTree >
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.

◆ test_batch_insert()

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.

◆ test_batch_insert_with_commit_restore()

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() [1/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
can_add_single_whilst_reading   
)

Definition at line 1286 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [2/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
can_commit_and_restore   
)

Definition at line 574 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [3/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
can_create   
)

Definition at line 379 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [4/37]

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() [5/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
can_sync_and_unwind_blocks   
)

Definition at line 2749 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [6/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
can_sync_and_unwind_empty_blocks   
)

Definition at line 2765 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [7/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
duplicates   
)

Definition at line 1669 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [8/37]

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() [9/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
nullifiers_can_be_inserted_after_revert   
)

Definition at line 3172 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [10/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
reports_an_error_if_batch_contains_duplicate   
)

Definition at line 879 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [11/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
reports_an_error_if_tree_is_overfilled   
)

Definition at line 436 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [12/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
returns_low_leaves   
)

Definition at line 1645 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [13/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
sequential_insert_allows_multiple_inserts_to_the_same_key   
)

Definition at line 1033 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [14/37]

◆ TEST_F() [15/37]

◆ TEST_F() [16/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_can_commit_and_revert_checkpoints   
)

Intial state:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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() [17/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_can_create_forks_at_historic_blocks   
)

Definition at line 1950 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [18/37]

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() [19/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_find_leaf_index   
)

Definition at line 509 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [20/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_full_prefilled_public_data   
)

Intial state:

index 0 1 2 3 4 5 6 7

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() [21/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_get_sibling_path   
)

Definition at line 466 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [22/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_historic_sibling_path_retrieval   
)

Definition at line 1692 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [23/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_historical_leaves   
)

Intial state:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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() [24/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_indexed_memory   
)

Intial state:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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() [25/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_indexed_memory_with_public_data_writes   
)

Intial state:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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() [26/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_indexed_memory_with_sequential_public_data_writes   
)

Intial state:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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() [27/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_indexed_tree   
)

Definition at line 1236 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [28/37]

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() [29/37]

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() [30/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_prefilled_default_public_data_should_fail   
)

Definition at line 2863 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [31/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_prefilled_public_data   
)

Intial state:

index 0 1 2 3 4 5 6 7

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() [32/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_prefilled_unsorted_public_data_should_fail   
)

Definition at line 2849 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [33/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_remove_historical_blocks   
)

Intial state:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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.

◆ TEST_F() [34/37]

◆ TEST_F() [35/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_size   
)

Definition at line 405 of file content_addressed_indexed_tree.test.cpp.

◆ TEST_F() [36/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_unwind_blocks   
)

Intial state:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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() [37/37]

TEST_F ( PersistedContentAddressedIndexedTreeTest  ,
test_unwind_duplicate_block   
)

Intial state:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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:

index 0 1 2 3 4 5 6 7

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.

◆ test_nullifier_tree_unwind()

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.

◆ test_sequential_insert_vs_batch()

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.

◆ unwind_block()

template<typename TypeOfTree >
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.

◆ verify_sibling_path()

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.