-
Notifications
You must be signed in to change notification settings - Fork 248
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
fix: shift right overflow in ACIR with unknown var now returns zero #7509
Conversation
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Execution Memory'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20
.
Benchmark suite | Current: 31996c6 | Previous: ef51d8a | Ratio |
---|---|---|---|
rollup-base-private |
582.03 MB |
441.61 MB |
1.32 |
rollup-block-root |
3500 MB |
1420 MB |
2.46 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20
.
Benchmark suite | Current: 31996c6 | Previous: ef51d8a | Ratio |
---|---|---|---|
AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_blob |
61 s |
50 s |
1.22 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Looks like Rust panics when this happens. Are we sure we want to return 0 in acir then instead of changing brillig to also halt? |
In a chat with @TomAFrench on Slack he said that ideally it's zero. But it's a good opportunity to revisit this as I also tend to prefer matching Rust's behavior. |
@TomAFrench can you elaborate here (or on the linked issue) why zero is preferable to erroring? |
I suggested this as currently the program fn main(x: u8) -> pub u8 {
x >> 9
} returns 0 when given an input of 1 so we have precedent. (we should create an error for this case if we're wanting to reject larger shifts) I was also thinking of these lines in the sha256 impl where when we're bitshifting by a value which is only known at runtime and need to add a guard to avoid this error case. |
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.
The regressions seem fairly small
Description
Problem
Resolves #7412
Summary
The explanation of the bug is here: #7412 (comment)
This is one way to solve this. I wonder if there's a better one (less ops).
Additional Context
Documentation
Check one:
PR Checklist
cargo fmt
on default settings.