-
Notifications
You must be signed in to change notification settings - Fork 325
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
feat: Barretenberg C++ binary overhaul #11459
Changes from all commits
90e1879
ac0e31e
c09eb0e
7148768
392b286
b02ea01
085a795
5c71b37
bea60f3
ccf8ffc
d187e30
ea8239c
68d499b
a305e48
0db44f8
1086fdd
09a512d
a951e7c
d60e063
fd3a6c9
ab19bd0
0b4f53e
8b89a12
889f99c
dfff8e9
6a568d3
c837d5c
0706407
1e95e1e
1513ec5
37bb3fb
892e904
09ed889
714912d
0e46aed
cfcf8b4
f7914be
4e1428b
04a914d
8158a7d
913cbcd
dd94fb6
9de3660
ecfadb7
598c4dd
ede02fb
90cc060
18333ba
c84b0ef
e25c6bc
bc3fb5f
01d1c84
c616c0e
aa07579
1471ad4
7e2f3a5
55bf456
379684a
c319166
7ac9040
db79cda
e969792
c926333
a70d0cb
259f465
84f0b4e
84eb7f2
ff6580b
a5cdc6f
636b3dc
aef3594
c88cadc
ae11d3d
cfe64c4
cd4c856
a6833c3
eba12df
133a8f1
10f61f2
9e7ee19
4f58dee
4c6d009
d97b83e
cc140ad
2d0a1a1
20a27a8
b6b9a67
030a78e
087136c
2e78abc
42b9478
c59dd1d
88c7625
d128345
c1364a1
1742c90
b94637d
dbc5233
9747a3f
91ace47
3444743
fba5aea
42e5742
03ba884
7110aa8
d345b7f
3fd7945
5a08e75
d0e2136
5bca709
fa0d0dd
4094611
e7d714a
2de28a7
6b85f9f
a3943d3
697a0da
a05d020
24d2626
596bb41
32fdefc
49ba707
6719ee6
3e24a0e
d07eac4
8256188
105dcef
fff2e15
f2378ea
f8b4735
656d4f0
d744390
e0fa8b0
6e09d68
6dd1a05
6da4134
aef5f17
d7df1e8
240594a
b70d229
0db4d59
34b85d3
8e62a30
c6920b4
e310def
9f7e5bb
99d6ac1
4289384
65a6696
52520e4
a7504df
5c49ada
909c1bf
f6f21c7
490f4dd
d1e19ea
bbb8543
1bbf807
8f5ed5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,8 +36,9 @@ function build { | |
echo "Regenerating verify_honk_proof and verify_rollup_honk_proof recursive inputs." | ||
local bb=$(realpath ../cpp/build/bin/bb) | ||
(cd ./acir_tests/assert_statement && \ | ||
$bb write_recursion_inputs_ultra_honk -b ./target/program.json -o ../verify_honk_proof --recursive && \ | ||
$bb write_recursion_inputs_rollup_honk -b ./target/program.json -o ../verify_rollup_honk_proof --recursive) | ||
# TODO(https://github.com/AztecProtocol/barretenberg/issues/1253) Deprecate command and construct TOML (e.g., via yq or via conversion from a JSON) | ||
$bb OLD_API write_recursion_inputs_ultra_honk -b ./target/program.json -o ../verify_honk_proof --recursive && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's like you're trying to make the old way as ugly as possible :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha well the |
||
$bb OLD_API write_recursion_inputs_ultra_honk --ipa_accumulation -b ./target/program.json -o ../verify_rollup_honk_proof --recursive) | ||
|
||
cache_upload $tests_tar acir_tests | ||
fi | ||
|
@@ -69,9 +70,9 @@ function test_cmds { | |
# Paths are all relative to the repository root. | ||
function test_cmds_internal { | ||
local plonk_tests=$(find ./acir_tests -maxdepth 1 -mindepth 1 -type d | \ | ||
grep -vE 'verify_honk_proof|double_verify_honk_proof|verify_rollup_honk_proof') | ||
grep -vE 'verify_honk_proof|double_verify_honk_proof|verify_rollup_honk_proof|fold') | ||
local honk_tests=$(find ./acir_tests -maxdepth 1 -mindepth 1 -type d | \ | ||
grep -vE 'single_verify_proof|double_verify_proof|double_verify_nested_proof|verify_rollup_honk_proof') | ||
grep -vE 'single_verify_proof|double_verify_proof|double_verify_nested_proof|verify_rollup_honk_proof|fold') | ||
|
||
local run_test=$(realpath --relative-to=$root ./run_test.sh) | ||
local run_test_browser=$(realpath --relative-to=$root ./run_test_browser.sh) | ||
|
@@ -99,25 +100,23 @@ function test_cmds_internal { | |
# echo ecdsa_secp256r1_3x through bb.js on node to check 256k support. | ||
echo BIN=$bbjs_bin FLOW=prove_then_verify $run_test ecdsa_secp256r1_3x | ||
# echo the prove then verify flow for UltraHonk. This makes sure we have the same circuit for different witness inputs. | ||
echo BIN=$bbjs_bin SYS=ultra_honk FLOW=prove_then_verify $run_test 6_array | ||
# echo a single arbitrary test not involving recursion through bb.js for MegaHonk | ||
echo BIN=$bbjs_bin SYS=mega_honk FLOW=prove_and_verify $run_test 6_array | ||
echo BIN=$bbjs_bin SYS=ultra_honk_deprecated FLOW=prove_then_verify $run_test 6_array | ||
# echo 1_mul through bb.js build, all_cmds flow, to test all cli args. | ||
echo BIN=$bbjs_bin FLOW=all_cmds $run_test 1_mul | ||
|
||
# barretenberg-acir-tests-bb: | ||
# Fold and verify an ACIR program stack using ClientIvc, recursively verify as part of the Tube circuit and produce and verify a Honk proof | ||
# Fold and verify an ACIR program stack using ClientIVC, recursively verify as part of the Tube circuit and produce and verify a Honk proof | ||
echo FLOW=prove_then_verify_tube $run_test 6_array | ||
# echo 1_mul through native bb build, all_cmds flow, to test all cli args. | ||
echo FLOW=all_cmds $run_test 1_mul | ||
echo NATIVE=1 FLOW=all_cmds $run_test 1_mul | ||
|
||
# barretenberg-acir-tests-bb-ultra-plonk: | ||
# Exclude honk tests. | ||
for t in $plonk_tests; do | ||
echo FLOW=prove_then_verify $run_test $(basename $t) | ||
echo SYS=ultra_plonk_deprecated FLOW=prove_then_verify $run_test $(basename $t) | ||
done | ||
echo FLOW=prove_then_verify RECURSIVE=true $run_test assert_statement | ||
echo FLOW=prove_then_verify RECURSIVE=true $run_test double_verify_proof | ||
echo SYS=ultra_plonk_deprecated FLOW=prove_then_verify RECURSIVE=true $run_test assert_statement | ||
echo SYS=ultra_plonk_deprecated FLOW=prove_then_verify RECURSIVE=true $run_test double_verify_proof | ||
|
||
# barretenberg-acir-tests-bb-ultra-honk: | ||
# Exclude plonk tests. | ||
|
@@ -126,15 +125,16 @@ function test_cmds_internal { | |
done | ||
echo SYS=ultra_honk FLOW=prove_then_verify RECURSIVE=true $run_test assert_statement | ||
echo SYS=ultra_honk FLOW=prove_then_verify RECURSIVE=true $run_test double_verify_honk_proof | ||
echo SYS=ultra_honk FLOW=prove_and_verify_program $run_test merkle_insert | ||
echo SYS=ultra_rollup_honk FLOW=prove_then_verify $run_test verify_rollup_honk_proof | ||
echo SYS=ultra_honk FLOW=prove_then_verify HASH=keccak $run_test assert_statement | ||
echo SYS=ultra_honk FLOW=prove_then_verify ROLLUP=true $run_test verify_rollup_honk_proof | ||
|
||
# barretenberg-acir-tests-bb-client-ivc: | ||
echo FLOW=prove_then_verify_client_ivc $run_test 6_array | ||
echo FLOW=prove_then_verify_client_ivc $run_test databus | ||
echo FLOW=prove_then_verify_client_ivc $run_test databus_two_calldata | ||
} | ||
|
||
# TODO(https://github.com/AztecProtocol/barretenberg/issues/1254): More complete testing, including failure tests | ||
function bench { | ||
# TODO: Move to scripts dir along with run_test.sh. | ||
LOG_FILE=bench-acir.jsonl ./bench_acir_tests.sh | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
#!/bin/sh | ||
set -eux | ||
set -eu | ||
|
||
VFLAG=${VERBOSE:+-v} | ||
BFLAG="-b ./target/program.json" | ||
FLAGS="-c $CRS_PATH $VFLAG" | ||
FLAGS="-c $CRS_PATH $VFLAG --scheme ultra_honk" | ||
[ "${RECURSIVE}" = "true" ] && FLAGS+=" --recursive" | ||
PROVE_FLAGS="$FLAGS $BFLAG --oracle_hash keccak --output_data bytes_and_fields --output_content proof_and_vk --input_type single_circuit" | ||
VERIFY_FLAGS="$FLAGS --oracle_hash keccak" | ||
|
||
export PROOF="$PWD/sol_honk_proof" | ||
export PROOF_AS_FIELDS="$PWD/sol_honk_proof_fields.json" | ||
export VK="$PWD/sol_honk_vk" | ||
outdir=$(mktemp -d) | ||
trap "rm -rf $outdir" EXIT | ||
|
||
# Export the paths to the environment variables for the js test runner | ||
export PROOF="$outdir/proof" | ||
export PROOF_AS_FIELDS="$outdir/proof_fields.json" | ||
export VK="$outdir/vk" | ||
export VERIFIER_CONTRACT="$outdir/Verifier.sol" | ||
|
||
# Create a proof, write the solidity contract, write the proof as fields in order to extract the public inputs | ||
$BIN prove_ultra_keccak_honk -o $PROOF $FLAGS $BFLAG | ||
$BIN write_vk_ultra_keccak_honk -o $VK $FLAGS $BFLAG | ||
$BIN verify_ultra_keccak_honk -k $VK -p $PROOF $FLAGS | ||
$BIN proof_as_fields_honk $FLAGS -p $PROOF -o $PROOF_AS_FIELDS | ||
$BIN contract_ultra_honk -k $VK $FLAGS -o Verifier.sol | ||
$BIN prove $PROVE_FLAGS -o $outdir | ||
$BIN verify $VERIFY_FLAGS -k $VK -p $PROOF | ||
$BIN write_contract $FLAGS -k $VK -o $VERIFIER_CONTRACT | ||
|
||
# Export the paths to the environment variables for the js test runner | ||
export VERIFIER_PATH="$PWD/Verifier.sol" | ||
export VERIFIER_PATH="$outdir/Verifier.sol" | ||
export TEST_PATH=$(realpath "../../sol-test/HonkTest.sol") | ||
export TESTING_HONK="true" | ||
|
||
# Use solcjs to compile the generated key contract with the template verifier and test contract | ||
# index.js will start an anvil, on a random port | ||
# Deploy the verifier then send a test transaction | ||
export TEST_NAME=$(basename $PWD) | ||
export TEST_NAME=$(basename $outdir) | ||
node ../../sol-test/src/index.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is immediately going to become confusing when we add a flow to write a CIVC VK. I wonder if this should just become the write_vk for mega honk..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I thought about this but then it's the only mega honk command which seems weird. It think it makes sense to put it behind the --input_type flag in CIVC?