Skip to content

feat: merge-train/barretenberg#21318

Merged
AztecBot merged 5 commits into
nextfrom
merge-train/barretenberg
Mar 11, 2026
Merged

feat: merge-train/barretenberg#21318
AztecBot merged 5 commits into
nextfrom
merge-train/barretenberg

Conversation

@AztecBot

@AztecBot AztecBot commented Mar 10, 2026

Copy link
Copy Markdown
Collaborator

BEGIN_COMMIT_OVERRIDE
chore: use free witness for offset generator in batch_mul (#21040)
chore: Stdlib curves audit (#21177)
END_COMMIT_OVERRIDE

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}}$.

@ludamad ludamad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Auto-approved

@AztecBot AztecBot enabled auto-merge March 10, 2026 20:06
@AztecBot

Copy link
Copy Markdown
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
@AztecBot AztecBot added this pull request to the merge queue Mar 11, 2026
Merged via the queue into next with commit 8a28316 Mar 11, 2026
18 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants