Extract validate_and_compute_component_sizes and add compile-time LOG…#440
Open
ilyalesokhin-starkware wants to merge 1 commit intomainfrom
Open
Extract validate_and_compute_component_sizes and add compile-time LOG…#440ilyalesokhin-starkware wants to merge 1 commit intomainfrom
ilyalesokhin-starkware wants to merge 1 commit intomainfrom
Conversation
Collaborator
…_SIZE_BITS assert Refactor component log size validation into a dedicated function and replace assert_not_all_ones with an explicit check that no component log size equals 31 (which would overflow M31). Add compile-time asserts that LOG_SIZE_BITS is 5. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0be62b2 to
3fc35e4
Compare
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.
…_SIZE_BITS assert
Refactor component log size validation into a dedicated function and replace assert_not_all_ones with an explicit check that no component log size equals 31 (which would overflow M31). Add compile-time asserts that LOG_SIZE_BITS is 5.
Note
Medium Risk
Touches verifier/circuit constraint logic around component size range checking; a mistake could weaken soundness or reject valid proofs, but the change is localized and adds explicit safety checks.
Overview
Refactors component log-size validation in
stark_verifierby extracting it intovalidate_and_compute_component_sizes, and replaces the previousassert_not_all_onesbit-product check with an explicit constraint that no component log size equals31(avoidingM31overflow when computing2^log_size).Removes
Simd::assert_not_all_onesfromcircuits::simdand adds compile-time asserts enforcingLOG_SIZE_BITS == 5(including an additional guard tied topow2overflow assumptions), along with padding-aware validation usingSECURE_EXTENSION_DEGREE.Reviewed by Cursor Bugbot for commit 3fc35e4. Bugbot is set up for automated code reviews on this repo. Configure here.