diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index a7693fb6..832a811a 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -29,6 +29,16 @@ option(DISABLE_TBB "Intel Thread Building Blocks" ON) option(COVERAGE "Enable collecting coverage from tests" OFF) option(ENABLE_HEAVY_TESTS "Enable heavy tests when collecting coverage" OFF) +# NOTE: investigate issue: +# https://github.com/AztecProtocol/aztec3-circuits/issues/236 +option(USE_TURBO "Enable the use of TurboPlonk in barretenberg." OFF) +if(USE_TURBO) + message(STATUS "Building barretenberg for TurboPlonk Composer.") + add_definitions(-DUSE_TURBO) +else() + message(STATUS "Building barretenberg for UltraPlonk Composer.") +endif() + if(ENABLE_ASAN) add_compile_options(-fsanitize=address) add_link_options(-fsanitize=address) diff --git a/cpp/barretenberg b/cpp/barretenberg index c6b26c4e..6b4eaa9e 160000 --- a/cpp/barretenberg +++ b/cpp/barretenberg @@ -1 +1 @@ -Subproject commit c6b26c4edb350716257507bd7733eed95b58de16 +Subproject commit 6b4eaa9e5474de9af1e893b94e1b47c28a5e83ec diff --git a/cpp/src/aztec3/circuits/rollup/base/.test.cpp b/cpp/src/aztec3/circuits/rollup/base/.test.cpp index bc5d42e7..52eda382 100644 --- a/cpp/src/aztec3/circuits/rollup/base/.test.cpp +++ b/cpp/src/aztec3/circuits/rollup/base/.test.cpp @@ -1,8 +1,3 @@ -// #include -// #include -// #include -// #include -// #include #include "aztec3/circuits/abis/append_only_tree_snapshot.hpp" #include "aztec3/circuits/abis/membership_witness.hpp" #include "aztec3/circuits/abis/private_kernel/new_contract_data.hpp" @@ -36,12 +31,9 @@ #include #include #include -// #include -// #include #include -// #include #include #include @@ -469,12 +461,60 @@ TEST_F(base_rollup_tests, new_nullifier_tree_sparse) ASSERT_EQ(outputs.end_nullifier_tree_snapshot, nullifier_tree_end_snapshot); } +TEST_F(base_rollup_tests, nullifier_tree_regression) +{ + // Regression test caught when testing the typescript nullifier tree implementation + DummyComposer composer = DummyComposer(); + BaseRollupInputs empty_inputs = dummy_base_rollup_inputs_with_vk_proof(); + + // This test runs after some data has already been inserted into the tree + // This test will pre-populate the tree with 24 values (0 item + 23 more) simulating that a rollup inserting two + // random values has already succeeded. This rollup then adds two further random values that will end up having + // their low nullifiers point at each other + std::vector initial_values(23, 0); + for (size_t i = 0; i < 7; i++) { + initial_values[i] = i + 1; + } + // Note these are hex representations + initial_values[7] = uint256_t("2bb9aa4a22a6ae7204f2c67abaab59cead6558cde4ee25ce3464704cb2e38136"); + initial_values[8] = uint256_t("16a732095298ccca828c4d747813f8bd46e188079ed17904e2c9de50760833c8"); + + std::array new_nullifiers = { 0 }; + new_nullifiers[0] = uint256_t("16da4f27fb78de7e0db4c5a04b569bc46382c5f471da2f7d670beff1614e0118"), + new_nullifiers[1] = uint256_t("26ab07ce103a55e29f11478eaa36cebd10c4834b143a7debcc7ef53bfdb547dd"); + + std::tuple, AppendOnlyTreeSnapshot> inputs_and_snapshots = + utils::generate_nullifier_tree_testing_values(empty_inputs, new_nullifiers, initial_values); + BaseRollupInputs testing_inputs = std::get<0>(inputs_and_snapshots); + AppendOnlyTreeSnapshot nullifier_tree_start_snapshot = std::get<1>(inputs_and_snapshots); + AppendOnlyTreeSnapshot nullifier_tree_end_snapshot = std::get<2>(inputs_and_snapshots); + + /** + * RUN + */ + + // Run the circuit + BaseOrMergeRollupPublicInputs outputs = + aztec3::circuits::rollup::native_base_rollup::base_rollup_circuit(composer, testing_inputs); + + /** + * ASSERT + */ + // Start state + ASSERT_EQ(outputs.start_nullifier_tree_snapshot, nullifier_tree_start_snapshot); + + // End state + ASSERT_EQ(outputs.end_nullifier_tree_snapshot, nullifier_tree_end_snapshot); +} + +// Note leaving this test here as there are no negative tests, even though it no longer passes TEST_F(base_rollup_tests, new_nullifier_tree_sparse_attack) { // @todo THIS SHOULD NOT BE PASSING. The circuit should fail with an assert as we are trying to double-spend. /** * DESCRIPTION */ + DummyComposer composer = DummyComposer(); BaseRollupInputs empty_inputs = dummy_base_rollup_inputs_with_vk_proof(); @@ -486,9 +526,9 @@ TEST_F(base_rollup_tests, new_nullifier_tree_sparse_attack) // Run the circuit (SHOULD FAIL WITH AN ASSERT INSTEAD OF THIS!) BaseOrMergeRollupPublicInputs outputs = aztec3::circuits::rollup::native_base_rollup::base_rollup_circuit(composer, testing_inputs); -} -// TEST_F(base_rollup_tests, new_commitments_tree) {} + EXPECT_EQ(composer.has_failed(), true); +} TEST_F(base_rollup_tests, empty_block_calldata_hash) { diff --git a/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp b/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp index 9fac1b9b..47c1aa67 100644 --- a/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp +++ b/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp @@ -273,7 +273,7 @@ AppendOnlySnapshot check_nullifier_tree_non_membership_and_insert_to_tree(DummyC // 2. If we receive the 0 nullifier leaf (where all values are 0, we skip insertion and leave a sparse subtree) // New nullifier subtree - std::array nullifier_leaves; + std::array nullifier_insertion_subtree; // This will update on each iteration auto current_nullifier_tree_root = baseRollupInputs.start_nullifier_tree_snapshot.root; @@ -291,6 +291,7 @@ AppendOnlySnapshot check_nullifier_tree_non_membership_and_insert_to_tree(DummyC // Witness containing index and path auto nullifier_index = 4 * i + j; + auto witness = baseRollupInputs.low_nullifier_membership_witness[nullifier_index]; // Preimage of the lo-index required for a non-membership proof auto low_nullifier_preimage = baseRollupInputs.low_nullifier_leaf_preimages[nullifier_index]; @@ -313,13 +314,19 @@ AppendOnlySnapshot check_nullifier_tree_non_membership_and_insert_to_tree(DummyC // TODO: this is a hack, and insecure, we need to fix this bool matched = false; for (size_t k = 0; k < nullifier_index; k++) { - if ((uint256_t(nullifier_leaves[k].nextValue) > uint256_t(nullifier) && - uint256_t(nullifier_leaves[k].value) < uint256_t(nullifier)) || - (nullifier_leaves[k].nextValue == 0 && nullifier_leaves[k].nextIndex == 0)) { + if ((uint256_t(nullifier_insertion_subtree[k].nextValue) > uint256_t(nullifier) && + uint256_t(nullifier_insertion_subtree[k].value) < uint256_t(nullifier)) || + (nullifier_insertion_subtree[k].nextValue == 0 && + nullifier_insertion_subtree[k].nextIndex == 0)) { matched = true; - nullifier_leaves[k].nextIndex = new_index; - nullifier_leaves[k].nextValue = nullifier; + // Update pointers + new_nullifier_leaf.nextIndex = nullifier_insertion_subtree[k].nextIndex; + new_nullifier_leaf.nextValue = nullifier_insertion_subtree[k].nextValue; + + // Update child + nullifier_insertion_subtree[k].nextIndex = new_index; + nullifier_insertion_subtree[k].nextValue = nullifier; } } // if not matched, our subtree will misformed - we must reject @@ -359,7 +366,7 @@ AppendOnlySnapshot check_nullifier_tree_non_membership_and_insert_to_tree(DummyC updated_low_nullifier.hash(), witness.leaf_index, witness.sibling_path); } - nullifier_leaves[nullifier_index] = new_nullifier_leaf; + nullifier_insertion_subtree[nullifier_index] = new_nullifier_leaf; } else { // 0 case NullifierLeaf new_nullifier_leaf = { @@ -367,7 +374,7 @@ AppendOnlySnapshot check_nullifier_tree_non_membership_and_insert_to_tree(DummyC .nextIndex = 0, .nextValue = 0, }; - nullifier_leaves[nullifier_index] = new_nullifier_leaf; + nullifier_insertion_subtree[nullifier_index] = new_nullifier_leaf; } // increment insertion index @@ -377,7 +384,7 @@ AppendOnlySnapshot check_nullifier_tree_non_membership_and_insert_to_tree(DummyC // Create new nullifier subtree to insert into the whole nullifier tree auto nullifier_sibling_path = baseRollupInputs.new_nullifiers_subtree_sibling_path; - auto nullifier_subtree_root = create_nullifier_subtree(nullifier_leaves); + auto nullifier_subtree_root = create_nullifier_subtree(nullifier_insertion_subtree); // Calculate the new root // We are inserting a subtree rather than a full tree here diff --git a/cpp/src/aztec3/circuits/rollup/base/nullifier_tree_testing_harness.cpp b/cpp/src/aztec3/circuits/rollup/base/nullifier_tree_testing_harness.cpp index 14c1d001..3c44dd7f 100644 --- a/cpp/src/aztec3/circuits/rollup/base/nullifier_tree_testing_harness.cpp +++ b/cpp/src/aztec3/circuits/rollup/base/nullifier_tree_testing_harness.cpp @@ -1,6 +1,7 @@ #include "nullifier_tree_testing_harness.hpp" #include #include +#include #include using NullifierMemoryTree = proof_system::plonk::stdlib::merkle_tree::NullifierMemoryTree; @@ -10,13 +11,74 @@ NullifierMemoryTreeTestingHarness::NullifierMemoryTreeTestingHarness(size_t dept : NullifierMemoryTree(depth) {} +// Check for a larger value in an array +bool check_has_lesser_value(std::vector const& values, fr const& value) +{ + // Must perform comparisons on integers + uint256_t value_as_uint = uint256_t(value); + for (auto const& v : values) { + if (uint256_t(v) < value_as_uint) { + return true; + } + } + return false; +} + +// TODO: test +fr NullifierMemoryTreeTestingHarness::append_value(fr const& value) +{ + // If the value is 0, then we force insert the value to increase the size of the tree + // TODO: this is a hack + if (value == 0) { + nullifier_leaf new_leaf = { .value = 0, .nextIndex = 0, .nextValue = 0 }; + auto new_leaf_hash = new_leaf.hash(); + leaves_.push_back(new_leaf); + size_t new_leaf_index = leaves_.size() - 1; + auto root = update_element(new_leaf_index, new_leaf_hash); + return root; + } + + // Find the leaf with the value closest and less than `value` + size_t current; + bool is_already_present; + std::tie(current, is_already_present) = find_closest_leaf(leaves_, value); + + nullifier_leaf new_leaf = { .value = value, + .nextIndex = leaves_[current].nextIndex, + .nextValue = leaves_[current].nextValue }; + if (!is_already_present) { + // Update the current leaf to point it to the new leaf + leaves_[current].nextIndex = leaves_.size(); + leaves_[current].nextValue = value; + + // Insert the new leaf with (nextIndex, nextValue) of the current leaf + leaves_.push_back(new_leaf); + } + + // Update the old leaf in the tree + auto old_leaf_hash = leaves_[current].hash(); + size_t old_leaf_index = current; + auto root = update_element(old_leaf_index, old_leaf_hash); + + // Insert the new leaf in the tree + auto new_leaf_hash = new_leaf.hash(); + + size_t new_leaf_index = is_already_present ? old_leaf_index : leaves_.size() - 1; + root = update_element(new_leaf_index, new_leaf_hash); + + return root; +} + // handle synthetic membership assertions std::tuple, std::vector>, std::vector> -NullifierMemoryTreeTestingHarness::circuit_prep_batch_insert(std::vector const& values, - std::vector const& insertion_locations) +NullifierMemoryTreeTestingHarness::circuit_prep_batch_insert(std::vector const& values) { + // Start insertion index + fr start_insertion_index = this->size(); + // Low nullifiers std::vector low_nullifiers; + std::vector pending_insertion_tree; // Low nullifier sibling paths std::vector> sibling_paths; @@ -25,31 +87,76 @@ NullifierMemoryTreeTestingHarness::circuit_prep_batch_insert(std::vector con std::vector low_nullifier_indexes; // Keep track of the currently touched nodes while updating - std::set touched_nodes; + std::map> touched_nodes; + + // Keep track of 0 values + std::vector empty_sp(depth_, 0); + nullifier_leaf empty_leaf = { 0, 0, 0 }; + uint32_t empty_index = 0; // Find the leaf with the value closest and less than `value` for each value for (size_t i = 0; i < values.size(); ++i) { - auto value = values[i]; - auto insertion_index = uint256_t(insertion_locations[i]); + auto new_value = values[i]; + auto insertion_index = start_insertion_index + i; size_t current; bool is_already_present; + std::tie(current, is_already_present) = find_closest_leaf(leaves_, new_value); - std::tie(current, is_already_present) = find_closest_leaf(leaves_, value); + // If the inserted value is 0, then we ignore and provide a dummy low nullifier + if (new_value == 0) { + sibling_paths.push_back(empty_sp); + low_nullifier_indexes.push_back(empty_index); + low_nullifiers.push_back(empty_leaf); + } // If the low_nullifier node has been touched this sub tree insertion, we provide a dummy sibling path // It will be up to the circuit to check if the included node is valid vs the other nodes that have been // inserted before it If it has not been touched, we provide a sibling path then update the nodes pointers - if (touched_nodes.contains(current)) { - std::vector sp(depth_, 0); - auto empty_leaf = nullifier_leaf{ 0, 0, 0 }; + auto prev_nodes = touched_nodes.find(current); + + bool has_lesser_value = false; + if (prev_nodes != touched_nodes.end()) { + has_lesser_value = check_has_lesser_value(prev_nodes->second, new_value); + } + // If there is a lower value in the tree, we need to check the current low nullifiers for one that can be used + // if (current == 0 || has_lesser_value) { + if (has_lesser_value) { + + for (size_t j = 0; j < pending_insertion_tree.size(); ++j) { + // Skip checking empty values + if (pending_insertion_tree[j].value == 0) { + continue; + } + + if (pending_insertion_tree[j].value < new_value && + (pending_insertion_tree[j].nextValue > new_value || pending_insertion_tree[j].nextValue == 0)) { + // Add a new pending low nullifier for this value + nullifier_leaf new_leaf = { .value = new_value, + .nextIndex = pending_insertion_tree[j].nextIndex, + .nextValue = pending_insertion_tree[j].nextValue }; + pending_insertion_tree.push_back(new_leaf); + + // Update the pending low nullifier to point at the new value + pending_insertion_tree[j].nextIndex = insertion_index; + pending_insertion_tree[j].nextValue = new_value; + + break; + } + } // empty low nullifier - sibling_paths.push_back(sp); - low_nullifier_indexes.push_back(0); + sibling_paths.push_back(empty_sp); + low_nullifier_indexes.push_back(empty_index); low_nullifiers.push_back(empty_leaf); } else { - touched_nodes.insert(current); + // Update the touched mapping + if (prev_nodes == touched_nodes.end()) { + std::vector new_touched_values = { new_value }; + touched_nodes[current] = new_touched_values; + } else { + prev_nodes->second.push_back(new_value); + } nullifier_leaf low_nullifier = leaves_[current]; std::vector sibling_path = this->get_sibling_path(current); @@ -61,7 +168,7 @@ NullifierMemoryTreeTestingHarness::circuit_prep_batch_insert(std::vector con // Update the current low nullifier nullifier_leaf new_leaf = { .value = low_nullifier.value, .nextIndex = insertion_index, - .nextValue = value }; + .nextValue = new_value }; // Update the old leaf in the tree update_element(current, new_leaf.hash()); diff --git a/cpp/src/aztec3/circuits/rollup/base/nullifier_tree_testing_harness.hpp b/cpp/src/aztec3/circuits/rollup/base/nullifier_tree_testing_harness.hpp index f199730b..4a8a8411 100644 --- a/cpp/src/aztec3/circuits/rollup/base/nullifier_tree_testing_harness.hpp +++ b/cpp/src/aztec3/circuits/rollup/base/nullifier_tree_testing_harness.hpp @@ -28,13 +28,19 @@ class NullifierMemoryTreeTestingHarness : public proof_system::plonk::stdlib::me // Get the value immediately lower than the given value std::pair find_lower(fr const& value); + // Append a value to the tree, even zeros + fr append_value(fr const& value); + // Utilities to inspect tree - fr size() const { return total_size_; } + fr total_size() const { return total_size_; } fr depth() const { return depth_; } + // Current size of the tree + fr size() { return leaves_.size(); } + // Get all of the sibling paths and low nullifier values required to craft an non membership / inclusion proofs std::tuple, std::vector>, std::vector> - circuit_prep_batch_insert(std::vector const& values, std::vector const& insertion_locations); + circuit_prep_batch_insert(std::vector const& values); protected: using MemoryTree::depth_; diff --git a/cpp/src/aztec3/circuits/rollup/base/utils.cpp b/cpp/src/aztec3/circuits/rollup/base/utils.cpp index 228953f1..b97b6e22 100644 --- a/cpp/src/aztec3/circuits/rollup/base/utils.cpp +++ b/cpp/src/aztec3/circuits/rollup/base/utils.cpp @@ -89,17 +89,35 @@ BaseRollupInputs dummy_base_rollup_inputs_with_vk_proof() return baseRollupInputs; } -NullifierMemoryTreeTestingHarness get_initial_nullifier_tree(size_t spacing = 5) +/** + * @brief Get initial nullifier tree object + * + * @param initial_values values to pre-populate the tree + * @return NullifierMemoryTreeTestingHarness + */ +NullifierMemoryTreeTestingHarness get_initial_nullifier_tree(std::vector initial_values) { - // Create a nullifier tree with 8 nullifiers, this padding is required so that the default 0 value in an indexed - // merkle tree does not affect our tests Nullifier tree at the start NullifierMemoryTreeTestingHarness nullifier_tree = NullifierMemoryTreeTestingHarness(NULLIFIER_TREE_HEIGHT); - // Start from 1 as 0 is always inserted + for (size_t i = 0; i < initial_values.size(); ++i) { + nullifier_tree.append_value(initial_values[i]); + } + return nullifier_tree; +} + +/** + * @brief An extension of `get_initial_nullifier_tree` that will populate with linearly spaced values + * + * @param spacing + * @return NullifierMemoryTreeTestingHarness + */ +NullifierMemoryTreeTestingHarness get_initial_nullifier_tree_lin_space(size_t spacing = 5, size_t start = 0) +{ + std::vector nullifiers; for (size_t i = 1; i < 8; ++i) { // insert 5, 10, 15, 20 ... - nullifier_tree.update_element(i * spacing); + nullifiers.push_back(start + (i * spacing)); } - return nullifier_tree; + return get_initial_nullifier_tree(nullifiers); } std::tuple, AppendOnlyTreeSnapshot, AppendOnlyTreeSnapshot> @@ -113,22 +131,43 @@ generate_nullifier_tree_testing_values(BaseRollupInputs inputs, auto insertion_val = (starting_insertion_value + i * spacing); nullifiers[i] = fr(insertion_val); } - return generate_nullifier_tree_testing_values(inputs, nullifiers, spacing); + + // Generate initial values lin spaved + std::vector initial_values; + for (size_t i = 1; i < 8; ++i) { + initial_values.push_back(i * spacing); + } + + return generate_nullifier_tree_testing_values(inputs, nullifiers, initial_values); +} + +std::tuple, AppendOnlyTreeSnapshot, AppendOnlyTreeSnapshot> +generate_nullifier_tree_testing_values(BaseRollupInputs inputs, + std::array new_nullifiers, + size_t spacing = 5) +{ + // Generate initial values lin spaced + std::vector initial_values; + for (size_t i = 1; i < 8; ++i) { + initial_values.push_back(i * spacing); + } + + return generate_nullifier_tree_testing_values(inputs, new_nullifiers, initial_values); } std::tuple, AppendOnlyTreeSnapshot, AppendOnlyTreeSnapshot> generate_nullifier_tree_testing_values(BaseRollupInputs rollupInputs, std::array new_nullifiers, - size_t spacing_prefill = 1) + std::vector initial_values) { + size_t start_tree_size = initial_values.size() + 1; // Generate nullifier tree testing values - - NullifierMemoryTreeTestingHarness nullifier_tree = get_initial_nullifier_tree(spacing_prefill); - NullifierMemoryTreeTestingHarness parallel_insertion_tree = get_initial_nullifier_tree(spacing_prefill); + NullifierMemoryTreeTestingHarness nullifier_tree = get_initial_nullifier_tree(initial_values); + NullifierMemoryTreeTestingHarness reference_tree = get_initial_nullifier_tree(initial_values); AppendOnlyTreeSnapshot nullifier_tree_start_snapshot = { .root = nullifier_tree.root(), - .next_available_leaf_index = uint32_t(8), + .next_available_leaf_index = uint32_t(start_tree_size), }; const size_t NUMBER_OF_NULLIFIERS = KERNEL_NEW_NULLIFIERS_LENGTH * 2; @@ -140,7 +179,6 @@ generate_nullifier_tree_testing_values(BaseRollupInputs rollupInputs, // Calculate the predecessor nullifier pre-images // Get insertion values std::vector insertion_values; - std::vector insertion_locations; std::array new_nullifiers_kernel_1; std::array new_nullifiers_kernel_2; @@ -151,13 +189,13 @@ generate_nullifier_tree_testing_values(BaseRollupInputs rollupInputs, } else { new_nullifiers_kernel_2[i - KERNEL_NEW_NULLIFIERS_LENGTH] = insertion_val; } - insertion_locations.push_back(NUMBER_OF_NULLIFIERS + i); insertion_values.push_back(insertion_val); - parallel_insertion_tree.update_element(insertion_val); + reference_tree.append_value(insertion_val); + auto hashes = reference_tree.get_hashes(); } // Get the hash paths etc from the insertion values - auto witnesses_and_preimages = nullifier_tree.circuit_prep_batch_insert(insertion_values, insertion_locations); + auto witnesses_and_preimages = nullifier_tree.circuit_prep_batch_insert(insertion_values); auto new_nullifier_leaves_preimages = std::get<0>(witnesses_and_preimages); auto new_nullifier_leaves_sibling_paths = std::get<1>(witnesses_and_preimages); @@ -188,17 +226,16 @@ generate_nullifier_tree_testing_values(BaseRollupInputs rollupInputs, } // Get expected root with subtrees inserted correctly - fr end_root = parallel_insertion_tree.root(); - // Expected end state AppendOnlyTreeSnapshot nullifier_tree_end_snapshot = { - .root = end_root, - .next_available_leaf_index = 16, + .root = reference_tree.root(), + .next_available_leaf_index = uint32_t(reference_tree.size()), }; // Get the sibling path, we should be able to use the same path to get to the end root - std::vector sibling_path = parallel_insertion_tree.get_sibling_path(8); + std::vector sibling_path = reference_tree.get_sibling_path(start_tree_size); std::array sibling_path_array; + // Chop the first 3 levels from the sibling_path sibling_path.erase(sibling_path.begin(), sibling_path.begin() + NULLIFIER_SUBTREE_DEPTH); std::copy(sibling_path.begin(), sibling_path.end(), sibling_path_array.begin()); diff --git a/cpp/src/aztec3/circuits/rollup/base/utils.hpp b/cpp/src/aztec3/circuits/rollup/base/utils.hpp index 86ebc0ba..fae81e6d 100644 --- a/cpp/src/aztec3/circuits/rollup/base/utils.hpp +++ b/cpp/src/aztec3/circuits/rollup/base/utils.hpp @@ -8,6 +8,8 @@ namespace aztec3::circuits::rollup::base::utils { namespace { using NT = aztec3::utils::types::NativeTypes; using aztec3::circuits::abis::BaseRollupInputs; +using nullifier_tree_testing_values = + std::tuple, abis::AppendOnlyTreeSnapshot, abis::AppendOnlyTreeSnapshot>; } // namespace BaseRollupInputs dummy_base_rollup_inputs_with_vk_proof(); @@ -15,12 +17,16 @@ BaseRollupInputs dummy_base_rollup_inputs_with_vk_proof(); NullifierMemoryTreeTestingHarness get_initial_nullifier_tree(size_t spacing); abis::AppendOnlyTreeSnapshot get_snapshot_of_tree_state(NullifierMemoryTreeTestingHarness nullifier_tree); -std::tuple, abis::AppendOnlyTreeSnapshot, abis::AppendOnlyTreeSnapshot> -generate_nullifier_tree_testing_values(BaseRollupInputs inputs, size_t starting_insertion_value, size_t spacing); +nullifier_tree_testing_values generate_nullifier_tree_testing_values(BaseRollupInputs inputs, + size_t starting_insertion_value, + size_t spacing); -std::tuple, abis::AppendOnlyTreeSnapshot, abis::AppendOnlyTreeSnapshot> -generate_nullifier_tree_testing_values(BaseRollupInputs inputs, - std::array new_nullifiers, - size_t spacing_prefill); +nullifier_tree_testing_values generate_nullifier_tree_testing_values( + BaseRollupInputs inputs, + std::array new_nullifiers, + std::vector initial_values); + +nullifier_tree_testing_values generate_nullifier_tree_testing_values( + BaseRollupInputs inputs, std::array new_nullifiers, size_t spacing); } // namespace aztec3::circuits::rollup::base::utils \ No newline at end of file diff --git a/cpp/src/aztec3/circuits/rollup/root/.test.cpp b/cpp/src/aztec3/circuits/rollup/root/.test.cpp index 03712594..6600ebef 100644 --- a/cpp/src/aztec3/circuits/rollup/root/.test.cpp +++ b/cpp/src/aztec3/circuits/rollup/root/.test.cpp @@ -1,8 +1,3 @@ -// #include -// #include -// #include -// #include -// #include #include "aztec3/circuits/abis/append_only_tree_snapshot.hpp" #include "aztec3/circuits/abis/membership_witness.hpp" #include "aztec3/circuits/abis/private_kernel/new_contract_data.hpp" @@ -39,12 +34,9 @@ #include #include #include -// #include -// #include #include -// #include #include #include @@ -55,10 +47,6 @@ #include #include -// #include -// #include -// #include - namespace { using aztec3::circuits::abis::CallContext;