Repository navigation
Conversation
Comparison-guided mutations can produce noncanonical ABI bool words that decode as true but revert before Solidity handlers run. Re-encode accepted inputs to constrain bools to canonical values, including nested bools, while preserving existing enum validation and skipping no-op mutations. Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com>
decofe
requested review from
0xrusowsky,
figtracer,
grandizzy,
mablr and
stevencartavia
as code owners
October 19, 2026 22:48
The runtime Alloy ABI decoder accepts noncanonical bool words, but Solidity reverts on them. Accept comparison mutations only when Alloy encodes the decoded input back to the original mutated calldata. This uses the existing enum rejection path and avoids rewriting the call bytes. Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com>
Check enum validity without cloning arguments that do not contain a declared enum. Compare encoded argument bytes directly instead of constructing a second selector-prefixed calldata buffer. The mutation acceptance rules remain unchanged. Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com>
figtracer
approved these changes
Oct 19, 2026
figtracer
approved these changes
Oct 19, 2026
Comment on lines
+592
to
+594
| && function | ||
| .abi_encode_input_raw(&inputs) | ||
| .is_ok_and(|encoded| encoded == calldata[4..]) |
Member
There was a problem hiding this comment.
The exact re-encoding check fixes bools, but it also rejects cmp mutations that Solidity accepts. Two examples are a shortened bytes or array length, and strings with non-UTF-8 bytes. Alloy re-encodes with zero padding and decodes strings lossily, so the bytes don't match.
Comparing base and head with corpus_dir set:
- A UTF-8 parsing bug was found on 8/8 seeds on base and 0/8 on head.
- Length guards were found 24/24 on base and 0/24 on head with only cmp mutation enabled. With default weights head was much slower or missed them.
Could this validate bool words directly instead of comparing the whole calldata?
This branch has not been deployed
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.
Comparison-guided fuzz mutations can turn a Solidity
boolargument into a noncanonical ABI word such as4. The Alloy runtime ABI decoder interprets it astrue, but Solidity rejects the call before the handler runs; withfail_on_revert, this can report a false invariant failure.Accept a comparison mutation only when Alloy re-encodes its decoded arguments to the same argument bytes, rejecting noncanonical bools (including nested values) without rewriting calldata. The existing enum-variant check remains independent because valid ABI
uint8values can exceed an enum range. The check avoids cloning arguments without enums and does not allocate a selector-prefixed comparison buffer.Prompted by: @0xalpharush