foundry
foundry copied to clipboard
abnormally large tmp files
Component
Anvil
Have you ensured that all of these are up to date?
- [X] Foundry
- [X] Foundryup
What version of Foundry are you on?
forge 0.2.0 (903a073 2022-11-14T00:07:04.292547Z)
What command(s) is the bug in?
anvil
Operating System
macOS (Apple Silicon)
Describe the bug
Anvil creates abnormally large tmp files.
xx@mac ~ % du -sh ~/.foundry
220G /Users/xx/.foundry
The scenario that lead to 220GB anvil tmp file:
- at the beginning, we create a snapshot X of an empty chain
- we run our fuzz tests (lower thousands of transactions)
- we revert to the snapshot X
- we start fuzzing again from the initial state but with a different seed
The tmp files get very large even when using anvil more normal scenarios (less txs, no snapshoting)
A few thoughts on how to improve anvil:
- remove the logs (cache) after reverting to a snapshot
- remove the logs after anvil_reset
- implement anvil_reset without parameters (ie a simple reset to a clean dev chain)
- prune the logs from unnecessary data - even basic tests without reverting generates huge tmp files (this might be hard to implement but would be nice to have)
Same happened to me, it took a while to understand why my system ran out of memory. Also on masOS/Apple Silicon. I tried to setup a big state with a lot of transactions (18k txs with complex logic) and dump it to a file. I suppose those tmp files are also really slow down the node because it needs to write so much data in the process.
Hi @rkrasiuk, I have set up the dev environment, and would like to implement this feature. Could you assign this to me?
same issue as https://github.com/foundry-rs/foundry/issues/4251