fix: Strange use of predicates in euclidian division#8934
fix: Strange use of predicates in euclidian division#8934TomAFrench merged 20 commits intomasterfrom
Conversation
aakoshh
left a comment
There was a problem hiding this comment.
Makes sense based on the docs of self.bound_constraint_with_offset.
How did you spot these?
I am going through the whole SSA->ACIR conversion workflow to see if we can generate some tooling to check it. So I saw it. A bit worrying that tests are failing now |
|
One source of test failure is the |
|
Okay there is definitely something wrong, about a dozen tests no longer build, for example: $ cd test_programs/execution_success/bit_and
$ cargo run -q -p nargo_cli -- execute --force-brillig
[bit_and] Circuit witness successfully solved
[bit_and] Witness saved to target/bit_and.gz
$ cargo run -q -p nargo_cli -- execute
error: Failed constraint
┌─ src/main.nr:4:19
│
4 │ let x_as_u8 = x as u8;
│ -------
│
= Call stack:
1. src/main.nr:4:19
Failed to solve program: 'Cannot satisfy constraint' |
|
Changed the condition on I think this means when |
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
I don't think so. The maximum value shouldn't be a modulus, then you can cheat. That's why it's all so surprising. |
|
In the failing v4 = truncate v0 to 8 bits, max_bit_size: 254
v5 = cast v4 as u8with this the variables are: Indeed if What I see in the ACIR is that we have added a |
|
Although, it does make sense: |
|
The whole ACIR I'm looking at is like this: |
|
I checked what happens in
|
|
And the reason it didn't fail before was because |
|
There is an actual test that says that |
|
@TomAFrench I'll change the definition of |
|
Hm, actually that sounds like the better solution, because |
|
Okay, it looks like that special handling would have to be added in a few more places, or we go the other way and allow 1 bit. Or return 0 from FieldElemenent::num_bits() for zero. |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: b4d897d | Previous: d596f68 | Ratio |
|---|---|---|---|
rollup-merge |
0.004 s |
0.003 s |
1.33 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Compilation Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 002fe82 | Previous: c686a3e | Ratio |
|---|---|---|---|
rollup-block-root-empty |
23.44 s |
18.42 s |
1.27 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix: check both coordinates for point doubling (noir-lang/noir#9039) fix: codegen generic type arguments (noir-lang/noir#9044) chore: remove accidentally committed files (noir-lang/noir#9048) fix(fuzz): enable print in comptime_vs_brillig_direct (noir-lang/noir#9045) chore: move a couple of test_utils functions into a module (noir-lang/noir#9052) chore: bump external pinned commits (noir-lang/noir#9046) fix: put constraint failure after binary operations that overflow (noir-lang/noir#9023) fix(ssa): Remove array from cache in constant folding if it's an argument to a `Call` (noir-lang/noir#9040) feat: some `nargo expand` fixes related to function and method calls (noir-lang/noir#9038) feat(ssa_fuzzer): custom mutations (noir-lang/noir#8988) feat: implicit coercion of str and fmtstr into CtString (noir-lang/noir#9032) chore: add idempotency check to `remove_unreachable_functions` (noir-lang/noir#9017) chore: add logging for signature failure cases which break barretenberg (noir-lang/noir#9030) feat(ssa): Handle `println` in the SSA interpreter (noir-lang/noir#9028) chore: don't compute used globals during DIE (noir-lang/noir#9029) fix(ssa_fuzzer): nested conditions in loops (noir-lang/noir#8997) fix(fuzz): Consider `==` turning into `!=` equivalent (noir-lang/noir#9025) fix(fuzz): Avoid overflow in `gen_unary` (noir-lang/noir#9024) fix(ssa): Perform `mem2reg` before DIE (noir-lang/noir#9018) fix: Strange use of predicates in euclidian division (noir-lang/noir#8934) fix: compute the dominance frontier of the reverse cfg using the extended cfg (noir-lang/noir#9019) fix(fuzz): Handle overflow errors from the elaborator (noir-lang/noir#9014) feat: show why an assertion will always fail if it's a static string (noir-lang/noir#9013) chore(ssa): Add `SsaPass:and_then` (noir-lang/noir#9016) fix: Add a remove_unreachable_instructions SSA pass (with unreachable terminator) (noir-lang/noir#9008) feat: `nargo expand` for LSP (noir-lang/noir#9012) fix(mem2reg): Add the value in `ArraySet` to `aliased_references` (noir-lang/noir#8976) feat(debug): Print ssa locations along with ssa (noir-lang/noir#9001) chore: move `nargo expand` code to its own crate (noir-lang/noir#9011) chore: redo typo PR by donatik27 (noir-lang/noir#9004) fix: recover generics when defining trait impl function (noir-lang/noir#9009) fix: replace public key with curve generators in inactive branches (noir-lang/noir#8993) fix(fuzz): Avoid overflowing binary ops in "no dynamic" mode (noir-lang/noir#8996) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Ary Borenszweig <asterite@gmail.com>
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore(docs): Brillig VM docs (noir-lang/noir#9078) fix(expand): missing struct member visibility, and use "crate" instead of "super" when possible (noir-lang/noir#9081) fix: revert #9044 (noir-lang/noir#9080) chore: error on infinite recursion (noir-lang/noir#9063) fix(fuzz): Assign to an index variable to sequence side effects (noir-lang/noir#9056) chore: bump cargo deny (noir-lang/noir#9077) chore: Refactor `ConstrainEqFailed` to have `Option<String>` for `msg` (noir-lang/noir#9065) chore(debug): Toggle SSA locations when printing SSA (noir-lang/noir#9066) chore(acir_gen): Improve error message for radix decomposition (noir-lang/noir#9068) chore(ci): fix upload of benchmark results on master (noir-lang/noir#9069) fix: check both coordinates for point doubling (noir-lang/noir#9039) fix: codegen generic type arguments (noir-lang/noir#9044) chore: remove accidentally committed files (noir-lang/noir#9048) fix(fuzz): enable print in comptime_vs_brillig_direct (noir-lang/noir#9045) chore: move a couple of test_utils functions into a module (noir-lang/noir#9052) chore: bump external pinned commits (noir-lang/noir#9046) fix: put constraint failure after binary operations that overflow (noir-lang/noir#9023) fix(ssa): Remove array from cache in constant folding if it's an argument to a `Call` (noir-lang/noir#9040) feat: some `nargo expand` fixes related to function and method calls (noir-lang/noir#9038) feat(ssa_fuzzer): custom mutations (noir-lang/noir#8988) feat: implicit coercion of str and fmtstr into CtString (noir-lang/noir#9032) chore: add idempotency check to `remove_unreachable_functions` (noir-lang/noir#9017) chore: add logging for signature failure cases which break barretenberg (noir-lang/noir#9030) feat(ssa): Handle `println` in the SSA interpreter (noir-lang/noir#9028) chore: don't compute used globals during DIE (noir-lang/noir#9029) fix(ssa_fuzzer): nested conditions in loops (noir-lang/noir#8997) fix(fuzz): Consider `==` turning into `!=` equivalent (noir-lang/noir#9025) fix(fuzz): Avoid overflow in `gen_unary` (noir-lang/noir#9024) fix(ssa): Perform `mem2reg` before DIE (noir-lang/noir#9018) fix: Strange use of predicates in euclidian division (noir-lang/noir#8934) fix: compute the dominance frontier of the reverse cfg using the extended cfg (noir-lang/noir#9019) fix(fuzz): Handle overflow errors from the elaborator (noir-lang/noir#9014) feat: show why an assertion will always fail if it's a static string (noir-lang/noir#9013) chore(ssa): Add `SsaPass:and_then` (noir-lang/noir#9016) fix: Add a remove_unreachable_instructions SSA pass (with unreachable terminator) (noir-lang/noir#9008) feat: `nargo expand` for LSP (noir-lang/noir#9012) fix(mem2reg): Add the value in `ArraySet` to `aliased_references` (noir-lang/noir#8976) feat(debug): Print ssa locations along with ssa (noir-lang/noir#9001) chore: move `nargo expand` code to its own crate (noir-lang/noir#9011) chore: redo typo PR by donatik27 (noir-lang/noir#9004) fix: recover generics when defining trait impl function (noir-lang/noir#9009) fix: replace public key with curve generators in inactive branches (noir-lang/noir#8993) fix(fuzz): Avoid overflowing binary ops in "no dynamic" mode (noir-lang/noir#8996) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Ary Borenszweig <asterite@gmail.com>
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore(docs): Brillig VM docs (noir-lang/noir#9078) fix(expand): missing struct member visibility, and use "crate" instead of "super" when possible (noir-lang/noir#9081) fix: revert #9044 (noir-lang/noir#9080) chore: error on infinite recursion (noir-lang/noir#9063) fix(fuzz): Assign to an index variable to sequence side effects (noir-lang/noir#9056) chore: bump cargo deny (noir-lang/noir#9077) chore: Refactor `ConstrainEqFailed` to have `Option<String>` for `msg` (noir-lang/noir#9065) chore(debug): Toggle SSA locations when printing SSA (noir-lang/noir#9066) chore(acir_gen): Improve error message for radix decomposition (noir-lang/noir#9068) chore(ci): fix upload of benchmark results on master (noir-lang/noir#9069) fix: check both coordinates for point doubling (noir-lang/noir#9039) fix: codegen generic type arguments (noir-lang/noir#9044) chore: remove accidentally committed files (noir-lang/noir#9048) fix(fuzz): enable print in comptime_vs_brillig_direct (noir-lang/noir#9045) chore: move a couple of test_utils functions into a module (noir-lang/noir#9052) chore: bump external pinned commits (noir-lang/noir#9046) fix: put constraint failure after binary operations that overflow (noir-lang/noir#9023) fix(ssa): Remove array from cache in constant folding if it's an argument to a `Call` (noir-lang/noir#9040) feat: some `nargo expand` fixes related to function and method calls (noir-lang/noir#9038) feat(ssa_fuzzer): custom mutations (noir-lang/noir#8988) feat: implicit coercion of str and fmtstr into CtString (noir-lang/noir#9032) chore: add idempotency check to `remove_unreachable_functions` (noir-lang/noir#9017) chore: add logging for signature failure cases which break barretenberg (noir-lang/noir#9030) feat(ssa): Handle `println` in the SSA interpreter (noir-lang/noir#9028) chore: don't compute used globals during DIE (noir-lang/noir#9029) fix(ssa_fuzzer): nested conditions in loops (noir-lang/noir#8997) fix(fuzz): Consider `==` turning into `!=` equivalent (noir-lang/noir#9025) fix(fuzz): Avoid overflow in `gen_unary` (noir-lang/noir#9024) fix(ssa): Perform `mem2reg` before DIE (noir-lang/noir#9018) fix: Strange use of predicates in euclidian division (noir-lang/noir#8934) fix: compute the dominance frontier of the reverse cfg using the extended cfg (noir-lang/noir#9019) fix(fuzz): Handle overflow errors from the elaborator (noir-lang/noir#9014) feat: show why an assertion will always fail if it's a static string (noir-lang/noir#9013) chore(ssa): Add `SsaPass:and_then` (noir-lang/noir#9016) fix: Add a remove_unreachable_instructions SSA pass (with unreachable terminator) (noir-lang/noir#9008) feat: `nargo expand` for LSP (noir-lang/noir#9012) fix(mem2reg): Add the value in `ArraySet` to `aliased_references` (noir-lang/noir#8976) feat(debug): Print ssa locations along with ssa (noir-lang/noir#9001) chore: move `nargo expand` code to its own crate (noir-lang/noir#9011) chore: redo typo PR by donatik27 (noir-lang/noir#9004) fix: recover generics when defining trait impl function (noir-lang/noir#9009) fix: replace public key with curve generators in inactive branches (noir-lang/noir#8993) fix(fuzz): Avoid overflowing binary ops in "no dynamic" mode (noir-lang/noir#8996) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Ary Borenszweig <asterite@gmail.com>
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore(docs): Brillig VM docs (noir-lang/noir#9078) fix(expand): missing struct member visibility, and use "crate" instead of "super" when possible (noir-lang/noir#9081) fix: revert AztecProtocol#9044 (noir-lang/noir#9080) chore: error on infinite recursion (noir-lang/noir#9063) fix(fuzz): Assign to an index variable to sequence side effects (noir-lang/noir#9056) chore: bump cargo deny (noir-lang/noir#9077) chore: Refactor `ConstrainEqFailed` to have `Option<String>` for `msg` (noir-lang/noir#9065) chore(debug): Toggle SSA locations when printing SSA (noir-lang/noir#9066) chore(acir_gen): Improve error message for radix decomposition (noir-lang/noir#9068) chore(ci): fix upload of benchmark results on master (noir-lang/noir#9069) fix: check both coordinates for point doubling (noir-lang/noir#9039) fix: codegen generic type arguments (noir-lang/noir#9044) chore: remove accidentally committed files (noir-lang/noir#9048) fix(fuzz): enable print in comptime_vs_brillig_direct (noir-lang/noir#9045) chore: move a couple of test_utils functions into a module (noir-lang/noir#9052) chore: bump external pinned commits (noir-lang/noir#9046) fix: put constraint failure after binary operations that overflow (noir-lang/noir#9023) fix(ssa): Remove array from cache in constant folding if it's an argument to a `Call` (noir-lang/noir#9040) feat: some `nargo expand` fixes related to function and method calls (noir-lang/noir#9038) feat(ssa_fuzzer): custom mutations (noir-lang/noir#8988) feat: implicit coercion of str and fmtstr into CtString (noir-lang/noir#9032) chore: add idempotency check to `remove_unreachable_functions` (noir-lang/noir#9017) chore: add logging for signature failure cases which break barretenberg (noir-lang/noir#9030) feat(ssa): Handle `println` in the SSA interpreter (noir-lang/noir#9028) chore: don't compute used globals during DIE (noir-lang/noir#9029) fix(ssa_fuzzer): nested conditions in loops (noir-lang/noir#8997) fix(fuzz): Consider `==` turning into `!=` equivalent (noir-lang/noir#9025) fix(fuzz): Avoid overflow in `gen_unary` (noir-lang/noir#9024) fix(ssa): Perform `mem2reg` before DIE (noir-lang/noir#9018) fix: Strange use of predicates in euclidian division (noir-lang/noir#8934) fix: compute the dominance frontier of the reverse cfg using the extended cfg (noir-lang/noir#9019) fix(fuzz): Handle overflow errors from the elaborator (noir-lang/noir#9014) feat: show why an assertion will always fail if it's a static string (noir-lang/noir#9013) chore(ssa): Add `SsaPass:and_then` (noir-lang/noir#9016) fix: Add a remove_unreachable_instructions SSA pass (with unreachable terminator) (noir-lang/noir#9008) feat: `nargo expand` for LSP (noir-lang/noir#9012) fix(mem2reg): Add the value in `ArraySet` to `aliased_references` (noir-lang/noir#8976) feat(debug): Print ssa locations along with ssa (noir-lang/noir#9001) chore: move `nargo expand` code to its own crate (noir-lang/noir#9011) chore: redo typo PR by donatik27 (noir-lang/noir#9004) fix: recover generics when defining trait impl function (noir-lang/noir#9009) fix: replace public key with curve generators in inactive branches (noir-lang/noir#8993) fix(fuzz): Avoid overflowing binary ops in "no dynamic" mode (noir-lang/noir#8996) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Ary Borenszweig <asterite@gmail.com>
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore(docs): Brillig VM docs (noir-lang/noir#9078) fix(expand): missing struct member visibility, and use "crate" instead of "super" when possible (noir-lang/noir#9081) fix: revert #9044 (noir-lang/noir#9080) chore: error on infinite recursion (noir-lang/noir#9063) fix(fuzz): Assign to an index variable to sequence side effects (noir-lang/noir#9056) chore: bump cargo deny (noir-lang/noir#9077) chore: Refactor `ConstrainEqFailed` to have `Option<String>` for `msg` (noir-lang/noir#9065) chore(debug): Toggle SSA locations when printing SSA (noir-lang/noir#9066) chore(acir_gen): Improve error message for radix decomposition (noir-lang/noir#9068) chore(ci): fix upload of benchmark results on master (noir-lang/noir#9069) fix: check both coordinates for point doubling (noir-lang/noir#9039) fix: codegen generic type arguments (noir-lang/noir#9044) chore: remove accidentally committed files (noir-lang/noir#9048) fix(fuzz): enable print in comptime_vs_brillig_direct (noir-lang/noir#9045) chore: move a couple of test_utils functions into a module (noir-lang/noir#9052) chore: bump external pinned commits (noir-lang/noir#9046) fix: put constraint failure after binary operations that overflow (noir-lang/noir#9023) fix(ssa): Remove array from cache in constant folding if it's an argument to a `Call` (noir-lang/noir#9040) feat: some `nargo expand` fixes related to function and method calls (noir-lang/noir#9038) feat(ssa_fuzzer): custom mutations (noir-lang/noir#8988) feat: implicit coercion of str and fmtstr into CtString (noir-lang/noir#9032) chore: add idempotency check to `remove_unreachable_functions` (noir-lang/noir#9017) chore: add logging for signature failure cases which break barretenberg (noir-lang/noir#9030) feat(ssa): Handle `println` in the SSA interpreter (noir-lang/noir#9028) chore: don't compute used globals during DIE (noir-lang/noir#9029) fix(ssa_fuzzer): nested conditions in loops (noir-lang/noir#8997) fix(fuzz): Consider `==` turning into `!=` equivalent (noir-lang/noir#9025) fix(fuzz): Avoid overflow in `gen_unary` (noir-lang/noir#9024) fix(ssa): Perform `mem2reg` before DIE (noir-lang/noir#9018) fix: Strange use of predicates in euclidian division (noir-lang/noir#8934) fix: compute the dominance frontier of the reverse cfg using the extended cfg (noir-lang/noir#9019) fix(fuzz): Handle overflow errors from the elaborator (noir-lang/noir#9014) feat: show why an assertion will always fail if it's a static string (noir-lang/noir#9013) chore(ssa): Add `SsaPass:and_then` (noir-lang/noir#9016) fix: Add a remove_unreachable_instructions SSA pass (with unreachable terminator) (noir-lang/noir#9008) feat: `nargo expand` for LSP (noir-lang/noir#9012) fix(mem2reg): Add the value in `ArraySet` to `aliased_references` (noir-lang/noir#8976) feat(debug): Print ssa locations along with ssa (noir-lang/noir#9001) chore: move `nargo expand` code to its own crate (noir-lang/noir#9011) chore: redo typo PR by donatik27 (noir-lang/noir#9004) fix: recover generics when defining trait impl function (noir-lang/noir#9009) fix: replace public key with curve generators in inactive branches (noir-lang/noir#8993) fix(fuzz): Avoid overflowing binary ops in "no dynamic" mode (noir-lang/noir#8996) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Ary Borenszweig <asterite@gmail.com>
Description
Problem*
Predicate and one were mixed in 1 place and predicate was reused instead of one in another (technically both were still correct, due to a coincidence).
Summary*
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.