fix(avm)!: add std multi-row computation constraint#21718
Open
IlyasRidhuan wants to merge 2 commits intomerge-train/avmfrom
Open
fix(avm)!: add std multi-row computation constraint#21718IlyasRidhuan wants to merge 2 commits intomerge-train/avmfrom
IlyasRidhuan wants to merge 2 commits intomerge-train/avmfrom
Conversation
This was referenced Mar 18, 2026
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Mar 18, 2026
0a38e7c to
b54fe00
Compare
716857c to
e199983
Compare
jeanmon
reviewed
Mar 18, 2026
jeanmon
requested changes
Mar 18, 2026
Contributor
jeanmon
left a comment
There was a problem hiding this comment.
Please apply the standard recipe.
b54fe00 to
db4424a
Compare
736c793 to
85004f6
Compare
IlyasRidhuan
commented
Mar 19, 2026
| pol commit round_inv; | ||
| #[KECCAK_SEL_ROUND_NON_ZERO] | ||
| round * ((1 - sel) * (1 - round_inv) + round_inv) - sel = 0; | ||
|
|
Contributor
Author
There was a problem hiding this comment.
I think this ended up being redundant as derivable form the new multi-row constraints (specifically SEL_ON_START_OR_END)
-
For
sel = 1 => round !=0- #[START_AFTER_LATCH] ensures every computation block begins with start=1
- start * (round - 1) = 0 forces round = 1 on the first row
- #[KECCAK_ROUND_INCREMENT] increments round by 1 each subsequent row within the block
-
For
round != 0 => sel = 1- sel_slice_write == 1 ==> round == 24 (by #[WRITE_TO_SLICE] perm)
- sel_slice_write = sel_no_error * end, the new #[SEL_ON_START_OR_END] guarantees end = 1 => sel = 1 as well
Contributor
There was a problem hiding this comment.
I agree. Good simplification.
Base automatically changed from
ir/03-13-fix_avm_keccak_pre-audit
to
merge-train/avm
March 19, 2026 04:28
85004f6 to
7e0654f
Compare
jeanmon
reviewed
Mar 19, 2026
| // write: #[WRITE_TO_SLICE] is a permutation requiring round == 24 on a row with sel == 1. | ||
| // ==== MULTI-ROW COMPUTATION SELECTORS ==== | ||
| // See recipe: https://github.com/AztecProtocol/aztec-packages/blob/next/barretenberg/cpp/pil/vm2/docs/recipes.md#contiguous-multi-rows-computation-trace | ||
|
|
Contributor
There was a problem hiding this comment.
I would move the declarations for start and end here with their boolean conditions.
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.

Adds the standard multi-row constraint to prevent valid computation from being maliciously terminated midway.
Note there there is no vulnerability that this was fixing.
[WRITE_TO_SLICE]is a permutation requiringround == 24so a malicious prover could not invalidly terminate the keccak computation. This is just to standardise multi-row constraints.