fix(bb): clamp BatchMergeProver degree-check loop to fix nightly debug SIGABRT#23077
Merged
federicobarbacovi merged 3 commits intoMay 8, 2026
Merged
Conversation
federicobarbacovi
approved these changes
May 8, 2026
federicobarbacovi
approved these changes
May 8, 2026
8ee7069
into
merge-train/barretenberg
16 of 22 checks passed
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
Unblocks the Nightly Debug Build on
next. With_GLIBCXX_DEBUGenabled,BatchMergeTests/2.TooManySubtablesFailsaborts (exit 134) with:Root cause
TooManySubtablesFailsusesBB_DISABLE_ASSERTS()so it can drive the verifier withN = max_subtables + 1subtables. With BB asserts demoted to warnings, control flow falls past theBB_ASSERT_LTE(N, M, ...)guard at the top ofBatchMergeProver::construct_proofand reachescompute_degree_check_polynomial, which iterates overflattened_columns.size()(sized forN) but indexesdegree_check_challenges(sized for(M+1) * NUM_WIRES). In Release the over-read returns garbage that the verifier rejects — exactly what the test wants. In Debug, libstdc++'s_GLIBCXX_DEBUG(set by thedebugpreset'sCXXFLAGS) bounds-checksstd::vector::operator[]and traps.BB_DISABLE_ASSERTS()cannot suppress this — the bounds check is libstdc++'s, not bb's.Why the previously-merged fix didn't fix anything
PR #23019 (already merged into
merge-train/barretenbergvia the open #23025) was titled the same as this PR but only modifiedTweakableBatchMergeProver::construct_proof. The actualTooManySubtablesFailstest path usesprove_and_verifywith the defaultfault_mode = FaultMode::NONE, which routes throughBatchMergeProver(the base class), notTweakableBatchMergeProver. I confirmed this in this container by buildinggoblin_testsagainstorigin/merge-train/barretenbergHEAD with the debug preset — the same OOB still aborts. The merge train cannot deliver this fix without a real prover-side change.Fix
Clamp the loop to
min(flattened_columns.size(), degree_check_challenges.size())insideBatchMergeProver::compute_degree_check_polynomial. Normal paths are unaffected because both sizes equal(M+1) * NUM_WIRESwheneverN <= M(the assert holds). The misuse path now produces a partial degree-check polynomial that the verifier still rejects in both Debug and Release — same observable behaviour, no UB.This is the same one-file change as the open draft #22976; opening this fresh PR against current
nextso it doesn't sit silently in draft.Verification
Reproduced inside the ClaudeBox container on
f23aa82c52(currentnextHEAD) with the same flags as the nightly:BatchMergeTests/2.TooManySubtablesFailswith the OOB shown above (exit 134). Confirmed identical abort onorigin/merge-train/barretenbergHEAD.Full
goblin_testspost-fix: 68 passed / 7 skipped / 0 failed (342s).Related PRs
gemini_masking_polyvirtual size).TweakableBatchMergeProver, which is unused on this test path; it is a no-op for the nightly.Detailed analysis: https://gist.github.com/AztecBot/7be72c96a1d3d18458dce92a828116a2
ClaudeBox log: https://claudebox.work/s/8ad866e315acbe92?run=1
ClaudeBox log: https://claudebox.work/s/8ad866e315acbe92?run=1