You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
anvil generates state files while running. these files continue to grow the longer anvil runs and are not automatically deleted. this issue is amplified by the fact that supersim runs with 2s block times, which causes the state files to grow even more. On my macbook these files are being stored under the /Users/<username>/.foundry/anvil/tmp/ directory.
Recommended fix
anvil provides a --max-persisted-states states flag to help with this (see this issue from foundry: foundry-rs/foundry#8399). I recommend we set this to a low number for now and if there is a user demand for making this configurable we can add a cli flag that allows them to configure it.
Background
The --max-persisted-states flag controls how many blockchain state snapshots are persisted (saved) during the execution of the local Ethereum development chain. State snapshots refer to stored representations of the blockchain at a specific point in time. Anvil allows developers to "snapshot" the current state of the chain, which can later be restored (using the evm_revert JSON-RPC call). This feature is useful for testing because you can run a series of tests, revert the chain to a prior state, and then run another set of tests on the exact same blockchain state.
The --max-persisted-states flag sets a limit on how many of these snapshots (states) are saved or persisted on disk. This is useful for controlling disk usage and preventing your system from filling up with old or unnecessary snapshots. Without this flag, Anvil will keep all snapshots, potentially using a lot of disk space if you create a large number of them during testing. By using the --max-persisted-states flag, you can limit the number of snapshots to a certain number. For example, if you set it to 10, Anvil will only keep the last 10 snapshots, and older snapshots will be deleted as new ones are created.
The text was updated successfully, but these errors were encountered:
The issue
anvil generates state files while running. these files continue to grow the longer anvil runs and are not automatically deleted. this issue is amplified by the fact that supersim runs with 2s block times, which causes the state files to grow even more. On my macbook these files are being stored under the
/Users/<username>/.foundry/anvil/tmp/
directory.Recommended fix
anvil provides a
--max-persisted-states
states flag to help with this (see this issue from foundry: foundry-rs/foundry#8399). I recommend we set this to a low number for now and if there is a user demand for making this configurable we can add a cli flag that allows them to configure it.Background
The
--max-persisted-states
flag controls how many blockchain state snapshots are persisted (saved) during the execution of the local Ethereum development chain. State snapshots refer to stored representations of the blockchain at a specific point in time. Anvil allows developers to "snapshot" the current state of the chain, which can later be restored (using theevm_revert
JSON-RPC call). This feature is useful for testing because you can run a series of tests, revert the chain to a prior state, and then run another set of tests on the exact same blockchain state.The
--max-persisted-states
flag sets a limit on how many of these snapshots (states) are saved or persisted on disk. This is useful for controlling disk usage and preventing your system from filling up with old or unnecessary snapshots. Without this flag, Anvil will keep all snapshots, potentially using a lot of disk space if you create a large number of them during testing. By using the--max-persisted-states
flag, you can limit the number of snapshots to a certain number. For example, if you set it to 10, Anvil will only keep the last 10 snapshots, and older snapshots will be deleted as new ones are created.The text was updated successfully, but these errors were encountered: