diff --git a/Cargo.lock b/Cargo.lock index b3cd1538507c..d29eb2810fe5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -188,6 +188,8 @@ dependencies = [ "arbitrary", "c-kzg", "derive_more 1.0.0", + "ethereum_ssz", + "ethereum_ssz_derive", "once_cell", "serde", "sha2 0.10.8", @@ -488,6 +490,8 @@ dependencies = [ "alloy-rlp", "alloy-serde", "derive_more 1.0.0", + "ethereum_ssz", + "ethereum_ssz_derive", "jsonrpsee-types", "jsonwebtoken", "rand 0.8.5", @@ -2665,6 +2669,47 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ethereum_serde_utils" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70cbccfccf81d67bff0ab36e591fa536c8a935b078a7b0e58c1d00d418332fc9" +dependencies = [ + "alloy-primitives", + "hex", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "ethereum_ssz" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfbba28f4f3f32d92c06a64f5bf6c4537b5d4e21f28c689bd2bbaecfea4e0d3e" +dependencies = [ + "alloy-primitives", + "derivative", + "ethereum_serde_utils", + "itertools 0.13.0", + "serde", + "serde_derive", + "smallvec", + "typenum", +] + +[[package]] +name = "ethereum_ssz_derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d37845ba7c16bf4be8be4b5786f03a2ba5f2fda0d7f9e7cb2282f69cff420d7" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -5157,8 +5202,7 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "op-alloy-consensus" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea7162170c6f3cad8f67f4dd7108e3f78349fd553da5b8bebff1e7ef8f38896" +source = "git+https://github.com/alloy-rs/op-alloy.git?branch=main#20eb16233c00087827f70d6b4a42afb79dc39da9" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5175,8 +5219,7 @@ dependencies = [ [[package]] name = "op-alloy-genesis" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3d31dfbbd8dd898c7512f8ce7d30103980485416f668566100b0ed0994b958" +source = "git+https://github.com/alloy-rs/op-alloy.git?branch=main#20eb16233c00087827f70d6b4a42afb79dc39da9" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5189,8 +5232,7 @@ dependencies = [ [[package]] name = "op-alloy-network" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d113b325527ba7da271a8793f1c14bdf7f035ce9e0611e668c36fc6812568c7f" +source = "git+https://github.com/alloy-rs/op-alloy.git?branch=main#20eb16233c00087827f70d6b4a42afb79dc39da9" dependencies = [ "alloy-consensus", "alloy-network", @@ -5203,8 +5245,7 @@ dependencies = [ [[package]] name = "op-alloy-protocol" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310873e4fbfc41986716c4fb6000a8b49d025d932d2c261af58271c434b05288" +source = "git+https://github.com/alloy-rs/op-alloy.git?branch=main#20eb16233c00087827f70d6b4a42afb79dc39da9" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5220,8 +5261,7 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "323c65880e2561aa87f74f8af260fd15b9cc930c448c88a60ae95af86c88c634" +source = "git+https://github.com/alloy-rs/op-alloy.git?branch=main#20eb16233c00087827f70d6b4a42afb79dc39da9" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5237,15 +5277,16 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types-engine" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349e7b420f45d1a00216ec4c65fcf3f0057a841bc39732c405c85ae782b94121" +source = "git+https://github.com/alloy-rs/op-alloy.git?branch=main#20eb16233c00087827f70d6b4a42afb79dc39da9" dependencies = [ "alloy-primitives", "alloy-rpc-types-engine", "alloy-serde", "derive_more 1.0.0", + "ethereum_ssz", "op-alloy-protocol", "serde", + "snap", ] [[package]] @@ -8192,6 +8233,7 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", + "op-alloy-consensus", "op-alloy-rpc-types-engine", "reth-basic-payload-builder", "reth-chain-state", diff --git a/Cargo.toml b/Cargo.toml index e3ec1c1fb4a6..e4518c1b486b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -461,10 +461,15 @@ alloy-transport-ipc = { version = "0.4.2", default-features = false } alloy-transport-ws = { version = "0.4.2", default-features = false } # op -op-alloy-rpc-types = "0.4" -op-alloy-rpc-types-engine = "0.4" -op-alloy-network = "0.4" -op-alloy-consensus = "0.4" +op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy.git", branch = "main"} +op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy.git", branch = "main"} +op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy.git", branch = "main"} +op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy.git", branch = "main"} +#op-alloy-rpc-types = "0.4.0" +#op-alloy-rpc-types-engine = "0.4.0" +#op-alloy-network = "0.4.0" +#op-alloy-consensus = "0.4.0" + # misc aquamarine = "0.5" diff --git a/crates/optimism/evm/src/execute.rs b/crates/optimism/evm/src/execute.rs index ee0d028e4251..963f8a66f4a7 100644 --- a/crates/optimism/evm/src/execute.rs +++ b/crates/optimism/evm/src/execute.rs @@ -4,6 +4,7 @@ use crate::{ l1::ensure_create2_deployer, OpChainSpec, OptimismBlockExecutionError, OptimismEvmConfig, }; use alloy_primitives::{BlockNumber, U256}; +use op_alloy_consensus::DepositTransaction; use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_evm::{ execute::{ diff --git a/crates/optimism/payload/Cargo.toml b/crates/optimism/payload/Cargo.toml index 414b2c358118..f5b3f4425f2e 100644 --- a/crates/optimism/payload/Cargo.toml +++ b/crates/optimism/payload/Cargo.toml @@ -39,6 +39,7 @@ alloy-eips.workspace = true alloy-primitives.workspace = true alloy-rlp.workspace = true op-alloy-rpc-types-engine.workspace = true +op-alloy-consensus.workspace = true revm-primitives.workspace = true alloy-rpc-types-engine.workspace = true @@ -54,3 +55,5 @@ optimism = [ "reth-optimism-evm/optimism", "reth-revm/optimism", ] + + diff --git a/crates/optimism/payload/src/builder.rs b/crates/optimism/payload/src/builder.rs index 0a8dcdb12449..19999b655eba 100644 --- a/crates/optimism/payload/src/builder.rs +++ b/crates/optimism/payload/src/builder.rs @@ -36,6 +36,7 @@ use crate::{ error::OptimismPayloadBuilderError, payload::{OptimismBuiltPayload, OptimismPayloadBuilderAttributes}, }; +use op_alloy_consensus::DepositTransaction; /// Optimism's payload builder #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/crates/optimism/rpc/src/eth/receipt.rs b/crates/optimism/rpc/src/eth/receipt.rs index 200b626d8c3a..3304deba3dc8 100644 --- a/crates/optimism/rpc/src/eth/receipt.rs +++ b/crates/optimism/rpc/src/eth/receipt.rs @@ -2,7 +2,9 @@ use alloy_eips::eip2718::Encodable2718; use alloy_rpc_types::{AnyReceiptEnvelope, Log, TransactionReceipt}; -use op_alloy_consensus::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope}; +use op_alloy_consensus::{ + DepositTransaction, OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope, +}; use op_alloy_rpc_types::{receipt::L1BlockInfo, OpTransactionReceipt, OpTransactionReceiptFields}; use reth_node_api::{FullNodeComponents, NodeTypes}; use reth_optimism_chainspec::OpChainSpec; diff --git a/crates/optimism/rpc/src/eth/transaction.rs b/crates/optimism/rpc/src/eth/transaction.rs index 36556905e8ac..1afd5bad1c5a 100644 --- a/crates/optimism/rpc/src/eth/transaction.rs +++ b/crates/optimism/rpc/src/eth/transaction.rs @@ -2,6 +2,7 @@ use alloy_primitives::{Bytes, B256}; use alloy_rpc_types::TransactionInfo; +use op_alloy_consensus::DepositTransaction; use op_alloy_rpc_types::Transaction; use reth_node_api::FullNodeComponents; use reth_primitives::TransactionSignedEcRecovered; diff --git a/crates/primitives/src/transaction/compat.rs b/crates/primitives/src/transaction/compat.rs index 81281186f64c..883c89c45f51 100644 --- a/crates/primitives/src/transaction/compat.rs +++ b/crates/primitives/src/transaction/compat.rs @@ -1,5 +1,7 @@ use crate::{Transaction, TransactionSigned}; use alloy_primitives::{Address, TxKind, U256}; +#[cfg(feature = "optimism")] +use op_alloy_consensus::DepositTransaction; use revm_primitives::{AuthorizationList, TxEnv}; /// Implements behaviour to fill a [`TxEnv`] from another transaction. diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index 0463cd9ea7e1..7f8118b87f9a 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -472,42 +472,6 @@ impl Transaction { } } - /// Returns the source hash of the transaction, which uniquely identifies its source. - /// If not a deposit transaction, this will always return `None`. - #[cfg(feature = "optimism")] - pub const fn source_hash(&self) -> Option { - match self { - Self::Deposit(TxDeposit { source_hash, .. }) => Some(*source_hash), - _ => None, - } - } - - /// Returns the amount of ETH locked up on L1 that will be minted on L2. If the transaction - /// is not a deposit transaction, this will always return `None`. - #[cfg(feature = "optimism")] - pub const fn mint(&self) -> Option { - match self { - Self::Deposit(TxDeposit { mint, .. }) => *mint, - _ => None, - } - } - - /// Returns whether or not the transaction is a system transaction. If the transaction - /// is not a deposit transaction, this will always return `false`. - #[cfg(feature = "optimism")] - pub const fn is_system_transaction(&self) -> bool { - match self { - Self::Deposit(TxDeposit { is_system_transaction, .. }) => *is_system_transaction, - _ => false, - } - } - - /// Returns whether or not the transaction is an Optimism Deposited transaction. - #[cfg(feature = "optimism")] - pub const fn is_deposit(&self) -> bool { - matches!(self, Self::Deposit(_)) - } - /// This encodes the transaction _without_ the signature, and is only suitable for creating a /// hash intended for signing. pub fn encode_without_signature(&self, out: &mut dyn bytes::BufMut) {