fix: Start witness of ACIR generated by Noir start at zero not one#3887
Closed
fix: Start witness of ACIR generated by Noir start at zero not one#3887
Conversation
ledwards2225
reviewed
Jan 9, 2024
| let next_witness_index = Witness(self.current_witness_index); | ||
| self.current_witness_index += 1; | ||
| Witness(self.current_witness_index) | ||
| next_witness_index |
Contributor
There was a problem hiding this comment.
Hah wow. I've clearly spent no time looking at rust bc I thought this was an error. Can't believe this is the return syntax in rust.
Contributor
|
Looks reasonable to me. Obviously we'll have to coordinate because this will break all of the acir tests but my hope is that this PR will make it easy to make things work in bberg after this change. |
Contributor
Author
Feel free to merge this branch into yours to test and perhaps we can work off of there then. |
5 tasks
Merged
codygunton
pushed a commit
that referenced
this pull request
Jan 10, 2024
The primary feature of this PR is a new a constructor of an UltraCircuitBuilder directly from acir-produced data (similar to the one already implemented for GoblinUltraCircuitBuilder). This pattern is necessary if we want to allow const variables to be added in builder constructors in bberg, since otherwise the explicit witness indices generated by acir are incorrectly offset. This change has the benefit of simplifying the code in `acir_format`. It also makes it easier to update bberg once the hardcoded +1 offset in noir is removed (#3887), which was previously accounted for in several undocumented places. # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [ ] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [ ] Every change is related to the PR description. - [ ] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist).
Contributor
Author
|
Superseded by #3961 |
michaelelliot
pushed a commit
to Swoir/noir_rs
that referenced
this pull request
Feb 28, 2024
The primary feature of this PR is a new a constructor of an UltraCircuitBuilder directly from acir-produced data (similar to the one already implemented for GoblinUltraCircuitBuilder). This pattern is necessary if we want to allow const variables to be added in builder constructors in bberg, since otherwise the explicit witness indices generated by acir are incorrectly offset. This change has the benefit of simplifying the code in `acir_format`. It also makes it easier to update bberg once the hardcoded +1 offset in noir is removed (AztecProtocol#3887), which was previously accounted for in several undocumented places. # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [ ] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [ ] Every change is related to the PR description. - [ ] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inside of Noir we have a hardcoded +1 that is a remaining leakage from how we used to convert ACIR to a barretenberg constraint system.
This PR does the necessary changes to remove the
+1. I also had to change how we update the index when generating ACIR. Rather than incrementing the index and returning the incremented index,next_witness_index()is nowget_current_witness_and_update()which only updates the witness index after returning the current witness index.Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.