diff --git a/evm/src/fuzz/invariant/executor.rs b/evm/src/fuzz/invariant/executor.rs index f7c56122490f1..de66b7e726534 100644 --- a/evm/src/fuzz/invariant/executor.rs +++ b/evm/src/fuzz/invariant/executor.rs @@ -239,8 +239,11 @@ impl<'a> InvariantExecutor<'a> { } // Stores fuzz state for use with [fuzz_calldata_from_state]. - let fuzz_state: EvmFuzzState = - build_initial_state(self.executor.backend().mem_db(), self.config.include_storage); + let fuzz_state: EvmFuzzState = build_initial_state( + self.executor.backend().mem_db(), + self.config.include_storage, + self.config.include_push_bytes, + ); // During execution, any newly created contract is added here and used through the rest of // the fuzz run. diff --git a/evm/src/fuzz/mod.rs b/evm/src/fuzz/mod.rs index 153471d54d4ce..8f4c793754f40 100644 --- a/evm/src/fuzz/mod.rs +++ b/evm/src/fuzz/mod.rs @@ -73,9 +73,17 @@ impl<'a> FuzzedExecutor<'a> { // Stores fuzz state for use with [fuzz_calldata_from_state] let state: EvmFuzzState = if let Some(fork_db) = self.executor.backend().active_fork_db() { - build_initial_state(fork_db, self.config.include_storage) + build_initial_state( + fork_db, + self.config.include_storage, + self.config.include_push_bytes, + ) } else { - build_initial_state(self.executor.backend().mem_db(), self.config.include_storage) + build_initial_state( + self.executor.backend().mem_db(), + self.config.include_storage, + self.config.include_push_bytes, + ) }; let strat = proptest::strategy::Union::new_weighted(vec![ diff --git a/evm/src/fuzz/strategies/param.rs b/evm/src/fuzz/strategies/param.rs index 34391bbaeaa5c..f3ad34a8855f1 100644 --- a/evm/src/fuzz/strategies/param.rs +++ b/evm/src/fuzz/strategies/param.rs @@ -142,7 +142,7 @@ mod tests { let func = HumanReadableParser::parse_function(f).unwrap(); let db = CacheDB::new(EmptyDB()); - let state = build_initial_state(&db, true); + let state = build_initial_state(&db, true, true); let strat = proptest::strategy::Union::new_weighted(vec![ (60, fuzz_calldata(func.clone())), diff --git a/evm/src/fuzz/strategies/state.rs b/evm/src/fuzz/strategies/state.rs index f3732f5a5fd19..d485c6eb2a5c8 100644 --- a/evm/src/fuzz/strategies/state.rs +++ b/evm/src/fuzz/strategies/state.rs @@ -83,6 +83,7 @@ This is a bug, please open an issue: https://github.com/foundry-rs/foundry/issue pub fn build_initial_state( db: &CacheDB, include_storage: bool, + include_push_bytes: bool, ) -> EvmFuzzState { let mut state = FuzzDictionary::default(); @@ -91,10 +92,12 @@ pub fn build_initial_state( state.insert(H256::from(*address).into()); // Insert push bytes - if let Some(code) = &account.info.code { - if state.cache.insert(*address) { - for push_byte in collect_push_bytes(code.bytes().clone()) { - state.insert(push_byte); + if include_push_bytes { + if let Some(code) = &account.info.code { + if state.cache.insert(*address) { + for push_byte in collect_push_bytes(code.bytes().clone()) { + state.insert(push_byte); + } } } }