fix(cast): use FoundryNetwork for RPC provider in cast run#14211
Closed
decofe wants to merge 1 commit into
Closed
Conversation
`cast run` on OP Stack chains (Base, Optimism) fails with: `data did not match any variant of untagged enum BlockTransactions` Root cause: the generic `FoundryEvmNetwork` refactor (PR #14121) changed `cast run` from using `AnyNetwork` to dispatching via `FEN::Network`. Non-Tempo chains use `EthEvmNetwork` whose `Network = Ethereum`, which cannot deserialize OP deposit transactions (type 0x7e). Fix: decouple the RPC provider network type from the EVM factory by making `run_with_provider` generic over both `FEN` (EVM factory) and `N` (provider network). The dispatch in `run()` now detects OP Stack chains early via `is_optimism()` and uses `FoundryNetwork` as the provider network, which supports all transaction types including OP deposits. Co-Authored-By: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
5365a1a to
69b520d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
cast runfailing on OP Stack chains (Base, Optimism) with:Observed in nightly CI:
Motivation
The generic
FoundryEvmNetworkrefactor (#14121) changedcast runfrom usingAnyNetworkto dispatching viaFEN::Network. Non-Tempo chains useEthEvmNetworkwhoseNetwork = Ethereum, which cannot deserialize OP deposit transactions (type0x7e). Whencast runfetches a full block from Base or Optimism, the block contains deposit transactions thatEthereum'sTxEnvelopecan't parse.Changes
Decouples the RPC provider network type from the EVM factory by making
run_with_providergeneric over bothFEN(EVM factory) andN(provider network). The dispatch inrun()detects OP Stack chains early viais_optimism()and usesFoundryNetworkas the provider network.crates/cast/src/cmd/run.rs: Renamerun_with_evm→run_with_provider<FEN, N>, add OP detection branchcrates/cast/Cargo.toml: Addfoundry-primitivesdependencyTesting
cargo checkpassesflaky_osaka_can_run_p256_precompile(Base) andflaky_test_non_mainnet_traces(Optimism)Prompted by: zerosnacks