Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(invariant): do not record newly created contracts as targetContracts #6200

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion crates/evm/evm/src/executors/invariant/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ impl<'a> InvariantExecutor<'a> {
self.project_contracts,
self.setup_contracts,
&self.artifact_filters,
targeted_contracts.clone(),
&mut created_contracts,
) {
warn!(target: "forge::test", "{error}");
Expand Down
10 changes: 2 additions & 8 deletions crates/evm/fuzz/src/strategies/state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::fuzz_param_from_state;
use crate::invariant::{ArtifactFilters, FuzzRunIdentifiedContracts};
use crate::invariant::ArtifactFilters;
use alloy_dyn_abi::{DynSolType, JsonAbiExt};
use alloy_json_abi::Function;
use alloy_primitives::{Address, Bytes, B256, U256};
Expand Down Expand Up @@ -253,22 +253,16 @@ pub fn collect_created_contracts(
project_contracts: &ContractsByArtifact,
setup_contracts: &ContractsByAddress,
artifact_filters: &ArtifactFilters,
targeted_contracts: FuzzRunIdentifiedContracts,
created_contracts: &mut Vec<Address>,
) -> eyre::Result<()> {
let mut writable_targeted = targeted_contracts.lock();
for (address, account) in state_changeset {
if !setup_contracts.contains_key(address) {
if let (true, Some(code)) = (&account.is_touched(), &account.info.code) {
if !code.is_empty() {
if let Some((artifact, (abi, _))) = project_contracts.find_by_code(code.bytes())
{
if let Some(functions) =
artifact_filters.get_targeted_functions(artifact, abi)?
{
if artifact_filters.get_targeted_functions(artifact, abi)?.is_some() {
created_contracts.push(*address);
writable_targeted
.insert(*address, (artifact.name.clone(), abi.clone(), functions));
}
}
}
Expand Down