seed_foundry_rpc_cache

Documentation for eth_defi.testing.rpc_cache.seed_foundry_rpc_cache function.

seed_foundry_rpc_cache(seed_dir, cache_dir=None, *, overwrite=False)

Copy repository-supplied cache files into the Foundry RPC cache.

Mirrors every file under seed_dir into cache_dir preserving the relative <network>/<block>/… layout. Non-destructive by default: a file that already exists in the live cache is skipped, because the live copy is at least as fresh (a fork may have extended it with more state). Nothing is ever deleted from the live cache.

Parameters
  • seed_dir (pathlib.Path) – Source directory of committed/default cache files. A missing directory is a no-op (returns 0).

  • cache_dir (Optional[pathlib.Path]) – Destination Foundry RPC cache directory. Defaults to get_foundry_rpc_cache_dir().

  • overwrite (bool) – When True, replace existing live cache files too. Default False (never clobber a warmer live cache).

Returns

Number of files copied into the live cache.

Return type

int