fix(bb): pad gemini_masking_poly size to even to avoid sumcheck OOB#22789
Closed
fix(bb): pad gemini_masking_poly size to even to avoid sumcheck OOB#22789
Conversation
Collaborator
Author
|
Automatically closing this stale claudebox draft PR (no updates for 5+ days). Re-open if still needed. |
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.
Summary
Fixes the nightly barretenberg debug build (https://github.com/AztecProtocol/aztec-packages/actions/workflows/barretenberg-nightly-debug-build.yml), which has been failing since 2026-04-22 with:
in
HonkRecursionConstraintTestWithoutPredicate/1.GenerateVKFromConstraints(UltraZK).Root cause
OinkProver::commit_to_masking_polysizedgemini_masking_polyto exactlypolynomials.max_end_index(). When that value is odd, the polynomial'svirtual_sizeends up odd as well.SumcheckProverRound::compute_effective_round_sizeroundsmax_end_indexup to the next even number so sumcheck can iterate edge pairs(0, 1), (2, 3), ….extend_edgesthen accessesmultivariate[edge_idx + 1]for every polynomial inmultivariates.get_all(), includinggemini_masking_poly. With the masking poly'svirtual_sizeone short of the rounded-up effective size, that final read goes one past the end and trips the debug assertion.Witness/precomputed polynomials are sized to
dyadic_size()and stay in bounds; onlygemini_masking_polywas off because it intentionally tracks the active extent rather than the full dyadic size.In release builds the assertion is a no-op and
get(...)falls through to the static-zero branch (since the index sits exactly atend_), so the bug silently returned 0 —gemini_masking_polyis not referenced by any sumcheck relation, so the spurious read had no effect on proof correctness. The debug-only failure surfaced via the nightly debug build.Fix
Round
polynomial_sizeup to the next even value so the masking polynomial'svirtual_sizeis at leastcompute_effective_round_size(...)— at most one extra random field element whenmax_end_indexis odd.The verifier's view is unchanged: the masking polynomial is opaque, consumed only via its commitment and sumcheck evaluation. The other
gemini_masking_poly = Polynomial::random(circuit_size)callers (eccvm_prover.cpp,translator_prover.cpp) pass a power-of-twocircuit_sizeand don't need the change.Detailed analysis (stack trace, regression window, debugging steps): https://gist.github.com/AztecBot/08bcebe7902e7201ad193c8e6acad491
Test plan
nextHEADa4ac021356:HonkRecursionConstraintTestWithoutPredicate/1.GenerateVKFromConstraintsaborts inextend_edgeswithindex=4135 == virtual_size_=4135.dsl_tests:HonkRecursionConstraintTestWithoutPredicate/0.GenerateVKFromConstraints— PASSEDHonkRecursionConstraintTestWithoutPredicate/1.GenerateVKFromConstraints— PASSED (was failing)ci-barretenberg-debug) green via CI.ClaudeBox log: https://claudebox.work/s/94d26399d9c5dec5?run=1