Skip to content

Conflicting NetworkWallet<Optimism> impl for EthereumWallet with alloy 1.8 #19755

@suchapalaver

Description

@suchapalaver

Summary

op-alloy-network fails to compile against alloy 1.8 due to a conflicting NetworkWallet implementation.

Details

Alloy 1.8 introduced a blanket impl in alloy-network:

impl<N: Network> NetworkWallet<N> for EthereumWallet
where
    N::TxEnvelope: From<Signed<N::UnsignedTx>>,
    N::UnsignedTx: SignableTransaction<Signature>,
{ ... }

This conflicts with the manual impl in rust/op-alloy/crates/network/src/lib.rs:

impl NetworkWallet<Optimism> for EthereumWallet { ... }

The compiler error:

error[E0119]: conflicting implementations of trait `alloy_network::NetworkWallet<Optimism>` for type `alloy_network::EthereumWallet`

Proposed Fix

The manual impl can be safely removed because op-alloy-consensus already provides the trait bounds required by the blanket impl:

  • OpTypedTransaction: SignableTransaction<Signature>
  • OpTxEnvelope: From<Signed<OpTypedTransaction>>

The blanket impl delegates signing to SignableTransaction::sign_transaction + into_signed, which produces the same result as the manual variant-by-variant conversion.

The unused imports and the alloy-signer dependency should also be removed as they are only used by the manual impl.

(Previously filed as alloy-rs/op-alloy#627 before the repo was upstreamed.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions