Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions crates/evm/fuzz/src/strategies/invariants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,20 @@ fn select_random_sender(
100 - dictionary_weight => fuzz_param(&alloy_dyn_abi::DynSolType::Address),
dictionary_weight => fuzz_param_from_state(&alloy_dyn_abi::DynSolType::Address, fuzz_state),
]
.prop_map(move |addr| addr.as_address().unwrap())
// Too many exclusions can slow down testing.
.prop_filter("excluded sender", move |addr| !senders.excluded.contains(addr))
.prop_map(move |addr| {
let mut addr = addr.as_address().unwrap();
// Make sure the selected address is not in the list of excluded senders.
// We don't use proptest's filter to avoid reaching the `PROPTEST_MAX_LOCAL_REJECTS`
// max rejects and exiting test before all runs completes.
// See <https://github.com/foundry-rs/foundry/issues/11369>.
loop {
if !senders.excluded.contains(&addr) {
break;
}
addr = Address::random();
}
addr
})
.boxed()
}
}
Expand Down
Loading