Skip to content

refactor: move OP EVM code into alloy-op-evm newtypes#19533

Closed
theochap wants to merge 1 commit intoethereum-optimism:developfrom
theochap:theo/op-evm-newtypes
Closed

refactor: move OP EVM code into alloy-op-evm newtypes#19533
theochap wants to merge 1 commit intoethereum-optimism:developfrom
theochap:theo/op-evm-newtypes

Conversation

@theochap
Copy link
Copy Markdown
Member

Summary

  • Introduce OpTx and OpTxError newtype wrappers in alloy-op-evm to hold all OP-specific EVM implementations previously in alloy-evm's op module
  • Move spec ID mapping and EvmEnv constructors as free functions (evm_env_for_op_block, evm_env_for_op_next_block)
  • Add TryIntoTxEnv<OpTx> for OpTransactionRequest behind rpc feature
  • Add TransactionEnv impl for OpTx behind reth feature
  • Update op-reth, kona, and custom-node example to use new types
  • Remove alloy-evm op feature usage from kona crates

This is the companion PR to alloy-rs/evm#312 which removes the OP-specific code from alloy-evm. Together they decouple alloy-evm from Optimism, using newtype wrappers to satisfy Rust's orphan rule.

Test plan

  • cargo clippy passes with no warnings
  • cargo test -p alloy-op-evm — 24 tests pass
  • Full workspace cargo check passes

🤖 Generated with Claude Code

@theochap theochap requested a review from a team as a code owner March 13, 2026 17:35
@wiz-inc-a178a98b5d
Copy link
Copy Markdown

wiz-inc-a178a98b5d bot commented Mar 13, 2026

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities 1 Medium 2 Low
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total 1 Medium 2 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

Introduce OpTx and OpTxError newtype wrappers in alloy-op-evm to hold
all OP-specific EVM implementations that were previously in alloy-evm's
`op` module. This satisfies Rust's orphan rule while decoupling alloy-evm
from Optimism-specific dependencies.

Changes:
- Add OpTx newtype wrapping OpTransaction<TxEnv> with all necessary trait
  impls (Transaction, TransactionEnv, FromRecoveredTx, FromTxWithEncoded,
  IntoTxEnv, OpTxEnv, TryIntoTxEnv)
- Add OpTxError newtype wrapping OpTransactionError with InvalidTxError
  and map_op_err helper
- Move spec ID mapping and EvmEnv constructors as free functions
  (evm_env_for_op_block, evm_env_for_op_next_block, evm_env_for_op_payload)
- Add rpc module with TryIntoTxEnv<OpTx> for OpTransactionRequest
- Update all downstream crates (op-reth, kona, custom-node example)
- Remove alloy-evm "op" feature usage from kona crates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@theochap theochap force-pushed the theo/op-evm-newtypes branch from d0717ee to cf8487f Compare March 13, 2026 18:02
@theochap theochap closed this Mar 13, 2026
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.

1 participant