foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat(anvil): Set anvil fork cache location (`--cache-path`)

Open Szymx95 opened this issue 1 year ago • 3 comments

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

Szymx95 avatar Aug 13 '24 09:08 Szymx95

Hey @leovct! Thanks for showing interest. We've created an application for you to contribute to Foundry. Go check it out on OnlyDust!

onlydustapp[bot] avatar Aug 14 '24 18:08 onlydustapp[bot]

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.

Akbar30Bill avatar Aug 15 '24 15:08 Akbar30Bill

Hi, is this issue still open ? I'd like to contribute to it

gdnathan avatar Oct 03 '24 10:10 gdnathan

Can I take this from here?

PedroRosalba avatar Nov 03 '24 19:11 PedroRosalba

Marking as duplicate of https://github.com/foundry-rs/foundry/issues/3512 which aims to add an Anvil cache path

zerosnacks avatar Nov 05 '24 13:11 zerosnacks

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?

folex avatar Jan 07 '25 13:01 folex