-
Notifications
You must be signed in to change notification settings - Fork 223
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: Document requirement for range opcode on r_witness
in GeneratedAcir::euclidean_division
#2437
Conversation
Bump on this. I think this should be fairly uncontroversial |
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.
Bound constraints work on inputs having a specified bit size, which is given in argument to the function. This is why the range constraint on r_witness is important and cannot be removed.
I'm seeing two range opcodes being emitted for the same witness here. Looking again at this we're creating new witnesses in |
* master: (47 commits) fix: Initialize structs during def collection, not name resolution (#2528) feat: Apply optimizations to unconstrained code (#2348) chore(ci): Distinguish between expected failures and compiler panics in `compile_failure` tests. (#2518) chore: improve types in `acvm-backend-barretenberg` (#2516) feat(aztec_noir): abstract kernel return types (#2521) chore: remove usage of `Backend` trait (#2514) chore: delete `ProveAndVerifyCommand` (#2520) chore: Remove dead code from `acvm_backend_barretenberg` (#2512) chore: only install `tokio-util` dependency on windows (#2425) chore(aztec_noir): imply the open keyword (#2508) chore: pull `acvm-backend-barretenberg` into main Noir repo (#2495) chore: clippy fix (#2507) chore: check if the noir aztec library is installed (#2505) chore: update ACIR artifacts (#2503) chore!: Update to `acvm-backend-barretenberg` v0.12.0 (#2377) fix: Bring back accidentally deleted double_verify_proof test. (#2501) chore(aztec_noir): import aztec library if not found yet (#2492) chore(abi)!: Replace struct name with fully qualified struct path (#2374) chore!: Remove keys from preprocessed artifacts (#2283) chore(noir): Release 0.10.5 (#2482) ...
Seems like we're getting this duplicated range opcode due to
then gets simplified to creating a new range constraint on
|
I'm going to add this range constraint back in and add a little documentation instead. |
euclidean_division
r_witness
in GeneratedAcir::euclidean_division
* master: chore: Replace hashers of hashmaps in dfg with fxhashes (#2490) chore: remove duplicate span from FunctionReturnType (#2546) feat: Add support for brillig call stacks in runtime errors (#2549) feat: add `noirc_abi_wasm` crate for ABI encoding in JS (#1945) chore: move CRS files into their own directory (#2558) chore: Cleanup `rebuild.sh` script (#2470) chore(ci): add mocked backend binary to improve `compile_success_empty` tests (#2554) chore: add noir-source-resolver (#2485) chore: fix double verify proof (#2556) feat: add `nargo backend ls` and `nargo backend use` command to switch between backends (#2552) chore(ci): bump checkout action to v4 (#2551) feat: Support for optional assertion messages (#2491) fix: allow usage of decimal string encoding for fields larger than a `i128` (#2547) feat(nargo): add hidden option to produce JSON output from `nargo info` (#2542) chore(stdlib)!: Rename `fixed_base_scalar_mul` to be more descriptive (#2488) chore: Document requirement for range opcode on `r_witness` in `GeneratedAcir::euclidean_division` (#2437) chore!: ACVM 0.24 (#2504) fix(aztec_noir): generalise loop to not always inject a hasher instance (#2529) chore: create helper functions for writing programs and contracts to file (#2526)
Description
Problem*
We currently emit two range opcodes for
r_witness
here where the second is always more strict than the first.Summary*
This PR removes the first range opcode emitted forr_witness
ineuclidean_division
asr < rhs < 2^{rhs_max_bits}
can be relaxed tor < rhs
without affecting the constraints onr
.The restrictions on
r_witness
ineuclidean_division
are a little misleading as in a lot of cases they result in duplicated range opcodes, e.g.This duplication comes from an optimization from inside
bound_constraint_with_offset
which isn't guaranteed to happen (but does for a large number of cases). This PR documents this so that people don't go around trying to remove it in future based on ACIR which looks like it's unnecessary.Documentation
This PR requires documentation updates when merged.
Additional Context
PR Checklist*
cargo fmt
on default settings.