foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.25k stars 1.73k forks source link

Add an option to skip calculating root hashes in Anvil #8579

Open benwjhack opened 2 months ago

benwjhack commented 2 months ago

Component

Anvil

Describe the feature you would like

When doing simulations against anvil, a lot of time gets spent calculating root hashes. As far as I understand this is a proof of correctness, and is useful when multiple nodes are talking to each other; however in a simulation environment these hashes aren't useful. The simulation tooling I've been testing with (Compass Labs) shows that commenting out the lines which calculate these root hashes speeds things up the entire simulation by roughly 25%.

I would like it if there was some way to configure anvil to not calculate these root hashes. This configuration option could be something like "skip_root_hashes", or something like "single_node_simulation_environment", in case there are further options that make sense only for a simulation environment.

I would be happy to make an attempt to write this feature if people think it's a good idea, and I get advise on how best to do the configuration option.

Additional context

No response

benwjhack commented 1 month ago

See the fork in which I removed the hashes here - CompassLabs/foundry-test at do-not-hash