-
Notifications
You must be signed in to change notification settings - Fork 260
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
Signed comparison broken in Brillig #4286
Comments
Hey, I ran some tests on my end and indeed, when executing Brillig unconstrained, it results in:
And upon removing Consulting the Brillig documentation on lib.rs, it's clear it lists support for 'Unsigned integers' but there's no mention of Signed integers so I assume that Brillig interprets unconstrained fn main() {
assert(-1 as i32 == 4294967295);
} executes successfully, whereas something like: unconstrained fn main() {
assert(-1 as i32 == 4294967294);
} triggers an the exact you're having:
and running |
# Description ## Problem\* Resolves #4286 ## Summary\* Fixes signed integer comparison by comparing biased versions of the two operands ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
Aim
Execute this program:
Expected Behavior
The program should execute successfully.
Bug
The assertion fails at runtime:
To Reproduce
Execute the given program.
Installation Method
None
Nargo Version
No response
Additional Context
Found while testing the debugger, which uses Brillig output by default, on the
signed_comparison
execution sample.From a quick inspection at the Brillig opcodes generated, it seems it doesn't support signed integers properly.
Also, this now executes successfully in ACIR, but it didn't in the previous version 0.22:
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: