Skip to content

fix(bb): pad gemini_masking_poly size to even to avoid sumcheck OOB#22914

Closed
AztecBot wants to merge 1 commit into
nextfrom
claudebox/fix-nightly-bb-debug-build
Closed

fix(bb): pad gemini_masking_poly size to even to avoid sumcheck OOB#22914
AztecBot wants to merge 1 commit into
nextfrom
claudebox/fix-nightly-bb-debug-build

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented May 3, 2026

Problem

Nightly debug build (./.github/workflows/barretenberg-nightly-debug-build.yml) has been failing every night since 2026-04-22 — 12+ consecutive failures. Today's run: https://github.com/AztecProtocol/aztec-packages/actions/runs/25271523932.

OinkProver<Flavor>::commit_to_masking_poly allocates the Gemini masking polynomial at exactly max_end_index(), which can be odd:

const size_t polynomial_size = prover_instance->polynomials.max_end_index();
prover_instance->polynomials.gemini_masking_poly = Polynomial<FF>::random(polynomial_size);

Sumcheck's compute_effective_round_size rounds up to the next even number:

size_t effective = max_end_index + (max_end_index % 2);

extend_edges then iterates pairwise (edge_idx, edge_idx + 1) over [0, effective). When max_end_index is odd, the final pair touches index == max_end_index, which is one past the masking poly's virtual_size. SharedShiftedVirtualZeroesArray::get returns the static zero in release (well-defined), but trips BB_ASSERT_DEBUG in the nightly debug build — the assertion that fails today is HonkRecursionConstraintTestWithoutPredicate.GenerateVKFromConstraints (called out by name in #22811's workaround).

Fix

Match the rounding compute_effective_round_size already does: pad the masking poly size up to the next even number before allocation.

const size_t max_end_index = prover_instance->polynomials.max_end_index();
const size_t polynomial_size = max_end_index + (max_end_index % 2);
prover_instance->polynomials.gemini_masking_poly = Polynomial<FF>::random(polynomial_size);

Now sumcheck's pairwise iteration stays inside the polynomial's virtual size and the debug assertion no longer trips.

Note: this is a duplicate of #22892

This change is byte-identical to PR #22892, which has been open for two days without review. Re-opening to keep the fix on reviewers' radar — every additional day this sits unmerged is another red nightly. If #22892 is merged first, please close this PR.

Related open fix attempts for the same root cause (please pick one and merge):

Full analysis: https://gist.github.com/AztecBot/9eefc859e8d7596f8edb92251fd286d5

ClaudeBox log: https://claudebox.work/s/9ac1beea695c0227?run=1

ClaudeBox log: https://claudebox.work/s/9ac1beea695c0227?run=1

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels May 3, 2026
@iakovenkos iakovenkos closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants