Skip to content

fix: bounds check in GateSeparatorPolynomial for virtual sumcheck rounds#22130

Draft
AztecBot wants to merge 1 commit intonextfrom
claudebox/fix-bb-debug-build-gate-sep
Draft

fix: bounds check in GateSeparatorPolynomial for virtual sumcheck rounds#22130
AztecBot wants to merge 1 commit intonextfrom
claudebox/fix-bb-debug-build-gate-sep

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

Summary

Fixes non-deterministic debug build assertion failure in SumcheckTests/0.Prover:

Assertion failed: (val < twice_modulus)
Reason: field element exceeds coarse form [0, 2p)

GateSeparatorPolynomial::current_element() and univariate_eval() accessed betas[current_element_idx] without bounds checking. During virtual sumcheck rounds (when current_element_idx >= betas.size()), this read out-of-bounds heap memory. The fix returns FF(1) when past the betas array, which is mathematically correct since virtual rounds have no additional beta challenges.

Full analysis: https://gist.github.com/AztecBot/909e3998f506b0dd6d07a211841dbeb8

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

GateSeparatorPolynomial::current_element() and univariate_eval() accessed
betas[current_element_idx] without bounds checking. During virtual sumcheck
rounds (when current_element_idx >= betas.size()), this read out-of-bounds
memory, causing non-deterministic debug assertion failures.

The fix returns FF(1) when current_element_idx is past the betas array,
which is mathematically correct: virtual rounds have no additional beta
challenges, so the gate separator factor is trivially 1.
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