feat(corpus): add sender and value mutation in corpus fuzzing#12934
Open
mattvaux wants to merge 6 commits intofoundry-rs:masterfrom
Open
feat(corpus): add sender and value mutation in corpus fuzzing#12934mattvaux wants to merge 6 commits intofoundry-rs:masterfrom
mattvaux wants to merge 6 commits intofoundry-rs:masterfrom
Conversation
0xalpharush
reviewed
Dec 26, 2025
Comment on lines
+635
to
+646
| // Mutate value with 15% probability | ||
| if test_runner.rng().random_ratio(15, 100) { | ||
| // Generate random value, biased towards smaller values for practical fuzzing | ||
| let value = match test_runner.rng().random_range(0..=10) { | ||
| 0..=5 => U256::from(test_runner.rng().random_range(0..=1000)), // Small values | ||
| 6..=8 => U256::from(test_runner.rng().random_range(0..=1_000_000_000_000_000u64)), // Medium values (up to 0.001 ETH) | ||
| 9 => U256::from(test_runner.rng().random_range(0..=1_000_000_000_000_000_000u64)), // Large values (up to 1 ETH) | ||
| 10 => U256::MAX, // Edge case | ||
| _ => unreachable!(), | ||
| }; | ||
| tx.call_details.value = Some(value); | ||
| } |
Contributor
0xalpharush
reviewed
Dec 26, 2025
| tx.call_details.calldata = | ||
| function.abi_encode_input(&prev_inputs).map_err(|e| eyre!(e.to_string()))?.into(); | ||
|
|
||
| // Mutate sender with 15% probability |
Contributor
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.
Fixes TODO: mutate sender and value in corpus fuzzing.
Only calldata was being mutated, so we missed bugs in contracts that depend on msg.sender or msg.value. Added mutation for both fields with 15% probability each.
Added value field to CallDetails with serde default for backward compatibility.