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: enable --pedantic-solving for all tests with nargo #11224

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions barretenberg/acir_tests/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ "$COMPILE" -ne 0 ]; then
export RAYON_NUM_THREADS=4
rm -rf target
set +e
compile_output=$($nargo compile --silence-warnings 2>&1 && $nargo execute 2>&1)
compile_output=$($nargo compile --pedantic-solving --silence-warnings 2>&1 && $nargo execute --pedantic-solving 2>&1)
result=$?
set -e
if [ "$result" -ne 0 ]; then
Expand Down Expand Up @@ -61,4 +61,4 @@ else
echo -e "\033[31mFAILED\033[0m"
echo "$output"
exit 1
fi
fi
6 changes: 3 additions & 3 deletions noir-projects/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY . .

# Build & test
RUN yarn
RUN cd ./noir-protocol-circuits && ./bootstrap.sh && nargo test --silence-warnings
RUN cd ./noir-protocol-circuits && ./bootstrap.sh && nargo test --pedantic-solving --silence-warnings

RUN cd /usr/src/yarn-project/txe && yarn start & \
# Wait for TXE to initialize
Expand All @@ -32,10 +32,10 @@ RUN cd /usr/src/yarn-project/txe && yarn start & \
# We need to increase the timeout since all tests running in parallel hammer TXE at the same time, and processing slows down leading to timeouts
# The only way we currently have to batch tests is via RAYON_NUM_THREADS, which is not ideal
./bootstrap.sh && \
NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --silence-warnings --oracle-resolver http://localhost:8080
NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --pedantic-solving --silence-warnings --oracle-resolver http://localhost:8080

RUN cd /usr/src/yarn-project/txe && yarn start & \
# Wait for TXE to initialize
sleep 5 && \
cd ./aztec-nr && \
NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --silence-warnings --oracle-resolver http://localhost:8080
NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --pedantic-solving --silence-warnings --oracle-resolver http://localhost:8080
8 changes: 4 additions & 4 deletions noir-projects/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ test-protocol-circuits:
FROM ../+bootstrap
ENV PATH="/usr/src/noir/noir-repo/target/release:${PATH}"
# TODO(#10754): Remove --skip-brillig-constraints-check
RUN cd /usr/src/noir-projects/noir-protocol-circuits && nargo test --silence-warnings --skip-brillig-constraints-check
RUN cd /usr/src/noir-projects/noir-protocol-circuits && nargo test --pedantic-solving --silence-warnings --skip-brillig-constraints-check

# Also execute circuits to ensure that `Prover.toml` files are in sync.
LET circuits = "private-kernel-init private-kernel-inner private-kernel-reset private-kernel-tail-to-public private-kernel-tail rollup-base-private rollup-base-public rollup-block-root rollup-block-merge rollup-merge rollup-root"
FOR circuit IN $circuits
RUN cd /usr/src/noir-projects/noir-protocol-circuits/crates/$circuit && nargo execute --silence-warnings --skip-brillig-constraints-check > /dev/null
RUN cd /usr/src/noir-projects/noir-protocol-circuits/crates/$circuit && nargo execute --pedantic-solving --silence-warnings --skip-brillig-constraints-check > /dev/null
END

test-aztec-nr:
Expand All @@ -23,7 +23,7 @@ test-aztec-nr:
# Wait for TXE to initialize
sleep 5 && \
cd /usr/src/noir-projects/aztec-nr && \
NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --silence-warnings --oracle-resolver http://localhost:8080
NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --pedantic-solving --silence-warnings --oracle-resolver http://localhost:8080

test-contracts:
FROM ../+bootstrap
Expand All @@ -34,7 +34,7 @@ test-contracts:
cd /usr/src/noir-projects/noir-contracts && \
# We need to increase the timeout since all tests running in parallel hammer TXE at the same time and processing slows down, leading to timeouts
# The only way we currently have to batch tests is via RAYON_NUM_THREADS, which is not ideal
NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --silence-warnings --oracle-resolver http://localhost:8080
NARGO_FOREIGN_CALL_TIMEOUT=300000 nargo test --pedantic-solving --silence-warnings --oracle-resolver http://localhost:8080

format:
FROM ../+bootstrap
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/noir-protocol-circuits/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function test {
CIRCUITS_HASH=$(cache_content_hash ../../noir/.rebuild_patterns "^noir-projects/$name")
test_should_run $name-tests-$CIRCUITS_HASH || return 0

RAYON_NUM_THREADS= $NARGO test --skip-brillig-constraints-check
RAYON_NUM_THREADS= $NARGO test --pedantic-solving --skip-brillig-constraints-check
cache_upload_flag $name-tests-$CIRCUITS_HASH
}

Expand Down
2 changes: 1 addition & 1 deletion noir-projects/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export NARGO=${NARGO:-../../noir/noir-repo/target/release/nargo}

[ -n "$txe_port" ] && args="--oracle-resolver http://127.0.0.1:$txe_port" || args=""

$NARGO test --silence-warnings --skip-brillig-constraints-check $args --package $package --exact $test
$NARGO test --pedantic-solving --silence-warnings --skip-brillig-constraints-check $args --package $package --exact $test
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ KEYS=$(mktemp -d)

# Codegen verifier contract for 1_mul
mul_dir=$repo_root/test_programs/execution_success/1_mul
nargo --program-dir $mul_dir compile
nargo --program-dir $mul_dir compile --pedantic-solving
$NARGO_BACKEND_PATH write_vk -b $mul_dir/target/1_mul.json -o $KEYS/1_mul
$NARGO_BACKEND_PATH contract -k $KEYS/1_mul -o $contracts_dir/1_mul.sol

# Codegen verifier contract for assert_statement
assert_statement_dir=$repo_root/test_programs/execution_success/assert_statement
nargo --program-dir $assert_statement_dir compile
nargo --program-dir $assert_statement_dir compile --pedantic-solving
$NARGO_BACKEND_PATH write_vk -b $assert_statement_dir/target/assert_statement.json -o $KEYS/assert_statement
$NARGO_BACKEND_PATH contract -k $KEYS/assert_statement -o $contracts_dir/assert_statement.sol

# Codegen verifier contract for recursion
recursion_dir=$repo_root/compiler/integration-tests/circuits/recursion
nargo --program-dir $recursion_dir compile
nargo --program-dir $recursion_dir compile --pedantic-solving
$NARGO_BACKEND_PATH write_vk -b $recursion_dir/target/recursion.json -o $KEYS/recursion
$NARGO_BACKEND_PATH contract -k $KEYS/recursion ./ -o $contracts_dir/recursion.sol

rm -rf $KEYS
rm -rf $KEYS
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ self_path=$(dirname "$(readlink -f "$0")")
package_root=$self_path/../

assert_lt_dir=$package_root/circuits/assert_lt/
nargo --program-dir $assert_lt_dir compile
nargo --program-dir $assert_lt_dir compile --pedantic-solving

fold_fibonacci_dir=$package_root/circuits/fold_fibonacci/
nargo --program-dir $fold_fibonacci_dir compile
nargo --program-dir $fold_fibonacci_dir compile --pedantic-solving
6 changes: 3 additions & 3 deletions noir/noir-repo/examples/recursion/generate_recursive_proof.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -eu

BACKEND=${BACKEND:-bb}

nargo execute sum_witness --package sum
nargo execute sum_witness --package sum --pedantic-solving
$BACKEND prove -b ./target/sum.json -w ./target/sum_witness.gz -o ./target/sum_proof --recursive

# Once we have generated our inner proof, we must use this to generate inputs to `recurse_leaf``
Expand All @@ -27,7 +27,7 @@ echo "public_inputs = $PUBLIC_INPUTS" >> $RECURSE_LEAF_PROVER_TOML

# We can now execute and prove `recurse_leaf`

nargo execute recurse_leaf_witness --package recurse_leaf
nargo execute recurse_leaf_witness --package recurse_leaf --pedantic-solving
$BACKEND prove -b ./target/recurse_leaf.json -w ./target/recurse_leaf_witness.gz -o ./target/recurse_leaf_proof --recursive

# Let's do a sanity check that the proof we've generated so far is valid.
Expand All @@ -53,7 +53,7 @@ echo "public_inputs = $PUBLIC_INPUTS" >> $RECURSE_NODE_PROVER_TOML

# We can now execute and prove `recurse_node`

nargo execute recurse_node_witness --package recurse_node
nargo execute recurse_node_witness --package recurse_node --pedantic-solving
$BACKEND prove -b ./target/recurse_node.json -w ./target/recurse_node_witness.gz -o ./target/recurse_node_proof

# We finally verify that the generated recursive proof is valid.
Expand Down
2 changes: 1 addition & 1 deletion noir/noir-repo/scripts/check-critical-libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for REPO in ${REPOS_TO_CHECK[@]}; do
TAG=$(getLatestReleaseTagForRepo $REPO)
git clone $REPO -c advice.detachedHead=false --depth 1 --branch $TAG $TMP_DIR

nargo test -q --program-dir $TMP_DIR
nargo test -q --program-dir $TMP_DIR --pedantic-solving

rm -rf $TMP_DIR
done
2 changes: 1 addition & 1 deletion noir/noir-repo/test_programs/compilation_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for dir in ${tests_to_profile[@]}; do
TOTAL_TIME=0

for ((i = 1; i <= NUM_RUNS; i++)); do
NOIR_LOG=trace NARGO_LOG_DIR=./tmp nargo compile --force --silence-warnings $FLAGS
NOIR_LOG=trace NARGO_LOG_DIR=./tmp nargo compile --force --pedantic-solving --silence-warnings $FLAGS
done

TIMES=($(jq -r '. | select(.target == "nargo::cli" and .fields.message == "close") | .fields."time.busy"' ./tmp/*))
Expand Down
2 changes: 1 addition & 1 deletion noir/noir-repo/test_programs/execution_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ for dir in ${tests_to_profile[@]}; do
TOTAL_TIME=0

for ((i = 1; i <= NUM_RUNS; i++)); do
NOIR_LOG=trace NARGO_LOG_DIR=./tmp nargo execute --silence-warnings
NOIR_LOG=trace NARGO_LOG_DIR=./tmp nargo execute --pedantic-solving --silence-warnings
done

TIMES=($(jq -r '. | select(.target == "nargo::ops::execute" and .fields.message == "close") | .fields."time.busy"' ./tmp/*))
Expand Down
2 changes: 1 addition & 1 deletion noir/noir-repo/test_programs/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ process_dir() {
rm -r ./target/
fi

if ! nargo execute witness; then
if ! nargo execute witness --pedantic-solving; then
echo "$dir failed"
else
if [ -d "$current_dir/acir_artifacts/$dir_name/target" ]; then
Expand Down
1 change: 1 addition & 0 deletions noir/noir-repo/tooling/nargo_cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ fn test_{test_name}(force_brillig: ForceBrillig, inliner_aggressiveness: Inliner
let mut nargo = Command::cargo_bin("nargo").unwrap();
nargo.arg("--program-dir").arg(test_program_dir);
nargo.arg("{test_command}").arg("--force");
nargo.arg("--pedantic-solving");
nargo.arg("--inliner-aggressiveness").arg(inliner_aggressiveness.0.to_string());
// Check whether the test case is non-deterministic
nargo.arg("--check-non-determinism");
Expand Down
10 changes: 5 additions & 5 deletions noir/noir-repo/tooling/noir_js/scripts/compile_test_programs.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

rm -rf ./test/noir_compiled_examples/**/target
nargo --program-dir ./test/noir_compiled_examples/assert_lt compile --force
nargo --program-dir ./test/noir_compiled_examples/assert_msg_runtime compile --force
nargo --program-dir ./test/noir_compiled_examples/fold_fibonacci compile --force
nargo --program-dir ./test/noir_compiled_examples/assert_raw_payload compile --force
nargo --program-dir ./test/noir_compiled_examples/databus compile --force
nargo --program-dir ./test/noir_compiled_examples/assert_lt compile --force --pedantic-solving
nargo --program-dir ./test/noir_compiled_examples/assert_msg_runtime compile --force --pedantic-solving
nargo --program-dir ./test/noir_compiled_examples/fold_fibonacci compile --force --pedantic-solving
nargo --program-dir ./test/noir_compiled_examples/assert_raw_payload compile --force --pedantic-solving
nargo --program-dir ./test/noir_compiled_examples/databus compile --force --pedantic-solving
Loading