Skip to content

feat(evm): warn when an explicit --network does not match a fork - #18036

Closed
SibghatUllah1997 wants to merge 1 commit into
foundry-rs:masterfrom
SibghatUllah1997:feat/warn-explicit-network-fork-mismatch
Closed

SibghatUllah1997 wants to merge 1 commit into
foundry-rs:masterfrom
SibghatUllah1997:feat/warn-explicit-network-fork-mismatch

Conversation

@SibghatUllah1997

@SibghatUllah1997 SibghatUllah1997 commented Nov 2, 2026 •

Copy link
Copy Markdown

Closes #17994

Motivation

When --network is passed explicitly, a fork of a chain from a different network family is accepted silently and then executed with the selected network's rules. That's easy to miss and can lead to confusing results, as described in #17994.

Solution

When the network was selected explicitly (so the endpoint family check is not enforced), create_fork now emits a warning if the selected network doesn't support the fork's source network. The warning names the fork's chain ID, the fork's network and the selected network, for example:

fork of chain 1 is a `ethereum` network, but `--network` selected `optimism`; the fork will run with `optimism` rules

It deliberately uses the chain ID rather than the RPC URL so that API keys embedded in URLs are never printed. Behavior is otherwise unchanged; this is a warning only.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@SibghatUllah1997

Copy link
Copy Markdown
Author

Closing in favour of #18037, which also dedups the warning and adds CLI coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(evm): warn when an explicit --network does not match a fork

1 participant