-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix block constraint key divergence bug. (#3256)
* Fixes the "bad witness key divergence bug" in RAM block constraint by creating new witness and asserting it's equal to the original witness. * Adds a new `prove_then_verify` test flow, which is used to always exercise the good/bad witness data paths to ensure the resulting keys are the same. This is faster than `all_cmds` which isn't needed for every test. It's slower than `prove_and_verify` which uses the single built in command, but that's less safe as it only exercised the bad witness path for circuit construction. * Limit hardware concurrency to 16 cores as performance can actually be worse with higher core counts.
- Loading branch information
1 parent
2da5feb
commit 1c71a0c
Showing
10 changed files
with
34 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert | ||
|
||
FROM node:18-alpine | ||
RUN apk update && apk add git bash curl jq | ||
RUN apk update && apk add git bash curl jq coreutils | ||
COPY --from=0 /usr/src/barretenberg/cpp/build /usr/src/barretenberg/cpp/build | ||
WORKDIR /usr/src/barretenberg/acir_tests | ||
COPY . . | ||
# Run every acir test through native bb build "prove_and_verify". | ||
RUN FLOW=all_cmds ./run_acir_tests.sh | ||
# Run every acir test through native bb build prove_then_verify flow. | ||
# This ensures we test independent pk construction through real/garbage witness data paths. | ||
RUN FLOW=prove_then_verify ./run_acir_tests.sh | ||
# Run 1_mul through native bb build, all_cmds flow, to test all cli args. | ||
RUN VERBOSE=1 FLOW=all_cmds ./run_acir_tests.sh 1_mul |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
if [ -n "$VERBOSE" ]; then | ||
$BIN prove_and_verify -v -c $CRS_PATH -b ./target/acir.gz | ||
else | ||
$BIN prove_and_verify -c $CRS_PATH -b ./target/acir.gz | ||
fi | ||
VFLAG=${VERBOSE:+-v} | ||
|
||
# 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/acir.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
VFLAG=${VERBOSE:+-v} | ||
BFLAG="-b ./target/acir.gz" | ||
FLAGS="-c $CRS_PATH $VFLAG" | ||
|
||
# Test we can perform the proof/verify flow. | ||
# This ensures we test independent pk construction through real/garbage witness data paths. | ||
$BIN prove -o proof $FLAGS $BFLAG | ||
$BIN write_vk -o vk $FLAGS $BFLAG | ||
$BIN verify -k vk -p proof $FLAGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters