fix(bb): round virtual_size up to even in Polynomial::allocate_backing_memory#22793
Closed
AztecBot wants to merge 1 commit into
Closed
fix(bb): round virtual_size up to even in Polynomial::allocate_backing_memory#22793AztecBot wants to merge 1 commit into
AztecBot wants to merge 1 commit into
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
Fix the failing nightly debug build (https://github.com/AztecProtocol/aztec-packages/actions/runs/24923818366). On
next, every variant ofHonkRecursionConstraintTestWithoutPredicate.GenerateVKFromConstraintstrips theindex < virtual_size_ + virtual_paddingdebug assertion inSharedShiftedVirtualZeroesArray::getduring the first sumcheck round.Root cause
OinkProver::commit_to_masking_polyallocatesgemini_masking_polywithvirtual_size = polynomials.max_end_index(), which can be odd for small/sparse circuits. Sumcheck'sextend_edgesandpartially_evaluatethen read pairs(poly[i], poly[i+1])up to round sizes derived from the active region rounded up to even, so wheni + 1 == virtual_sizethe trailing read lands past the polynomial's virtual zeroes and trips the debug assertion. Release builds quietly read out-of-bounds zero memory and pass.This started failing in the 2026-04-22 nightly (commit
63c67a0f44…), the first run after PR #22334 (chore!: masking at the top of the trace) which made committed polynomials extend tomax_end_index()rather thandyadic_size.Fix
Round
virtual_sizeup to the next even value insidePolynomial::allocate_backing_memory. This bakes the even-virtual-size invariant that sumcheck's hot loops already rely on into the polynomial machinery itself, so the loops can stay branch-free and everyPolynomial<Fr>constructed through the standard ctors (includingPolynomial::random(odd_size)) automatically satisfies it.Per Sergei's review feedback on the closed PR #22788 / #22790 attempts: rather than gating every call site (
extend_edges,partially_evaluate) or papering over a single allocation site (gemini_masking_poly), the invariant lives where polynomials are built.The change is allocation-only — actual backing memory size is unchanged; only the
virtual_size_field stored onSharedShiftedVirtualZeroesArrayis bumped by 1 when the requested value is odd. All current callers either pass a power-of-2 (already even) or passmax_end_index()(the case this fix unblocks), so no other code paths change behaviour.Tests
Run in debug (
cmake --preset debug):HonkRecursionConstraintTestWithoutPredicate/1.GenerateVKFromConstraintsreproduces without the fix and passes with it.polynomials_tests(70/70),sumcheck_tests(29/31, 2 unrelated skips), andultra_honk_tests(287/287, 8 unrelated skips) still pass.HonkRecursionConstraintTestWithoutPredicate/{0,1,2}(GenerateVKFromConstraints+Tampering) all pass; remaining variants {3,4,5} are still running locally and will be confirmed in CI.ClaudeBox log: https://claudebox.work/s/a72a406ae18a825a?run=1