Skip to content

refactor(anvil): generalize fork types over Network#13647

Merged
zerosnacks merged 3 commits intofoundry-rs:masterfrom
stevencartavia:anvil-fork-network-generic
Mar 11, 2026
Merged

refactor(anvil): generalize fork types over Network#13647
zerosnacks merged 3 commits intofoundry-rs:masterfrom
stevencartavia:anvil-fork-network-generic

Conversation

@stevencartavia
Copy link
Copy Markdown
Collaborator

@stevencartavia stevencartavia commented Mar 5, 2026

Makes ClientFork, ClientForkConfig, and ForkedStorage in anvil generic over N: Network = AnyNetwork.

  • ClientForkConfig<N>: provider field becomes Arc<RetryProvider<N>> (resolves the // TODO make provider agnostic comment)
  • ForkedStorage<N>: cached blocks/transactions use N::BlockResponse/N::TransactionResponse
  • ClientFork<N>: propagates N through config and storage fields

Network-agnostic methods (traces, proofs, storage, balances, etc.) are in impl<N: Network> ClientFork<N>. Methods depending on AnyRpcBlock/AnyRpcTransaction internals remain in impl ClientFork.

All three types default to AnyNetwork, so no downstream changes needed.

Copy link
Copy Markdown
Collaborator

@mablr mablr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should rebase on #13644.

Comment thread crates/anvil/src/eth/backend/fork.rs Outdated
@stevencartavia stevencartavia force-pushed the anvil-fork-network-generic branch 2 times, most recently from de2732a to e9d1471 Compare March 5, 2026 23:43
@stevencartavia stevencartavia force-pushed the anvil-fork-network-generic branch from e9d1471 to f41dd95 Compare March 6, 2026 05:02
@stevencartavia stevencartavia force-pushed the anvil-fork-network-generic branch from a9174c3 to 8032f65 Compare March 10, 2026 23:55
Copy link
Copy Markdown
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! pending additional check by @mablr

Copy link
Copy Markdown
Contributor

@0xrusowsky 0xrusowsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

Copy link
Copy Markdown
Collaborator

@mablr mablr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@zerosnacks zerosnacks merged commit 51632c4 into foundry-rs:master Mar 11, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants