-
Notifications
You must be signed in to change notification settings - Fork 214
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
IncRc not issued on array reassigns #3795
Comments
Labelling this P-HIGH since it causes the code to silently change behavior |
What is the status of this issue? |
@kevaundray it is still open |
I've added the missing IncRc instruction on branch jf/fix-incrc-assign, yet the bug is still present. Any ideas why this may be @sirasistant? |
#4210) # Description ## Problem\* Resolves #3795 ## Summary\* `Instruction::IncrementRc` in Brillig actually only increments the reference count on a copy of an array's metadata if the array was loaded from a reference (while the loaded array is a reference rather than a copy). This is suboptimal since it was meant to be shared across references to the array. This is what caused the original issue where mutating the reference saw a different reference count and thought it was safe to mutate without copying first. I've added a somewhat hacky check in the method to increment reference counts to check if the array was loaded from a reference. If so, we load a fresh value, increment rc on that, and re-store it to update the metadata in the original array. ## 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. --------- Co-authored-by: Maxim Vezenov <[email protected]>
This got reverted #4332 because of a regression that made a critical path in aztec-packages to blow up in complexity, never ending. I've added an e2e test in the revert PR of that path. |
@sirasistant I'll test an older commit of the reverted PR which had a different approach first. |
# Description ## Problem\* Resolves #3795 ## Summary\* This is an older version of #4210 which undoes the change in d331ee2 due to a regression #4332. This PR is not yet confirmed to work since I do not have a test case for it! @sirasistant, do you mind seeing if this fixes the regression issue? ## 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\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
Aim
A program like this one:
With this prover.toml
Fails the assertions
Expected Behavior
It should pass with the given inputs
Bug
The SSA generated is missing an inc_rc in
mid_change = arr
To Reproduce
Installation Method
None
Nargo Version
No response
Additional Context
No response
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: