foundry icon indicating copy to clipboard operation
foundry copied to clipboard

abnormally large tmp files

Open cyberthirst opened this issue 2 years ago • 2 comments

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:

  1. at the beginning, we create a snapshot X of an empty chain
  2. we run our fuzz tests (lower thousands of transactions)
  3. we revert to the snapshot X
  4. 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:

  1. remove the logs (cache) after reverting to a snapshot
  2. remove the logs after anvil_reset
  3. implement anvil_reset without parameters (ie a simple reset to a clean dev chain)
  4. 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)

cyberthirst avatar Nov 16 '22 17:11 cyberthirst

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.

NikitaBerezhnoy avatar Dec 06 '23 19:12 NikitaBerezhnoy

Hi @rkrasiuk, I have set up the dev environment, and would like to implement this feature. Could you assign this to me?

dcb9 avatar Apr 17 '24 03:04 dcb9

same issue as https://github.com/foundry-rs/foundry/issues/4251

dpaiton avatar May 27 '24 00:05 dpaiton