Skip to content

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

Draft
AztecBot wants to merge 1 commit intonextfrom
claudebox/fix-bb-debug-nightly
Draft

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

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented May 1, 2026

Summary

Fixes the nightly debug-build failure of HonkRecursionConstraintTestWithoutPredicate/1.GenerateVKFromConstraints, which has been failing every night since 2026-04-22.

Root cause

Introduced by #22334 (top-of-trace masking), OinkProver::commit_to_masking_poly allocates gemini_masking_poly at max_end_index() instead of the dyadic size. For this test, max_end_index() = 4135 (odd).

Sumcheck's compute_effective_round_size rounds max_end_index up to the next even number (4136) so its pairwise (edge_idx, edge_idx+1) iteration is well-formed. This causes a read of gemini_masking_poly[4135], one past its allocation. In release builds SharedShiftedVirtualZeroesArray::get returns 0 for OOB and the spurious read is harmless. With -D_GLIBCXX_DEBUG and active BB_ASSERTs, the nightly debug preset trips BB_ASSERT(index < virtual_size_ + virtual_padding).

ECCVM and Translator allocate their masking polynomials at circuit_size (a power of two), so they were unaffected.

Fix

Match sumcheck's even rounding when allocating the masking polynomial:

const size_t max_end_index = prover_instance->polynomials.max_end_index();
const size_t polynomial_size = max_end_index + (max_end_index % 2);

This is the same change proposed in #22789 (auto-closed for staleness).

Verification

cd barretenberg/cpp && cmake --preset debug
cd build-debug && ninja dsl_tests
./bin/dsl_tests --gtest_filter='HonkRecursionConstraintTestWithoutPredicate/1.GenerateVKFromConstraints'
# [  PASSED  ] 1 test. (164778 ms)

Failing nightly run: https://github.com/AztecProtocol/aztec-claude/actions/runs/25204419411
Detailed analysis: https://gist.github.com/AztecBot/539dcf1fe5bf600319f08d19c883285d

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

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels May 1, 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.

1 participant