foundry-rs / foundry-rs/foundry
feature(anvil): allow storage.json to persist on `anvil_reset`
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 18h 20m
- Merged PRs (30d)
- 510
Description
### Component
Anvil
### Describe the feature you would like
I've been investigating why many of my historical block tests using Anvil have been timing out.
I discovered that the storage.json file is being cleared on each test run, so full historical chain state was being fetched from upstream. This occurred because my test setup launches a single fork process, and then it processes tests sequentially, resetting to the appropriate block specified by the test.
While digging through old issues, I discovered #3478 which led to PR #3505, merged a week later. Comments in the issue afterwards suggests that the fix only partially addressed the issue. Since then Anvil has gained the ability to prune historical state and to limit maximum number of persisted states, so I expect that the disk and memory issues have been solved.
I want the storage from these historical blocks to persist, so the clearing behavior on `anvil_reset` is undesirable. Can the storage re-initialization behavior be reverted?
For now I've worked around it by calling one-time forks at a given height and then closing the process, but it's much easier to launch one fork and reset it.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.