-
Notifications
You must be signed in to change notification settings - Fork 244
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
Wrong evaluation of assertion and weird observer effect #6527
Comments
Thanks for opening this issue @LukiMueller! I've minimised the reproduction case to: fn main(in0: Field) -> pub Field {
let mut a: [u8; 1] = in0.to_be_bytes();
let mut b: [u8; 1] = in0.to_be_bytes();
let out0 = (a[0] ^ b[0]) as Field;
// println(f"out0 = {out0}");
let minus_in0 = 256 - in0;
a = minus_in0.to_be_bytes();
b = minus_in0.to_be_bytes();
let v = (a[0] & b[0]) as Field;
// println(f"v = {v}");
assert(v == out0, "must fail!");
out0
} This results in the final SSA
and finally the ACIR
|
If we uncomment the two print statements the I get the ACIR below (I've removed the print calls for brevity)
This ACIR looks identical to my eyes but I now get the output
along with a failing assertion. I think it's then our post-compilation ACIR transformations which are causing the error. |
Aim
I found following unsound behavior for
nargo execute
(with an addition interesting observer effect).When executing the following program I expected the
assert
to fail.However, it passed and I got
Circuit witness successfully solved
.When I tried to print the value, all of a sudden the assertion did not hold anymore.
main.nr
Prover.toml
Expected Behavior
print
statements.Bug
Execution without the print:
Execution with the print:
To Reproduce
nargo execute
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
nargo version = 0.38.0 noirc version = 0.38.0+35408ab303f1018c1e2c38e6ea55430a2c89dc4c (git version hash: 35408ab, is dirty: false)
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: