Skip to content

Commit

Permalink
Ignore cheatcode + enable real balance (#401)
Browse files Browse the repository at this point in the history
* support abi dump

* ignore cheatcode address and enable real balance by default
  • Loading branch information
shouc authored Dec 5, 2023
1 parent 57515a2 commit 069ac88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ default = [
"print_txn_corpus",
"full_trace",
"force_cache",
"real_balance"
]
evm = []
cmp = []
Expand Down
5 changes: 4 additions & 1 deletion src/evm/corpus_initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ where
};
contract.deployed_address = deployed_address;
info!("Contract {} deployed to: {deployed_address:?}", contract.name);
self.state.add_address(&deployed_address);

if deployed_address != CHEATCODE_ADDRESS {
self.state.add_address(&deployed_address);
}
}
info!("Deployed all contracts\n");
}
Expand Down
9 changes: 7 additions & 2 deletions src/evm/onchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ use crate::{
corpus_initializer::ABIMap,
host::FuzzHost,
input::{EVMInput, EVMInputTy},
middlewares::middleware::{add_corpus, Middleware, MiddlewareType},
middlewares::{
cheatcode::CHEATCODE_ADDRESS,
middleware::{add_corpus, Middleware, MiddlewareType},
},
mutator::AccessPattern,
onchain::{abi_decompiler::fetch_abi_heimdall, endpoints::OnChainConfig, flashloan::register_borrow_txn},
types::{convert_u256_to_h160, EVMAddress, EVMU256},
Expand Down Expand Up @@ -417,7 +420,9 @@ impl OnChain {
host.add_hashes(address_h160, parsed_abi.iter().map(|abi| abi.function).collect());
}
let target = if is_proxy_call { caller } else { address_h160 };
state.add_address(&target);
if target != CHEATCODE_ADDRESS {
state.add_address(&target);
}

// notify flashloan and blacklisting flashloan addresses
{
Expand Down

0 comments on commit 069ac88

Please sign in to comment.