Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: Remove recursive from ACIR format; add them to API and CLI #9479

Merged
merged 66 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
2fb2f83
Remove Circuit::recursive
aakoshh Oct 25, 2024
17f0be7
WIP
aakoshh Oct 25, 2024
fa8999a
Remove recursive property, add it to methods
aakoshh Oct 28, 2024
e5b232d
Add recursive to TS methods
aakoshh Oct 28, 2024
8ddc4ae
Update DSL tests
aakoshh Oct 28, 2024
4d659ba
Merge remote-tracking branch 'origin/master' into 6185-rm-recursive-attr
aakoshh Oct 28, 2024
e0f0fe7
Format C++
aakoshh Oct 28, 2024
dd7b3ad
Format TS
aakoshh Oct 28, 2024
1cde953
Remove FuncType::Recursive
aakoshh Oct 28, 2024
0615e44
Remove deprecation warning attempts
aakoshh Oct 28, 2024
588d452
Move #[recursive] attribute test programs to failure cases
aakoshh Oct 28, 2024
feb3f7c
Remove leftover field
aakoshh Oct 28, 2024
152755e
Update docs
aakoshh Oct 28, 2024
599f217
Merge remote-tracking branch 'origin/master' into 6185-rm-recursive-attr
aakoshh Oct 28, 2024
529a8a5
Remove #[recursive] from noir-protocol-circuits
aakoshh Oct 29, 2024
dc01d6b
Add recursive to bb-prover
aakoshh Oct 29, 2024
ca19dcb
Add recursive to prove_and_verify
aakoshh Oct 29, 2024
b57695c
Missing recursives in calls
aakoshh Oct 29, 2024
f9883ea
Mock methods
aakoshh Oct 29, 2024
55f5e17
Add recursive to avm integration test
aakoshh Oct 29, 2024
44f2127
Copy hardcoded circuits to acvm_js tests
aakoshh Oct 29, 2024
52ea971
Try proving the kernel without recursive
aakoshh Oct 29, 2024
6988e8c
Format TS
aakoshh Oct 29, 2024
2273a0a
Add --recursive to generate_recursive_proof.sh
aakoshh Oct 29, 2024
616b756
Try with recursive (probably not the right thing)
aakoshh Oct 29, 2024
9367a6a
Fix contract path
aakoshh Oct 29, 2024
c3c05f0
Only make the last circuit recursive in the batched command
aakoshh Oct 30, 2024
447213f
Use recursive in proveAndVerifyHonk*
aakoshh Oct 30, 2024
73f7c49
Merge remote-tracking branch 'origin/master' into 6185-rm-recursive-attr
aakoshh Oct 30, 2024
0976b3c
Smart contract verification probably wasn't recursive
aakoshh Oct 30, 2024
be8be86
TODO in kernel prover
aakoshh Oct 30, 2024
365daa8
Update references to assert_statement_recursive
aakoshh Oct 30, 2024
f4d781a
Remove --recursive from TS write-contract CLI
aakoshh Oct 30, 2024
85378d8
Update yarn-project/bb-prover/src/bb/cli.ts
TomAFrench Oct 30, 2024
8732d10
Remove add_attribute and set app circuit to recursive in the kernel p…
aakoshh Oct 30, 2024
934881d
.
TomAFrench Oct 30, 2024
f7b58fc
chore: make all ivc circuits recursive
TomAFrench Oct 30, 2024
76fcb2a
Do not pass recursive to folding
aakoshh Oct 31, 2024
4322e43
Fix *recursive in Wasm bindings
aakoshh Oct 31, 2024
16313d9
Remove debug from codegen
aakoshh Oct 31, 2024
970c181
PrivateKernel* circuits are recursive
aakoshh Oct 31, 2024
79ebb3b
Revert to forall
aakoshh Oct 31, 2024
ea6e7f4
Remove recursive from some TS methods
aakoshh Oct 31, 2024
18c4c92
Generate VK JSON with --recursive
aakoshh Nov 1, 2024
c5f699a
Debug VK keys in parity test
aakoshh Nov 1, 2024
9a776ac
Assert keys equal
aakoshh Nov 1, 2024
686fa1b
Try to trigger regen of keys by changing BB hash
aakoshh Nov 1, 2024
ad3b178
Add isRecursive to artifact hash
aakoshh Nov 1, 2024
edf1db7
Remove non-compiling recursive tests
aakoshh Nov 1, 2024
7289377
Restore recursive acir tests explicitly
aakoshh Nov 1, 2024
0ce266e
Merge remote-tracking branch 'origin/master' into 6185-rm-recursive-attr
aakoshh Nov 1, 2024
f06cb77
Fix Earthfile
aakoshh Nov 1, 2024
593f4a4
Add recursive tests to Earthfile
aakoshh Nov 1, 2024
8fd12c2
Update barretenberg/Earthfile
aakoshh Nov 1, 2024
a616174
Update barretenberg/Earthfile
aakoshh Nov 1, 2024
c47b126
Export RECURSIVE
aakoshh Nov 1, 2024
9c92263
Merge branch '6185-rm-recursive-attr' of github.com:AztecProtocol/azt…
aakoshh Nov 1, 2024
edf2889
.
TomAFrench Nov 1, 2024
7ff69e5
Format C++
aakoshh Nov 1, 2024
9d98ef0
Try interpolation
aakoshh Nov 1, 2024
e801fa5
Merge branch '6185-rm-recursive-attr' of github.com:AztecProtocol/azt…
aakoshh Nov 1, 2024
e4ceef1
Merge branch 'master' into 6185-rm-recursive-attr
aakoshh Nov 1, 2024
7c9a256
Format C++ >_<
aakoshh Nov 1, 2024
c989d52
Merge branch '6185-rm-recursive-attr' of github.com:AztecProtocol/azt…
aakoshh Nov 1, 2024
0e38181
Format C++ >_<
aakoshh Nov 1, 2024
db1442f
Merge branch 'master' into 6185-rm-recursive-attr
aakoshh Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion barretenberg/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
# Run every acir test through native bb build prove_then_verify flow for UltraPlonk.
# This ensures we test independent pk construction through real/garbage witness data paths.
RUN FLOW=prove_then_verify ./run_acir_tests.sh
RUN FLOW=prove_then_verify RECURSIVE=true ./run_acir_tests.sh assert_statement double_verify_proof

Check failure on line 53 in barretenberg/Earthfile

View workflow job for this annotation

GitHub Actions / bb-acir-tests-bb-ultra-plonk

Error

The command RUN FLOW=prove_then_verify RECURSIVE=true ./run_acir_tests.sh assert_statement double_verify_proof did not complete successfully. Exit code 1

barretenberg-acir-tests-bb-ultra-honk:
FROM ../build-images/+from-registry
Expand All @@ -67,6 +68,7 @@
# Run the acir test through native bb build prove_then_verify_ultra_honk flow
# Note that the script will skip the Plonk related tests
RUN FLOW=prove_then_verify_ultra_honk HONK=true ./run_acir_tests.sh
RUN FLOW=prove_then_verify_ultra_honk HONK=true RECURSIVE=true ./run_acir_tests.sh assert_statement double_verify_honk_proof

Check failure on line 71 in barretenberg/Earthfile

View workflow job for this annotation

GitHub Actions / bb-acir-tests-bb-ultra-honk

Error

The command RUN FLOW=prove_then_verify_ultra_honk HONK=true RECURSIVE=true ./run_acir_tests.sh assert_statement double_verify_honk_proof did not complete successfully. Exit code 1

# Construct and verify a UltraHonk proof for a single program
RUN FLOW=prove_and_verify_ultra_honk ./run_acir_tests.sh pedersen_hash
Expand Down Expand Up @@ -173,4 +175,4 @@
# Run fold_basic test through bb.js which runs ClientIVC on fold basic
RUN BIN=../ts/dest/node/main.js FLOW=fold_and_verify_program ./run_acir_tests.sh fold_basic
# Run 1_mul through bb.js build, all_cmds flow, to test all cli args.
RUN BIN=../ts/dest/node/main.js FLOW=all_cmds ./run_acir_tests.sh 1_mul
RUN BIN=../ts/dest/node/main.js FLOW=all_cmds ./run_acir_tests.sh 1_mul
5 changes: 2 additions & 3 deletions barretenberg/acir_tests/Dockerfile.bb.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ COPY . .
# This includes the basic `assert_statement` test that contains a single public input
# and the recursive aggregation circuits which use the Keccak based prover.
#
# NOTE: When circuits are marked `recursive` it means the backend will use a prover that
# produces SNARK recursion friendly proofs, while the solidity verifier expects proofs
# whose transcript uses Keccak hashing.
# NOTE: The solidity verifier expects proofs whose transcript uses Keccak hashing,
# for which we have to invoke the backend prover without the `--recursive` flag.
RUN (cd sol-test && yarn)
RUN PARALLEL=1 FLOW=sol ./run_acir_tests.sh assert_statement double_verify_proof double_verify_nested_proof
6 changes: 3 additions & 3 deletions barretenberg/acir_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ $ FLOW=all_cmds ./run_acir_tests.sh 1_mul

This means we have to generate the proof specific inputs using our backend and pass it back into `double_verify_proof` to regenerate the accurate witness. The following is a temporary solution to manually regenerate the inputs for `double_verify_proof` on a specific Noir branch.

First find `acir_tests/gen_inner_proof_inputs.sh`. Change the $BRANCH env var to your working branch and $PROOF_NAME to your first input you want to recursively verify. The script is going to generate the proof system specific verification key output and proof for the `assert_statement_recursive` test.
First find `acir_tests/gen_inner_proof_inputs.sh`. Change the $BRANCH env var to your working branch and $PROOF_NAME to your first input you want to recursively verify. The script is going to generate the proof system specific verification key output and proof for the `assert_statement` test.

To run:
```
./gen_inner_proof_inputs.sh
```
To generate a new input you can run the script again. To generate a new file under `assert_statement_recursive/proofs/` be sure to change the $PROOF_NAME inside of the script.
To generate a new input you can run the script again. To generate a new file under `assert_statement/proofs/` be sure to change the $PROOF_NAME inside of the script.

You can then copy these inputs over to your working branch in Noir and regenerate the witness for `double_verify_proof`. You can then change the branch in `run_acir_tests.sh` to this Noir working branch as well and `double_verify_proof` should pass.

The same process should then be repeated, but now `double_verify_proof_recursive` will be the circuit for which we will be generating recursive inputs using `gen_inner_proof_inputs.sh`. The recursive artifacts should then supplied as inputs to `double_verify_nested_proof`.
The same process should then be repeated, but now `double_verify_proof_recursive` will be the circuit for which we will be generating recursive inputs using `gen_inner_proof_inputs.sh`. The recursive artifacts should then supplied as inputs to `double_verify_nested_proof`.
6 changes: 5 additions & 1 deletion barretenberg/acir_tests/flows/prove_and_verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
set -eu

VFLAG=${VERBOSE:+-v}
FLAGS="-c $CRS_PATH $VFLAG"
if [ "${RECURSIVE:-false}" = "true" ]; then
FLAGS+=" --recursive"
fi

# This is the fastest flow, because it only generates pk/vk once, gate count once, etc.
# It may not catch all class of bugs.
$BIN prove_and_verify $VFLAG -c $CRS_PATH -b ./target/program.json
$BIN prove_and_verify $FLAGS -b ./target/program.json
6 changes: 5 additions & 1 deletion barretenberg/acir_tests/flows/prove_and_verify_ultra_honk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
set -eu

VFLAG=${VERBOSE:+-v}
FLAGS="-c $CRS_PATH $VFLAG"
if [ "${RECURSIVE:-false}" = "true" ]; then
FLAGS+=" --recursive"
fi

$BIN prove_and_verify_ultra_honk $VFLAG -c $CRS_PATH -b ./target/program.json
$BIN prove_and_verify_ultra_honk $FLAGS -b ./target/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
set -eu

VFLAG=${VERBOSE:+-v}
FLAGS="-c $CRS_PATH $VFLAG"
if [ "${RECURSIVE:-false}" = "true" ]; then
FLAGS+=" --recursive"
fi

$BIN prove_and_verify_ultra_honk_program $VFLAG -c $CRS_PATH -b ./target/program.json
$BIN prove_and_verify_ultra_honk_program $FLAGS -b ./target/program.json
3 changes: 3 additions & 0 deletions barretenberg/acir_tests/flows/prove_then_verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set -eu
VFLAG=${VERBOSE:+-v}
BFLAG="-b ./target/program.json"
FLAGS="-c $CRS_PATH $VFLAG"
if [ "${RECURSIVE:-false}" = "true" ]; then
FLAGS+=" --recursive"
fi

# Test we can perform the proof/verify flow.
# This ensures we test independent pk construction through real/garbage witness data paths.
Expand Down
3 changes: 3 additions & 0 deletions barretenberg/acir_tests/flows/prove_then_verify_ultra_honk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set -eux
VFLAG=${VERBOSE:+-v}
BFLAG="-b ./target/program.json"
FLAGS="-c $CRS_PATH $VFLAG"
if [ "${RECURSIVE:-false}" = "true" ]; then
FLAGS+=" --recursive"
fi

# Test we can perform the proof/verify flow.
# This ensures we test independent pk construction through real/garbage witness data paths.
Expand Down
6 changes: 3 additions & 3 deletions barretenberg/acir_tests/gen_inner_proof_inputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ export BRANCH

./clone_test_vectors.sh

cd acir_tests/assert_statement_recursive
cd acir_tests/assert_statement

PROOF_DIR=$PWD/proofs
PROOF_PATH=$PROOF_DIR/$PROOF_NAME
VFLAG=${VERBOSE:+-v}
RFLAG=${RECURSIVE:+-r}

echo "Write VK to file for assert_statement..."
$BIN write_vk $VFLAG -c $CRS_PATH -o ./target/vk
$BIN write_vk $VFLAG -c $CRS_PATH -o ./target/vk --recursive

echo "Write VK as fields for recursion..."
$BIN vk_as_fields $VFLAG -c $CRS_PATH -k ./target/vk -o ./target/vk_fields.json

echo "Generate proof to file..."
[ -d "$PROOF_DIR" ] || mkdir $PWD/proofs
[ -e "$PROOF_PATH" ] || touch $PROOF_PATH
$BIN prove $VFLAG -c $CRS_PATH -b ./target/program.json -o "./proofs/$PROOF_NAME"
$BIN prove $VFLAG -c $CRS_PATH -b ./target/program.json -o "./proofs/$PROOF_NAME" --recursive

echo "Write proof as fields for recursion..."
$BIN proof_as_fields $VFLAG -c $CRS_PATH -p "./proofs/$PROOF_NAME" -k ./target/vk -o "./proofs/${PROOF_NAME}_fields.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi
export BRANCH

# the program for which a proof will be recursively verified
PROGRAM=assert_statement_recursive
PROGRAM=assert_statement
# the program containing the recursive verifier
RECURSIVE_PROGRAM=verify_honk_proof

Expand Down
8 changes: 5 additions & 3 deletions barretenberg/acir_tests/run_acir_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Env var overrides:
# BIN: to specify a different binary to test with (e.g. bb.js or bb.js-dev).
# VERBOSE: to enable logging for each test.
# RECURSIVE: to enable --recursive for each test.
set -eu

# Catch when running in parallel
Expand All @@ -19,6 +20,7 @@ VERBOSE=${VERBOSE:-}
TEST_NAMES=("$@")
# We get little performance benefit over 16 cores (in fact it can be worse).
HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-16}
RECURSIVE=${RECURSIVE:-false}

FLOW_SCRIPT=$(realpath ./flows/${FLOW}.sh)

Expand All @@ -28,7 +30,7 @@ else
BIN=$(realpath $(which $BIN))
fi

export BIN CRS_PATH VERBOSE BRANCH
export BIN CRS_PATH VERBOSE BRANCH RECURSIVE

# copy the gzipped acir test data from noir/noir-repo/test_programs to barretenberg/acir_tests
./clone_test_vectors.sh
Expand All @@ -47,12 +49,12 @@ SKIP_ARRAY+=(regression_5045)
# if HONK is false, we should skip verify_honk_proof
if [ "$HONK" = false ]; then
# Don't run programs with Honk recursive verifier
SKIP_ARRAY+=(verify_honk_proof double_verify_honk_proof double_verify_honk_proof_recursive)
SKIP_ARRAY+=(verify_honk_proof double_verify_honk_proof)
fi

if [ "$HONK" = true ]; then
# Don't run programs with Plonk recursive verifier(s)
SKIP_ARRAY+=(single_verify_proof double_verify_proof double_verify_proof_recursive double_verify_nested_proof)
SKIP_ARRAY+=(single_verify_proof double_verify_proof double_verify_nested_proof)
fi

function test() {
Expand Down
Loading
Loading