Skip to content

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

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

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

Conversation

@AztecBot

@AztecBot AztecBot commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Nightly debug build was failing because OinkProver::commit_to_masking_poly allocates gemini_masking_poly with size max_end_index(). When that value is odd, sumcheck's pairwise iteration over (edge_idx, edge_idx + 1) reads one element past the polynomial — compute_effective_round_size itself rounds the iteration bound up to even, but the masking polynomial wasn't padded to match. In release builds this is silent UB; in debug, the bounds-checked accessor inside Polynomial::operator[] trips and the build fails.

Fix: round the masking polynomial's allocation up to even at construction so the layout matches what sumcheck assumes. The change only ever enlarges the polynomial by at most one element and never affects non-ZK flavors (gated by flavor_has_gemini_masking<Flavor>()).

Failing run: https://github.com/AztecProtocol/aztec-packages/actions/runs/25303834239

Verification

  • cmake --preset debug && ninja -C build-debug ultra_honk_tests builds cleanly.
  • ultra_honk_tests --gtest_filter='*Gemini*:*ZK*:*Mask*' — 28 passed, 6 skipped (those skips are flavor-gated, not regressions).
  • Two prior independent claudebox sessions converged on this exact patch (claudebox/fix-bb-debug-nightly 2026-05-01 and claudebox/fix-nightly-bb-debug-build 2026-05-03); neither was merged, so the bug recurred.

Detailed analysis: https://gist.github.com/AztecBot/a257fda5daed5f6ef67e07965f30eb11

ClaudeBox log: https://claudebox.work/s/7b79840af9fed45c?run=1

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels May 4, 2026
@iakovenkos iakovenkos marked this pull request as ready for review May 4, 2026 07:56
@iakovenkos iakovenkos closed this May 4, 2026
iakovenkos added a commit that referenced this pull request May 6, 2026
…2937)

## Summary

Nightly debug build was failing again because
`OinkProver::commit_to_masking_poly` allocates `gemini_masking_poly`
with size `max_end_index()`. When that value is odd, sumcheck's pairwise
iteration over `(edge_idx, edge_idx + 1)` reads one element past the
polynomial — `compute_effective_round_size` itself rounds the iteration
bound up to even, but the masking polynomial wasn't padded to match. In
release builds this is silent UB; in debug, the bounds-checked accessor
inside `Polynomial::operator[]` trips and the build fails very early (~2
minutes wall-clock, consistent with the failing job duration).

Fix: round the masking polynomial's allocation up to even at
construction so the layout matches what sumcheck assumes. The change
only ever enlarges the polynomial by at most one element and never
affects non-ZK flavors (gated by `flavor_has_gemini_masking<Flavor>()`).

## Recurrence

This is the **fifth** independent claudebox session converging on this
exact patch over the past four days; the prior four
(`claudebox/fix-bb-debug-nightly` 2026-05-01,
`claudebox/fix-nightly-bb-debug-build` 2026-05-03, PR #22918 2026-05-04,
plus an earlier branch) were not merged, so the bug recurred each night.
The diff here is byte-for-byte identical to the closed PR #22918.

Most recent visible failed run:
https://github.com/AztecProtocol/aztec-packages/actions/runs/25303760883

## Verification

- `cmake --preset debug` configures cleanly.
- `ninja ultra_honk_tests` builds cleanly in the `debug` preset.
- `./bin/ultra_honk_tests --gtest_filter='*Gemini*:*ZK*:*Mask*'` — **28
passed, 6 skipped** (the 6 skips are flavor-gated, not regressions).

Detailed analysis:
https://gist.github.com/AztecBot/97de8e254a5df2dad90f895be7d28f08

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


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

---------

Co-authored-by: sergei iakovenko <105737703+iakovenkos@users.noreply.github.com>
Co-authored-by: iakovenkos <sergey.s.yakovenko@gmail.com>
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