Skip to content

Commit c11a5f5

Browse files
author
dbanks12
committed
merge
2 parents c32d97c + 1516d7f commit c11a5f5

64 files changed

Lines changed: 1070 additions & 394 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

barretenberg/acir_tests/regenerate_verify_honk_proof_inputs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ PROGRAM=assert_statement
2121
# the program containing the recursive verifier
2222
RECURSIVE_PROGRAM=verify_honk_proof
2323

24-
./reset_acir_tests.sh --rebuild-nargo --programs "$PROGRAM"
24+
./reset_acir_tests.sh --programs "$PROGRAM"
2525
cd "acir_tests/$PROGRAM"
2626

2727
TOML_DIR=../../../../noir/noir-repo/test_programs/execution_success/"$RECURSIVE_PROGRAM"

barretenberg/acir_tests/reset_acir_tests.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ set -e
44
# Run from within barretenberg/acir_tests
55

66
# Initialize variables for flags
7-
REBUILD_NARGO_FLAG=""
7+
REBUILD_NARGO_FLAG=true
88
PROGRAMS=""
99

1010
# Parse the arguments
1111
while [[ "$#" -gt 0 ]]; do
1212
case $1 in
13-
--rebuild-nargo)
14-
REBUILD_NARGO_FLAG="--rebuild-nargo"
13+
--no-rebuild-nargo)
14+
REBUILD_NARGO_FLAG=false
1515
;;
1616
--programs)
1717
shift
@@ -26,12 +26,13 @@ while [[ "$#" -gt 0 ]]; do
2626
shift
2727
done
2828

29-
# Clean and rebuild noir, then compile the test programs if --rebuild-nargo flag is set
30-
cd ../../noir/noir-repo
31-
32-
if [[ -n "$REBUILD_NARGO_FLAG" ]]; then
29+
cd ../../noir/noir-repo
30+
# Clean and rebuild noir unless --no-rebuild-nargo is specified, then compile the test programs
31+
if [[ "$REBUILD_NARGO_FLAG" == true ]]; then
3332
cargo clean
3433
noirup -p .
34+
else
35+
echo "Skipping noir nargo build."
3536
fi
3637

3738
# Rebuild test programs with rebuild.sh

barretenberg/cpp/src/barretenberg/plonk_honk_shared/composer/permutation_lib.hpp

Lines changed: 122 additions & 84 deletions
Large diffs are not rendered by default.

barretenberg/cpp/src/barretenberg/vm/avm/tests/execution.test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class AvmExecutionTests : public ::testing::Test {
5454
public_inputs.gas_settings.gas_limits.da_gas = DEFAULT_INITIAL_DA_GAS;
5555
public_inputs.start_gas_used.l2_gas = 0;
5656
public_inputs.start_gas_used.da_gas = 0;
57+
public_inputs.end_tree_snapshots.note_hash_tree.size =
58+
public_inputs.start_tree_snapshots.note_hash_tree.size + MAX_NOTE_HASHES_PER_TX;
59+
public_inputs.end_tree_snapshots.nullifier_tree.size =
60+
public_inputs.start_tree_snapshots.nullifier_tree.size + MAX_NULLIFIERS_PER_TX;
5761

5862
// These values are magic because of how some tests work! Don't change them
5963
PublicCallRequest dummy_request = {

barretenberg/cpp/src/barretenberg/vm/avm/trace/execution.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ std::vector<Row> Execution::gen_trace(AvmPublicInputs const& public_inputs,
399399
trace_builder.pay_fee();
400400
}
401401

402+
trace_builder.pad_trees();
403+
402404
auto trace = trace_builder.finalize(apply_e2e_assertions);
403405

404406
returndata = trace_builder.get_all_returndata();

barretenberg/cpp/src/barretenberg/vm/avm/trace/gadgets/merkle_tree.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class AvmMerkleTreeTraceBuilder {
6969
const std::vector<FF>& low_path,
7070
const FF& nullifier,
7171
const std::vector<FF>& insertion_path);
72+
void set_nullifier_tree_size(uint32_t size) { tree_snapshots.nullifier_tree.size = size; }
7273

7374
// Note Hash Tree
7475
bool perform_note_hash_read(uint32_t clk,
@@ -77,6 +78,7 @@ class AvmMerkleTreeTraceBuilder {
7778
const std::vector<FF>& path) const;
7879

7980
FF perform_note_hash_append(uint32_t clk, const FF& note_hash, const std::vector<FF>& insertion_path);
81+
void set_note_hash_tree_size(uint32_t size) { tree_snapshots.note_hash_tree.size = size; }
8082

8183
// L1 to L2 Message Tree
8284
bool perform_l1_to_l2_message_read(uint32_t clk,

barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,23 @@ void AvmTraceBuilder::pay_fee()
312312
side_effect_counter++;
313313
}
314314

315+
void AvmTraceBuilder::pad_trees()
316+
{
317+
auto current_tree_snapshots = merkle_tree_trace_builder.get_tree_snapshots();
318+
319+
auto initial_note_hash_snapshot = public_inputs.start_tree_snapshots.note_hash_tree;
320+
// sanity check
321+
uint32_t padded_note_hash_size = initial_note_hash_snapshot.size + MAX_NOTE_HASHES_PER_TX;
322+
ASSERT(current_tree_snapshots.note_hash_tree.size <= padded_note_hash_size);
323+
merkle_tree_trace_builder.set_note_hash_tree_size(padded_note_hash_size);
324+
325+
auto initial_nullifier_snapshot = public_inputs.start_tree_snapshots.nullifier_tree;
326+
// sanity check
327+
uint32_t padded_nullifier_size = initial_nullifier_snapshot.size + MAX_NULLIFIERS_PER_TX;
328+
ASSERT(current_tree_snapshots.nullifier_tree.size <= padded_nullifier_size);
329+
merkle_tree_trace_builder.set_nullifier_tree_size(padded_nullifier_size);
330+
}
331+
315332
void AvmTraceBuilder::allocate_gas_for_call(uint32_t l2_gas, uint32_t da_gas)
316333
{
317334
gas_trace_builder.allocate_gas_for_call(l2_gas, da_gas);

barretenberg/cpp/src/barretenberg/vm/avm/trace/trace.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ class AvmTraceBuilder {
238238
void insert_private_revertible_state(const std::vector<FF>& siloed_nullifiers,
239239
const std::vector<FF>& siloed_note_hashes);
240240
void pay_fee();
241+
void pad_trees();
241242
void allocate_gas_for_call(uint32_t l2_gas, uint32_t da_gas);
242243
void handle_exceptional_halt();
243244

noir-projects/noir-contracts/contracts/counter_contract/src/main.nr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ contract Counter {
224224
assert(notes.len() == 4);
225225
assert(get_counter(owner) == 7);
226226

227-
// Checking from the note cache, note that we MUST advance the block to get a correct and updated value.
227+
// Checking from the note cache
228228
Counter::at(contract_address).decrement(owner, sender).call(&mut env.private());
229229
let notes: BoundedVec<ValueNote, MAX_NOTES_PER_PAGE> = view_notes(owner_slot, options);
230-
assert(get_counter(owner) == 11);
231-
assert(notes.len() == 5);
230+
assert(get_counter(owner) == 6);
231+
assert(notes.len() == 4);
232232

233-
// We advance the block here to have the nullification of the prior note be applied. Should we try nullifiying notes in our DB on notifyNullifiedNote ?
233+
// Checking that the note was discovered from private logs
234234
env.advance_block_by(1);
235235
let notes: BoundedVec<ValueNote, MAX_NOTES_PER_PAGE> = view_notes(owner_slot, options);
236236
assert(get_counter(owner) == 6);

noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
mod test;
12
use dep::aztec::macros::aztec;
23

34
#[aztec]

0 commit comments

Comments
 (0)