Open 0xalpharush opened 3 months ago
consider removing bloom filter calculations (CreateBloom) as well
eats up about 4-5% of the cpu time of EVMApplyTransaction.
if we do this, plan on adding a way to query the list of logs generated by a tx/block since we might still need it for other features
Looking at the CPU report of pprof the most notable improvement we can make is probably memoizing this https://github.com/crytic/medusa/blob/3a9b0fae7888b1c1972c1178ca5022ebd51f5414/fuzzing/coverage/coverage_tracer.go#L164-L168
EDIT: This is done https://github.com/crytic/medusa/pull/472
We don't need a state commitment and it's slow so let's mock it and re-execute transactions as needed (we are already doing this for tracing after the latest go-ethereum upgrade). The only trie that is loaded from the db rn is the genesis and/or post-deployment state AFAIK.
https://github.com/crytic/medusa/blob/b81a9bc7a09baa8f699241fa959e466849b9b453/chain/test_chain.go#L828-L830 https://github.com/crytic/medusa/blob/b81a9bc7a09baa8f699241fa959e466849b9b453/chain/vendored/apply_transaction.go#L64
We should simplify the main fuzz loop to just be changing the block num/timestamp in the block context and not doing all the complex stuff with pending/discarding blocks as if it's a real chain IMO https://github.com/crytic/medusa/blob/b81a9bc7a09baa8f699241fa959e466849b9b453/chain/test_chain.go#L742-L743