feat(anvil): Set anvil fork cache location (`--cache-path`)
Component
Anvil
Describe the feature you would like
Currently the cache location is fixed to ~/.foundry/anvil/rpc. It would really simplify the workflow (for example for running fork tests on CI) if we could set custom directory for the cache location. This is related to #4989 however the issue was related to taking too much space.
Another use case would be to save cache on different drive without the need for symlinking.
Additional context
No response
Hey @leovct! Thanks for showing interest. We've created an application for you to contribute to Foundry. Go check it out on OnlyDust!
I am applying to this issue via OnlyDust platform.
My background and how it can be leveraged
I have experience with foundry tooling, and I recently began my journey with Rust. I believe this makes for an excellent opportunity to contribute to the development of blockchain tools.
How I plan on tackling this issue
I would make the Anvil cache location configurable, with a default setting that points to .foundry if no specific location is provided.
Hi, is this issue still open ? I'd like to contribute to it
Can I take this from here?
Marking as duplicate of https://github.com/foundry-rs/foundry/issues/3512 which aims to add an Anvil cache path
Hello, folks!
It seems that for me, anvil ignores --cache-path:
RUST_LOG=debug,cache=trace anvil --cache-path "/tmp/test" --fork-url https://rpc.testnet.fluence.dev --fork-block-number 295905 --no-rate-limit --fork-chain-id 52164803
2025-01-07T13:37:57.231521Z TRACE cache: reading json cache path="/Users/folex/.foundry/cache/rpc/52164803/295905/storage.json"
^C
2025-01-07T13:38:29.247340Z TRACE flush{path=Some("/Users/folex/.foundry/cache/rpc/52164803/295905/storage.json")}: cache: saving json cache
2025-01-07T13:38:29.247781Z TRACE flush{path=Some("/Users/folex/.foundry/cache/rpc/52164803/295905/storage.json")}: cache: saved json cache
foundryup: installed - forge 0.3.0 (5e72c69 2025-01-07T00:23:20.105032000Z)
foundryup: installed - cast 0.3.0 (5e72c69 2025-01-07T00:23:20.035938000Z)
foundryup: installed - anvil 0.3.0 (5e72c69 2025-01-07T00:23:20.032323000Z)
foundryup: installed - chisel 0.3.0 (5e72c69 2025-01-07T00:23:19.732130000Z)
% anvil --version
anvil 0.3.0 (5e72c69 2025-01-07T00:23:20.032323000Z)
Am I doing something wrong here?