crytic / medusa

Parallelized, coverage-guided, mutational Solidity smart contract fuzzing, powered by go-ethereum
https://secure-contracts.com/program-analysis/medusa/docs/src/
GNU Affero General Public License v3.0
304 stars 40 forks source link

(WIP) cache codehash for performance #471

Closed samalws-tob closed 2 months ago

samalws-tob commented 2 months ago

451

samalws-tob commented 2 months ago

Ran benchmark, this removes ExtractContractMetadata from the flamegraph, just about doubles gas/second, and increases calls/second by about 50%

Need to clean this up a lot, I think we can remove the cachedGethCodeHash entirely and keep only one of the gethCodeHashToCodeHash's but I'm not sure which of them to keep, should be easy enough to figure out Also I need to check the assumption that geth's codehash value is different during init vs during runtime. If it's not true we need to change gethCodeHashToCodeHash to a map[bool]map[common.Hash]*common.Hash. Might want to do this anyway just to be safe

samalws-tob commented 2 months ago

472