feat: merge-train/barretenberg#21318
Merged
Merged
Conversation
resolves AztecProtocol/barretenberg#1585 tldr: we make the offset generator a free witness while performing `batch_mul` ### Current Way of Masking Points While performing `batch_mul` we create ROM tables of linear combinations of the group elements. If we have an MSM of the form $[(s_1, s_2, \dots, s_n), (G_1, G_2, \dots, G_n)]$ then the ROM tables are of the form: | Index | Element | | --- | --- | | 0 | $G_1 + G_2 + \dots + G_5 + G_6$ | | 1 | $G_1 + G_2 + \dots + G_5 - G_6$ | | 2 | $G_1 + G_2 + \dots - G_5 - G_6$ | | $\vdots$ | $\vdots$ | | $2^6 - 1$ | $- G_1 - G_2 - \dots - G_5 - G_6$ | To avoid any entries of the ROM table to be a point at infinity, we add a multiple of an offset generator: $G'_i := G_i + 2^{i-1}\delta \cdot G\_{\textsf{offset}} \quad \forall i \in [0, 6).$ and then we create a ROM table with $(G'_1, G'_2, \dots, G'_6)$. Here, $\delta$ is a verifier-sent challenge so the prover cannot know it beforehand. ### Proposed Masking of Points Instead of sampling a challenge $\delta$, we make the offset generator $G\_{\textsf{offset}}$ a free witness in the circuit, so the masked generators become: $G'_i := G_i + 2^{i-1}\cdot G\_{\textsf{offset}} \quad \forall i \in [0, 6).$ We only constrain $G\_{\textsf{offset}}$ to be a valid point on the curve. This approach should also be safe because if a malicious prover tries to exploit the fact that he can freely choose $G\_{\textsf{offset}}$ the circuit will be unsatisfiable. An honest prover must choose a random point on the curve as $G\_{\textsf{offset}}$.
Collaborator
Author
|
🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass. |
### 🧾 Audit Context Stdlib curve audit ### 🛠️ Changes Made Only refactoring: remove some unused aliases in the structs. ### ✅ Checklist - [X] Audited all methods of the relevant module/class - [ ] Audited the interface of the module/class with other (relevant) components - [ ] Documented existing functionality and any changes made (as per Doxygen requirements) - [ ] Resolved and/or closed all issues/TODOs pertaining to the audited files - [ ] Confirmed and documented any security or other issues found (if applicable) - [ ] Verified that tests cover all critical paths (and added tests if necessary) - [X] Updated audit tracking for the files audited (check the start of each file you audited) ### 📌 Notes for Reviewers
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.
BEGIN_COMMIT_OVERRIDE
chore: use free witness for offset generator in
batch_mul(#21040)chore: Stdlib curves audit (#21177)
END_COMMIT_OVERRIDE