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

Go to the source code of this file.

Classes

class  PersistedContentAddressedAppendOnlyTreeTest
 

Typedefs

using Store = ContentAddressedCachedTreeStore< bb::fr >
 
using TreeType = ContentAddressedAppendOnlyTree< Store, Poseidon2HashPolicy >
 
using LMDBStoreType = LMDBTreeStore
 

Functions

void check_size (TreeType &tree, index_t expected_size, bool includeUncommitted=true)
 
void check_finalized_block_height (TreeType &tree, block_number_t expected_finalized_block)
 
void check_block_height (TreeType &tree, index_t expected_block_height)
 
void check_root (TreeType &tree, fr expected_root, bool includeUncommitted=true)
 
void check_sibling_path (TreeType &tree, index_t index, fr_sibling_path expected_sibling_path, bool includeUncommitted=true, bool expected_result=true)
 
void check_sibling_path_by_value (TreeType &tree, fr value, fr_sibling_path expected_sibling_path, index_t expected_index, bool includeUncommitted=true, bool expected_result=true)
 
void check_historic_sibling_path (TreeType &tree, index_t index, fr_sibling_path expected_sibling_path, block_number_t blockNumber, bool expected_success=true)
 
void check_historic_sibling_path_by_value (TreeType &tree, fr value, fr_sibling_path expected_sibling_path, index_t expected_index, block_number_t blockNumber, bool expected_success=true)
 
void commit_tree (TreeType &tree, bool expected_success=true)
 
void remove_historic_block (TreeType &tree, const block_number_t &blockNumber, bool expected_success=true)
 
void unwind_block (TreeType &tree, const block_number_t &blockNumber, bool expected_success=true)
 
void add_value (TreeType &tree, const fr &value)
 
void add_values (TreeType &tree, const std::vector< fr > &values)
 
void finalize_block (TreeType &tree, const block_number_t &blockNumber, bool expected_success=true)
 
void check_leaf (TreeType &tree, const fr &leaf, index_t leaf_index, bool expected_success, bool includeUncommitted=true)
 
void check_historic_leaf (TreeType &tree, const block_number_t &blockNumber, const fr &leaf, index_t leaf_index, bool expected_success, bool includeUncommitted=true)
 
void check_sibling_path (fr expected_root, fr node, index_t index, fr_sibling_path sibling_path)
 
void get_blocks_for_indices (TreeType &tree, const std::vector< index_t > &indices, std::vector< std::optional< block_number_t > > &blockNumbers)
 
void get_blocks_for_indices (TreeType &tree, const block_number_t &blockNumber, const std::vector< index_t > &indices, std::vector< std::optional< block_number_t > > &blockNumbers)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_create)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, committing_with_no_changes_should_succeed)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_only_recreate_with_same_name_and_depth)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_add_value_and_get_sibling_path)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, reports_an_error_if_tree_is_overfilled)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, errors_are_caught_and_handled)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_commit_and_restore)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, test_size)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, test_find_leaf_index)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_add_multiple_values)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_add_multiple_values_in_a_batch)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_pad_with_zero_leaves)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_not_retrieve_zero_leaf_indices)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_commit_multiple_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_add_varying_size_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_retrieve_historic_sibling_paths)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, retrieves_historic_leaves)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, test_find_historic_leaf_index)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_be_filled)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_add_single_whilst_reading)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_get_inserted_leaves)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, returns_sibling_path)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_create_images_at_historic_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_remove_historic_block_data)
 
void test_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 (PersistedContentAddressedAppendOnlyTreeTest, can_unwind_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_unwind_all_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_unwind_initial_blocks_that_are_full_of_zeros)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_sync_and_unwind_large_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_commit_and_unwind_empty_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_commit_and_remove_historic_empty_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_retrieve_block_numbers_by_index)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_advance_finalized_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_finalize_multiple_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_not_finalize_block_beyond_pending_chain)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_not_fork_from_unwound_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_not_fork_from_expired_historical_blocks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_fork_from_block_zero_when_not_latest)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_not_unwind_finalized_block)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_not_historically_remove_finalized_block)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_checkpoint_and_revert_forks)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_commit_all_checkpoints)
 
 TEST_F (PersistedContentAddressedAppendOnlyTreeTest, can_revert_all_checkpoints)
 

Typedef Documentation

◆ LMDBStoreType

◆ Store

◆ TreeType

Function Documentation

◆ add_value()

void add_value ( TreeType tree,
const fr value 
)

Definition at line 218 of file content_addressed_append_only_tree.test.cpp.

◆ add_values()

void add_values ( TreeType tree,
const std::vector< fr > &  values 
)

Definition at line 230 of file content_addressed_append_only_tree.test.cpp.

◆ check_block_height()

void check_block_height ( TreeType tree,
index_t  expected_block_height 
)

Definition at line 83 of file content_addressed_append_only_tree.test.cpp.

◆ check_finalized_block_height()

void check_finalized_block_height ( TreeType tree,
block_number_t  expected_finalized_block 
)

Definition at line 71 of file content_addressed_append_only_tree.test.cpp.

◆ check_historic_leaf()

void check_historic_leaf ( TreeType tree,
const block_number_t blockNumber,
const fr leaf,
index_t  leaf_index,
bool  expected_success,
bool  includeUncommitted = true 
)

Definition at line 270 of file content_addressed_append_only_tree.test.cpp.

◆ check_historic_sibling_path()

void check_historic_sibling_path ( TreeType tree,
index_t  index,
fr_sibling_path  expected_sibling_path,
block_number_t  blockNumber,
bool  expected_success = true 
)

Definition at line 146 of file content_addressed_append_only_tree.test.cpp.

◆ check_historic_sibling_path_by_value()

void check_historic_sibling_path_by_value ( TreeType tree,
fr  value,
fr_sibling_path  expected_sibling_path,
index_t  expected_index,
block_number_t  blockNumber,
bool  expected_success = true 
)

Definition at line 164 of file content_addressed_append_only_tree.test.cpp.

◆ check_leaf()

void check_leaf ( TreeType tree,
const fr leaf,
index_t  leaf_index,
bool  expected_success,
bool  includeUncommitted = true 
)

Definition at line 256 of file content_addressed_append_only_tree.test.cpp.

◆ check_root()

void check_root ( TreeType tree,
fr  expected_root,
bool  includeUncommitted = true 
)

Definition at line 95 of file content_addressed_append_only_tree.test.cpp.

◆ check_sibling_path() [1/2]

void check_sibling_path ( fr  expected_root,
fr  node,
index_t  index,
fr_sibling_path  sibling_path 
)

Definition at line 288 of file content_addressed_append_only_tree.test.cpp.

◆ check_sibling_path() [2/2]

void check_sibling_path ( TreeType tree,
index_t  index,
fr_sibling_path  expected_sibling_path,
bool  includeUncommitted = true,
bool  expected_result = true 
)

Definition at line 107 of file content_addressed_append_only_tree.test.cpp.

◆ check_sibling_path_by_value()

void check_sibling_path_by_value ( TreeType tree,
fr  value,
fr_sibling_path  expected_sibling_path,
index_t  expected_index,
bool  includeUncommitted = true,
bool  expected_result = true 
)

Definition at line 125 of file content_addressed_append_only_tree.test.cpp.

◆ check_size()

void check_size ( TreeType tree,
index_t  expected_size,
bool  includeUncommitted = true 
)

Definition at line 59 of file content_addressed_append_only_tree.test.cpp.

◆ commit_tree()

void commit_tree ( TreeType tree,
bool  expected_success = true 
)

Definition at line 185 of file content_addressed_append_only_tree.test.cpp.

◆ finalize_block()

void finalize_block ( TreeType tree,
const block_number_t blockNumber,
bool  expected_success = true 
)

Definition at line 242 of file content_addressed_append_only_tree.test.cpp.

◆ get_blocks_for_indices() [1/2]

void get_blocks_for_indices ( TreeType tree,
const block_number_t blockNumber,
const std::vector< index_t > &  indices,
std::vector< std::optional< block_number_t > > &  blockNumbers 
)

Definition at line 321 of file content_addressed_append_only_tree.test.cpp.

◆ get_blocks_for_indices() [2/2]

void get_blocks_for_indices ( TreeType tree,
const std::vector< index_t > &  indices,
std::vector< std::optional< block_number_t > > &  blockNumbers 
)

Definition at line 309 of file content_addressed_append_only_tree.test.cpp.

◆ remove_historic_block()

void remove_historic_block ( TreeType tree,
const block_number_t blockNumber,
bool  expected_success = true 
)

Definition at line 196 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [1/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_add_multiple_values   
)

Definition at line 727 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [2/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_add_multiple_values_in_a_batch   
)

Definition at line 750 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [3/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_add_single_whilst_reading   
)

◆ TEST_F() [4/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_add_value_and_get_sibling_path   
)

Definition at line 400 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [5/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_add_varying_size_blocks   
)

Definition at line 863 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [6/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_advance_finalized_blocks   
)

◆ TEST_F() [7/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_be_filled   
)

◆ TEST_F() [8/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_checkpoint_and_revert_forks   
)

◆ TEST_F() [9/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_commit_all_checkpoints   
)

◆ TEST_F() [10/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_commit_and_remove_historic_empty_blocks   
)

◆ TEST_F() [11/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_commit_and_restore   
)

Definition at line 557 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [12/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_commit_and_unwind_empty_blocks   
)

◆ TEST_F() [13/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_commit_multiple_blocks   
)

Definition at line 826 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [14/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_create   
)

Definition at line 334 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [15/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_create_images_at_historic_blocks   
)

◆ TEST_F() [16/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_finalize_multiple_blocks   
)

◆ TEST_F() [17/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_fork_from_block_zero_when_not_latest   
)

◆ TEST_F() [18/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_get_inserted_leaves   
)

◆ TEST_F() [19/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_not_finalize_block_beyond_pending_chain   
)

◆ TEST_F() [20/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_not_fork_from_expired_historical_blocks   
)

◆ TEST_F() [21/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_not_fork_from_unwound_blocks   
)

◆ TEST_F() [22/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_not_historically_remove_finalized_block   
)

◆ TEST_F() [23/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_not_retrieve_zero_leaf_indices   
)

Definition at line 801 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [24/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_not_unwind_finalized_block   
)

◆ TEST_F() [25/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_only_recreate_with_same_name_and_depth   
)

Definition at line 389 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [26/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_pad_with_zero_leaves   
)

Definition at line 775 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [27/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_remove_historic_block_data   
)

◆ TEST_F() [28/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_retrieve_block_numbers_by_index   
)

◆ TEST_F() [29/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_retrieve_historic_sibling_paths   
)

Definition at line 901 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [30/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_revert_all_checkpoints   
)

◆ TEST_F() [31/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_sync_and_unwind_large_blocks   
)

◆ TEST_F() [32/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_unwind_all_blocks   
)

◆ TEST_F() [33/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_unwind_blocks   
)

◆ TEST_F() [34/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
can_unwind_initial_blocks_that_are_full_of_zeros   
)

◆ TEST_F() [35/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
committing_with_no_changes_should_succeed   
)

Definition at line 350 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [36/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
errors_are_caught_and_handled   
)

Definition at line 453 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [37/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
reports_an_error_if_tree_is_overfilled   
)

Definition at line 423 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [38/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
retrieves_historic_leaves   
)

Definition at line 952 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [39/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
returns_sibling_path   
)

◆ TEST_F() [40/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
test_find_historic_leaf_index   
)

Definition at line 986 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [41/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
test_find_leaf_index   
)

Definition at line 655 of file content_addressed_append_only_tree.test.cpp.

◆ TEST_F() [42/42]

TEST_F ( PersistedContentAddressedAppendOnlyTreeTest  ,
test_size   
)

Definition at line 627 of file content_addressed_append_only_tree.test.cpp.

◆ test_unwind()

void test_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 
)

◆ unwind_block()

void unwind_block ( TreeType tree,
const block_number_t blockNumber,
bool  expected_success = true 
)

Definition at line 207 of file content_addressed_append_only_tree.test.cpp.