Skip to content

Feature Request: Fully Offline Fork Testing via Pre-Loaded Block Header #11112

@wishfulcynic

Description

@wishfulcynic

Component

Anvil

Describe the feature you would like

Problem

Even with --fork-chain-id, Anvil still makes outgoing RPC requests for the fork block header and any uncached storage. That makes it impossible to run fork tests in CI pipelines or air-gapped dev environments, even when you’ve already cached the chain state.

Proposed feature

It would be great if there were an --offline-fork flag that lets you hand Anvil a pre-downloaded block header (and maybe a chain config) along with the state cache. In that mode Anvil could skip the network entirely and read everything from ~/.foundry/cache/rpc/<chain>/<block> so people could build the cache on a machine with internet, copy it into their container, and still run their fork tests.

Use case

While working in a locked down container, I tried to run a Base fork test using a cached block and --fork-chain-id. Anvil still tried to fetch the block header and missing state from https://mainnet.base.org and immediately failed with 403s because the network was blocked. If I could point Anvil at a saved block header and keep it fully offline, those tests would have worked. I imagine others with restricted setups would find this useful too.

Happy to discuss the details and contribute a PR if this sounds interesting.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-featureType: featureT-needs-triageType: this issue needs to be labelled

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions