Conversation
Solidity `bool` may be any nonzero value for truthy when it enters an assembly block. This commit normalizes bool values at every site where they are used in arithmetic, bitwise operations, ABI encoding for external calls, or (transient) storage writes. Utility libraries (highest leverage — inlined throughout codebase): - Ternary: use iszero-inversion trick (single iszero, 3 gas) for ternary/maybeSwap; lt(0x00, c) for orZero - FastLogic.and: rewrite via De Morgan (was wrong: and(2,1)=0) - FastLogic.andNot: rewrite via gt(iszero(b), iszero(a)) - FastLogic.toUint, Math.toInt: normalize with lt(0x00, b) - UnsafeMath.unsafeInc/Dec(bool), Math.inc/dec: normalize with lt(0x00, b) External call encoding (mstore/mstore8/shl of bool): - EkuboV2, EkuboV3, MaverickV2, PancakeInfinity, UniswapV3Fork, FlashAccountingCommon, SafePermit, Hanji: wrap bool in lt(0x00, x) Transient storage: - CurveTricrypto: clean on write and read External callback data validation: - EkuboV2: revert with empty reason if bool > 1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- FastLogic.andNot: use iszero(or(iszero(a), b)) — cleaner formulation - CurveTricrypto: remove redundant clean-on-read (write-side suffices) - CrossChainReceiverFactory: normalize bool immutable in mul (london EVM, uses iszero(iszero) since no PUSH0) - SettlerIntent.setSolver: normalize addNotRemove for xor/mul/sstore use - EulerSwap: validate bool from external staticcall returndata; normalize zeroForOne before shl - UniswapV2: normalize zeroForOne before shl in both getReserves and swap - FlashAccountingCommon, UniswapV3Fork: upgrade silent and(0x01,...) mask to reverting validation for callback bool data Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- FastLogic.and: mul(a, lt(0x00, b)) — cheaper than De Morgan (10 gas on Osaka vs 12; 11 on London vs 12) - FastLogic.andNot: mul(a, iszero(b)) — 8 gas, no PUSH0 needed - CrossChainReceiverFactory.deploy: normalize setOwnerNotCleanup bool before arithmetic use (iszero/iszero for London EVM) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🛡️ Immunefi PR ReviewsWe noticed that your project isn't set up for automatic code reviews. If you'd like this PR reviewed by the Immunefi team, you can request it manually using the link below: Once submitted, we'll take care of assigning a reviewer and follow up here. |
Co-Authored-By: Codex <codex@openai.com>
Co-Authored-By: Codex <codex@openai.com>
e1Ru1o
reviewed
Jun 15, 2026
e1Ru1o
left a comment
Member
There was a problem hiding this comment.
In general I wonder if it is better just to mock/expect calls instead of having all of this Mock contracts
Also in UniswapV3UnitTest.t.sol you did a test about isForwarded being dirty, I might want to do that for the other files with a similar modification, e.g EkuboV2, FlashAccounting
jparklev
reviewed
Jun 16, 2026
jparklev
left a comment
Contributor
There was a problem hiding this comment.
yay pendantic correctness, boo dirty bits. a few small things
Co-Authored-By: Codex <codex@openai.com>
Co-Authored-By: Codex <codex@openai.com>
Co-Authored-By: Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Update integration gas snapshots and regenerated README gas tables. Co-Authored-By: OpenAI Codex <codex@openai.com>
e1Ru1o
approved these changes
Jun 19, 2026
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.
https://docs.soliditylang.org/en/latest/internals/variable_cleanup.html