Skip to content

feat(evm): Backend generic network#13579

Merged
zerosnacks merged 9 commits intofoundry-rs:masterfrom
mablr:feature/evm_backend_generic_network
Mar 24, 2026
Merged

feat(evm): Backend generic network#13579
zerosnacks merged 9 commits intofoundry-rs:masterfrom
mablr:feature/evm_backend_generic_network

Conversation

@mablr
Copy link
Copy Markdown
Collaborator

@mablr mablr commented Mar 2, 2026

Description

@mablr mablr force-pushed the feature/evm_backend_generic_network branch from d5c5ca8 to 92c4b51 Compare March 13, 2026 13:54
@mablr mablr marked this pull request as ready for review March 13, 2026 14:00
@zerosnacks
Copy link
Copy Markdown
Member

Small test failure, looks to be a regression in default/repros/Issue4232.t.sol:Issue4232Test:

[FAIL: vm.createSelectFork: could not instantiate forked environment with provider moonbeam-rpc.publicnode.com; deserialization error: missing field `mixHash` at line 1 column 2970

mablr added 2 commits March 14, 2026 01:00
…chains

When forking non-standard EVM chains (e.g. Moonbeam, Arbitrum), their block headers may lack standard Ethereum fields like `mixHash`. Using the generic `N`-typed provider (defaulting to `Ethereum`) caused deserialization failures for these chains.
Copy link
Copy Markdown
Collaborator Author

@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.

When forking non-standard EVM chains (e.g. Moonbeam, Arbitrum), their block headers may lack standard Ethereum fields.

It's hacky to go back to AnyNetwork as default since we can't recover generically TxEnv from AnyTxEnvelope. A simple workaround is to spawn an AnyNetwork provider on init just to get the evm_env, and then continue with generic one.

Comment thread crates/evm/core/src/fork/multi.rs Outdated
@mablr mablr marked this pull request as draft March 16, 2026 10:41
mablr and others added 4 commits March 18, 2026 15:10
… conversion

Introduces TryAnyIntoTxEnv trait in foundry-evm-core to replace the
TxEnv: FromRecoveredTx<N::TxEnvelope> bound on Backend<N>. This allows
Backend to default to AnyNetwork:

- TxEnvelope (Ethereum): delegates to FromRecoveredTx directly
- AnyTxEnvelope: extracts inner TxEnvelope via as_envelope(), then
  delegates to FromRecoveredTx; returns error for unknown tx types

Co-authored-by: Amp <amp@ampcode.com>
@mablr mablr marked this pull request as ready for review March 20, 2026 18:09
@mablr mablr requested a review from 0xrusowsky March 20, 2026 18:18
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.

i think that works now. thoughts @zerosnacks ?

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.

Makes sense 👍

@zerosnacks zerosnacks merged commit e48acd5 into foundry-rs:master Mar 24, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Mar 24, 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.

3 participants