diff --git a/.github/scripts/run-external-repo-tests.sh b/.github/scripts/run-external-repo-tests.sh index 1725e4b529a..12081374b8d 100755 --- a/.github/scripts/run-external-repo-tests.sh +++ b/.github/scripts/run-external-repo-tests.sh @@ -28,7 +28,7 @@ sed -i '/^compiler_version/d' {Nargo.toml,./**/Nargo.toml} set -e BEFORE=$SECONDS -$NARGO test --silence-warnings --skip-brillig-constraints-check --format json $NARGO_ARGS | tee $OUTPUT_FILE +$NARGO test --silence-warnings --skip-brillig-constraints-check --pedantic-solving --format json $NARGO_ARGS | tee $OUTPUT_FILE TIME=$(($SECONDS-$BEFORE)) if [ ! -s $OUTPUT_FILE ]; then @@ -36,4 +36,4 @@ if [ ! -s $OUTPUT_FILE ]; then rm -f $OUTPUT_FILE fi -jq --null-input "[{ name: \"$NAME\", value: (\"$TIME\" | tonumber), unit: \"s\" }]" > $BENCHMARK_FILE \ No newline at end of file +jq --null-input "[{ name: \"$NAME\", value: (\"$TIME\" | tonumber), unit: \"s\" }]" > $BENCHMARK_FILE diff --git a/compiler/integration-tests/scripts/compile-programs.sh b/compiler/integration-tests/scripts/compile-programs.sh index a7071acc401..2d07e4d95e1 100755 --- a/compiler/integration-tests/scripts/compile-programs.sh +++ b/compiler/integration-tests/scripts/compile-programs.sh @@ -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 diff --git a/compiler/integration-tests/scripts/generate-solidity-verifiers.sh b/compiler/integration-tests/scripts/generate-solidity-verifiers.sh index 93dad3dcc8e..03127a0e6a8 100755 --- a/compiler/integration-tests/scripts/generate-solidity-verifiers.sh +++ b/compiler/integration-tests/scripts/generate-solidity-verifiers.sh @@ -16,19 +16,19 @@ 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 --oracle_hash keccak $NARGO_BACKEND_PATH write_solidity_verifier -k $KEYS/vk -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 --oracle_hash keccak $NARGO_BACKEND_PATH write_solidity_verifier -k $KEYS/vk -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 --scheme ultra_honk --oracle_hash keccak -b $recursion_dir/target/recursion.json -o $KEYS $NARGO_BACKEND_PATH write_solidity_verifier --scheme ultra_honk -k $KEYS/vk -o $contracts_dir/recursion.sol diff --git a/compiler/wasm/scripts/build-fixtures.sh b/compiler/wasm/scripts/build-fixtures.sh index 4c0505ef519..150c979cd75 100755 --- a/compiler/wasm/scripts/build-fixtures.sh +++ b/compiler/wasm/scripts/build-fixtures.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -nargo compile --program-dir ./test/fixtures/simple -nargo compile --program-dir ./test/fixtures/with-deps -nargo compile --program-dir ./test/fixtures/noir-contract \ No newline at end of file +nargo compile --program-dir ./test/fixtures/simple --pedantic-solving +nargo compile --program-dir ./test/fixtures/with-deps --pedantic-solving +nargo compile --program-dir ./test/fixtures/noir-contract --pedantic-solving diff --git a/examples/oracle_transcript/log_and_exec_transcript.sh b/examples/oracle_transcript/log_and_exec_transcript.sh index c6e5066f158..962597bfb45 100755 --- a/examples/oracle_transcript/log_and_exec_transcript.sh +++ b/examples/oracle_transcript/log_and_exec_transcript.sh @@ -12,7 +12,7 @@ cat Oracle.test.jsonl \ > Oracle.jsonl # Execute `main` with the Prover.toml and Oracle.jsonl files. -nargo execute --skip-underconstrained-check --oracle-file Oracle.jsonl +nargo execute --skip-underconstrained-check --pedantic-solving --oracle-file Oracle.jsonl # Also execute through `noir-execute` noir-execute \ diff --git a/examples/recursion/generate_recursive_proof.sh b/examples/recursion/generate_recursive_proof.sh index be756735048..112adaca1c8 100755 --- a/examples/recursion/generate_recursive_proof.sh +++ b/examples/recursion/generate_recursive_proof.sh @@ -5,7 +5,7 @@ BACKEND=${BACKEND:-bb} # Execute and prove inner circuit (sum) mkdir -p ./target/sum -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 --init_kzg_accumulator --output_format bytes_and_fields -o ./target/sum # Generate vk for inner circuit @@ -23,7 +23,7 @@ echo "key_hash = 0x0" >> $RECURSE_LEAF_PROVER_TOML # VK hash is not implemented # Execute and prove `recurse_leaf` -nargo execute recurse_leaf_witness --package recurse_leaf +nargo execute recurse_leaf_witness --package recurse_leaf --pedantic-solving mkdir -p ./target/leaf $BACKEND prove -b ./target/recurse_leaf.json -w ./target/recurse_leaf_witness.gz --output_format bytes_and_fields --init_kzg_accumulator -o ./target/leaf @@ -43,7 +43,7 @@ echo "public_inputs = $(cat ./target/leaf/public_inputs_fields.json)" >> $RECURS # Execute and prove `recurse_node` -nargo execute recurse_node_witness --package recurse_node +nargo execute recurse_node_witness --package recurse_node --pedantic-solving mkdir -p ./target/node $BACKEND prove -b ./target/recurse_node.json -w ./target/recurse_node_witness.gz -o ./target/node --init_kzg_accumulator diff --git a/test_programs/compilation_report.sh b/test_programs/compilation_report.sh index aa1bbef39de..22b1f2a52ce 100755 --- a/test_programs/compilation_report.sh +++ b/test_programs/compilation_report.sh @@ -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/*)) diff --git a/test_programs/execution_report.sh b/test_programs/execution_report.sh index c7b12d99681..3adfabd6075 100755 --- a/test_programs/execution_report.sh +++ b/test_programs/execution_report.sh @@ -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/*)) diff --git a/tooling/nargo_cli/tests/comptime_correctness.proptest-regressions b/tooling/nargo_cli/tests/comptime_correctness.proptest-regressions new file mode 100644 index 00000000000..8cd280158c0 --- /dev/null +++ b/tooling/nargo_cli/tests/comptime_correctness.proptest-regressions @@ -0,0 +1,14 @@ +# Seeds for failure cases proptest has generated in the past. It is +# automatically read and these particular cases re-run before any +# novel cases are generated. +# +# It is recommended to check this file in to source control so that +# everyone who runs the test benefits from these saved cases. +cc 61042657e25848176247cad004d50238ed31fa0f0ef493dbfc504515c5a65cd1 # shrinks to (comptime_expr, runtime_expr, a, b) = ("78981287 / 1661494462", "a / b", 78981287, 1661494462) +cc 18cc582c81f2b4f993fb27b6a84e20830a03598b4f347ee2307a26cda0290044 # shrinks to (comptime_expr, runtime_expr, a, b) = ("153856295 - 3543581023", "a - b", 153856295, 3543581023) +cc 51662878a1f23ce05f5afda7ed0b2534c9cc35ac022d69a3e7f3f688d816e9f1 # shrinks to (comptime_expr, runtime_expr, a, b) = ("249512460 * 1654372632", "a * b", 249512460, 1654372632) +cc 47956ca2b12d1b1d575fcc9057502aeb3d2c9040c206c9c6cbc53d5897b99d53 # shrinks to (comptime_expr, runtime_expr, a, b) = ("29480924 + 3961410066", "a + b", 29480924, 3961410066) +cc 92a2baa828fb65dc55ce2b7dee53d9dcd9956423e3b04b6aada44a22eee53347 # shrinks to (comptime_expr, runtime_expr, a, b) = ("7533799 / 3594186306", "a / b", 7533799, 3594186306) +cc 75c3e62019d6e9b6b274d97b93649067ab0bc8e53f7bb27f3de2a597e2822ac8 # shrinks to (comptime_expr, runtime_expr, a, b) = ("234831728 - 3534706463", "a - b", 234831728, 3534706463) +cc d57cf1d61b4b71a383a313b06f9b51a373e800818fce3feefa7692df2af6d354 # shrinks to (comptime_expr, runtime_expr, a, b) = ("249626379 + 1522826944", "a + b", 249626379, 1522826944) +cc 5fcb8310b679ebc865ff81ba03c7f313b3de71236c56f826cfb0faf2ef0b2228 # shrinks to (comptime_expr, runtime_expr, a, b) = ("196454304 * 4072824723", "a * b", 196454304, 4072824723) diff --git a/tooling/nargo_cli/tests/execute.rs b/tooling/nargo_cli/tests/execute.rs index f49cdf98cc3..fd9264e7021 100644 --- a/tooling/nargo_cli/tests/execute.rs +++ b/tooling/nargo_cli/tests/execute.rs @@ -34,6 +34,24 @@ mod tests { // Allow more bytecode in exchange to catch illegal states. nargo.arg("--enable-brillig-debug-assertions"); + // Enable pedantic solving + let skip_pedantic_solving = [ + // TODO(https://github.com/noir-lang/noir/issues/8098): all of these are failing with: + // ``` + // Failed to solve program: + // \'Failed to solve blackbox function: embedded_curve_add, reason: Infinite input: embedded_curve_add(infinity, infinity)\' + // ``` + "execution_success/multi_scalar_mul", + "execution_success/regression_5045", + "execution_success/regression_7744", + ]; + if !skip_pedantic_solving + .into_iter() + .any(|test_to_skip| test_program_dir.ends_with(test_to_skip)) + { + nargo.arg("--pedantic-solving"); + } + // Enable enums and ownership as unstable features nargo.arg("-Zenums"); diff --git a/tooling/nargo_cli/tests/hello_world.rs b/tooling/nargo_cli/tests/hello_world.rs index cb7f466f843..846d60c4fda 100644 --- a/tooling/nargo_cli/tests/hello_world.rs +++ b/tooling/nargo_cli/tests/hello_world.rs @@ -45,5 +45,6 @@ fn hello_world_example() { let mut cmd = Command::cargo_bin("nargo").unwrap(); cmd.arg("execute"); + cmd.arg("--pedantic-solving"); cmd.assert().success(); } diff --git a/tooling/noir_js/scripts/compile_test_programs.sh b/tooling/noir_js/scripts/compile_test_programs.sh index c877148512f..738db98bc06 100755 --- a/tooling/noir_js/scripts/compile_test_programs.sh +++ b/tooling/noir_js/scripts/compile_test_programs.sh @@ -3,8 +3,8 @@ NARGO=${NARGO:-nargo} 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