fix!: claude-generated pre-audit for bitwise in avm - soundness bug and edge-case tests#19247
Closed
dbanks12 wants to merge 2 commits into
Closed
fix!: claude-generated pre-audit for bitwise in avm - soundness bug and edge-case tests#19247dbanks12 wants to merge 2 commits into
dbanks12 wants to merge 2 commits into
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Add audit-generated tests for the bitwise component: - NegativeStartSha256NonBoolean: Tests that start_sha256 must be boolean - NegativeStartKeccakNonBoolean: Tests that start_keccak must be boolean - XorIdenticalValuesYieldsZero: Edge case for x XOR x = 0 - OrWithMaxValue: Edge case for OR with 0xFFFFFFFF - AndWithZero: Edge case for AND with 0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
71533aa to
67fcd87
Compare
80f2cd5 to
19c47e3
Compare
19c47e3 to
0e2c862
Compare
The start_sha256 column was declared but lacked a boolean constraint, which is required since it's used as a destination selector for lookups from SHA256 into the bitwise trace. Added: start_sha256 * (1 - start_sha256) = 0; This was found during a comprehensive audit of the bitwise component. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0e2c862 to
2ca82e2
Compare
jeanmon
reviewed
Jan 5, 2026
| EXPECT_THROW_WITH_MESSAGE(check_relation<bitwise>(trace, 2UL), ""); | ||
| } | ||
|
|
||
| // Edge case: XOR of identical values should yield 0 |
Contributor
There was a problem hiding this comment.
I do not think that the 3 following tests are really edge cases (we precompute) but we can keep them as "sanity test vectors".
jeanmon
reviewed
Jan 5, 2026
|
|
||
| // Tests that start_sha256 must be boolean (0 or 1). | ||
| // This test verifies that the constraint `start_sha256 * (1 - start_sha256) = 0` is enforced. | ||
| TEST(BitwiseConstrainingTest, NegativeStartSha256NonBoolean) |
Contributor
There was a problem hiding this comment.
If we want to keep these two boolean checks then we should use an alias for the sub-relation instead of calling check_relation<bitwise>(trace, 3UL) with an integer literal.
jeanmon
approved these changes
Jan 5, 2026
jeanmon
left a comment
Contributor
There was a problem hiding this comment.
Good catch! I added some comments on the unit tests.
Contributor
Author
|
Replaced by #19256 |
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.

found a soundness bug in bitwise PIL