diff --git a/Cargo.lock b/Cargo.lock index 2f27f3b8e..485e539b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8105,6 +8105,7 @@ name = "reth-optimism-rpc" version = "1.0.7" dependencies = [ "alloy-primitives", + "alloy-rpc-types-eth", "derive_more", "jsonrpsee-types", "op-alloy-consensus", @@ -8378,6 +8379,7 @@ dependencies = [ "alloy-network", "alloy-primitives", "alloy-rlp", + "alloy-rpc-types-eth", "async-trait", "derive_more", "futures", @@ -8434,6 +8436,7 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-primitives", + "alloy-rpc-types-eth", "jsonrpsee", "reth-engine-primitives", "reth-network-peers", @@ -8448,6 +8451,7 @@ name = "reth-rpc-api-testing-util" version = "1.0.7" dependencies = [ "alloy-primitives", + "alloy-rpc-types-eth", "futures", "jsonrpsee", "jsonrpsee-http-client", @@ -8466,6 +8470,7 @@ version = "1.0.7" dependencies = [ "alloy-network", "alloy-primitives", + "alloy-rpc-types-eth", "clap", "http", "jsonrpsee", @@ -8552,6 +8557,7 @@ dependencies = [ "alloy-json-rpc", "alloy-network", "alloy-primitives", + "alloy-rpc-types-eth", "async-trait", "auto_impl", "dyn-clone", @@ -8588,6 +8594,7 @@ dependencies = [ "alloy-consensus", "alloy-primitives", "alloy-rpc-types", + "alloy-rpc-types-eth", "alloy-sol-types", "derive_more", "futures", diff --git a/crates/optimism/rpc/Cargo.toml b/crates/optimism/rpc/Cargo.toml index 4f0381b6e..3b8416356 100644 --- a/crates/optimism/rpc/Cargo.toml +++ b/crates/optimism/rpc/Cargo.toml @@ -34,6 +34,7 @@ reth-optimism-forks.workspace = true # ethereum alloy-primitives.workspace = true +alloy-rpc-types-eth.workspace = true op-alloy-network.workspace = true op-alloy-rpc-types.workspace = true op-alloy-consensus.workspace = true diff --git a/crates/optimism/rpc/src/eth/call.rs b/crates/optimism/rpc/src/eth/call.rs index dd9a4f2e8..ded4c656b 100644 --- a/crates/optimism/rpc/src/eth/call.rs +++ b/crates/optimism/rpc/src/eth/call.rs @@ -1,4 +1,5 @@ use alloy_primitives::{Bytes, TxKind, U256}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use reth_chainspec::ChainSpec; use reth_evm::ConfigureEvm; use reth_node_api::{FullNodeComponents, NodeTypes}; @@ -11,7 +12,6 @@ use reth_rpc_eth_api::{ FromEthApiError, IntoEthApiError, }; use reth_rpc_eth_types::{revm_utils::CallFees, RpcInvalidTransactionError}; -use reth_rpc_types::TransactionRequest; use crate::{OpEthApi, OpEthApiError}; diff --git a/crates/rpc/rpc-api/Cargo.toml b/crates/rpc/rpc-api/Cargo.toml index bd51ac997..cbe8f44c2 100644 --- a/crates/rpc/rpc-api/Cargo.toml +++ b/crates/rpc/rpc-api/Cargo.toml @@ -23,6 +23,7 @@ reth-network-peers.workspace = true alloy-eips.workspace = true alloy-json-rpc.workspace = true alloy-primitives.workspace = true +alloy-rpc-types-eth.workspace = true # misc jsonrpsee = { workspace = true, features = ["server", "macros"] } diff --git a/crates/rpc/rpc-api/src/debug.rs b/crates/rpc/rpc-api/src/debug.rs index 0876b464c..d242c0dab 100644 --- a/crates/rpc/rpc-api/src/debug.rs +++ b/crates/rpc/rpc-api/src/debug.rs @@ -1,4 +1,5 @@ use alloy_primitives::{Address, Bytes, B256}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{BlockId, BlockNumberOrTag}; use reth_rpc_types::{ @@ -7,7 +8,7 @@ use reth_rpc_types::{ BlockTraceResult, GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult, }, - Block, Bundle, StateContext, TransactionRequest, + Block, Bundle, StateContext, }; /// Debug rpc interface. diff --git a/crates/rpc/rpc-api/src/engine.rs b/crates/rpc/rpc-api/src/engine.rs index 750c88cdc..0767f12d6 100644 --- a/crates/rpc/rpc-api/src/engine.rs +++ b/crates/rpc/rpc-api/src/engine.rs @@ -6,6 +6,7 @@ use alloy_eips::{eip4844::BlobAndProofV1, BlockId, BlockNumberOrTag}; use alloy_json_rpc::RpcObject; use alloy_primitives::{Address, BlockHash, Bytes, B256, U256, U64}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_engine_primitives::EngineTypes; use reth_rpc_types::{ @@ -16,7 +17,6 @@ use reth_rpc_types::{ }, state::StateOverride, BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log, SyncStatus, - TransactionRequest, }; // NOTE: We can't use associated types in the `EngineApi` trait because of jsonrpsee, so we use a // generic here. It would be nice if the rpc macro would understand which types need to have serde. diff --git a/crates/rpc/rpc-api/src/trace.rs b/crates/rpc/rpc-api/src/trace.rs index 13518c73d..45238200b 100644 --- a/crates/rpc/rpc-api/src/trace.rs +++ b/crates/rpc/rpc-api/src/trace.rs @@ -1,4 +1,5 @@ use alloy_primitives::{Bytes, B256}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::BlockId; use reth_rpc_types::{ @@ -8,7 +9,7 @@ use reth_rpc_types::{ opcode::{BlockOpcodeGas, TransactionOpcodeGas}, parity::*, }, - BlockOverrides, Index, TransactionRequest, + BlockOverrides, Index, }; use std::collections::HashSet; diff --git a/crates/rpc/rpc-builder/Cargo.toml b/crates/rpc/rpc-builder/Cargo.toml index 03915881c..0789e0e16 100644 --- a/crates/rpc/rpc-builder/Cargo.toml +++ b/crates/rpc/rpc-builder/Cargo.toml @@ -69,6 +69,7 @@ reth-node-api.workspace = true reth-rpc-types-compat.workspace = true alloy-primitives.workspace = true +alloy-rpc-types-eth.workspace = true tokio = { workspace = true, features = ["rt", "rt-multi-thread"] } serde_json.workspace = true diff --git a/crates/rpc/rpc-builder/tests/it/http.rs b/crates/rpc/rpc-builder/tests/it/http.rs index d7289d217..3c722eaaf 100644 --- a/crates/rpc/rpc-builder/tests/it/http.rs +++ b/crates/rpc/rpc-builder/tests/it/http.rs @@ -3,6 +3,7 @@ use crate::utils::{launch_http, launch_http_ws, launch_ws}; use alloy_primitives::{hex_literal::hex, Address, Bytes, TxHash, B256, B64, U256, U64}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::{ core::{ client::{ClientT, SubscriptionClientT}, @@ -22,7 +23,7 @@ use reth_rpc_api::{ use reth_rpc_server_types::RethRpcModule; use reth_rpc_types::{ trace::filter::TraceFilter, Block, FeeHistory, Filter, Index, Log, - PendingTransactionFilterKind, SyncStatus, Transaction, TransactionReceipt, TransactionRequest, + PendingTransactionFilterKind, SyncStatus, Transaction, TransactionReceipt, }; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; diff --git a/crates/rpc/rpc-eth-api/Cargo.toml b/crates/rpc/rpc-eth-api/Cargo.toml index 60762ba86..e008f5161 100644 --- a/crates/rpc/rpc-eth-api/Cargo.toml +++ b/crates/rpc/rpc-eth-api/Cargo.toml @@ -37,6 +37,7 @@ alloy-dyn-abi = { workspace = true, features = ["eip712"] } alloy-json-rpc.workspace = true alloy-network.workspace = true alloy-primitives.workspace = true +alloy-rpc-types-eth.workspace = true # rpc jsonrpsee = { workspace = true, features = ["server", "macros"] } diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 0c040a312..64a37e2d1 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -3,6 +3,7 @@ use alloy_dyn_abi::TypedData; use alloy_json_rpc::RpcObject; use alloy_primitives::{Address, Bytes, B256, B64, U256, U64}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{transaction::AccessListResult, BlockId, BlockNumberOrTag}; use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult}; @@ -11,7 +12,7 @@ use reth_rpc_types::{ simulate::{SimulatePayload, SimulatedBlock}, state::{EvmOverrides, StateOverride}, BlockOverrides, Bundle, EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Header, - Index, StateContext, SyncStatus, TransactionRequest, Work, + Index, StateContext, SyncStatus, Work, }; use tracing::trace; diff --git a/crates/rpc/rpc-eth-api/src/helpers/call.rs b/crates/rpc/rpc-eth-api/src/helpers/call.rs index ee9dad9b6..19148bfdf 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/call.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/call.rs @@ -5,6 +5,7 @@ use crate::{ AsEthApiError, FromEthApiError, FromEvmError, FullEthApiTypes, IntoEthApiError, RpcBlock, }; use alloy_primitives::{Bytes, TxKind, B256, U256}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use futures::Future; use reth_chainspec::MIN_TRANSACTION_GAS; use reth_evm::{ConfigureEvm, ConfigureEvmEnv}; @@ -33,7 +34,7 @@ use reth_rpc_server_types::constants::gas_oracle::{CALL_STIPEND_GAS, ESTIMATE_GA use reth_rpc_types::{ simulate::{SimBlock, SimulatePayload, SimulatedBlock}, state::{EvmOverrides, StateOverride}, - BlockId, Bundle, EthCallResponse, StateContext, TransactionInfo, TransactionRequest, + BlockId, Bundle, EthCallResponse, StateContext, TransactionInfo, }; use revm::{Database, DatabaseCommit, GetInspector}; use revm_inspectors::{access_list::AccessListInspector, transfer::TransferInspector}; diff --git a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs index a12ef7012..1d0d1c4c8 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs @@ -3,6 +3,7 @@ use alloy_dyn_abi::TypedData; use alloy_primitives::{Address, Bytes, TxHash, TxKind, B256, U256}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use futures::Future; use reth_primitives::{ BlockId, Receipt, SealedBlockWithSenders, TransactionMeta, TransactionSigned, @@ -17,7 +18,7 @@ use reth_rpc_types::{ EIP1559TransactionRequest, EIP2930TransactionRequest, EIP4844TransactionRequest, LegacyTransactionRequest, }, - BlockNumberOrTag, TransactionInfo, TransactionRequest, TypedTransactionRequest, + BlockNumberOrTag, TransactionInfo, TypedTransactionRequest, }; use reth_rpc_types_compat::transaction::{from_recovered, from_recovered_with_block_context}; use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool}; diff --git a/crates/rpc/rpc-eth-types/Cargo.toml b/crates/rpc/rpc-eth-types/Cargo.toml index d5db4b1c9..2d33edac7 100644 --- a/crates/rpc/rpc-eth-types/Cargo.toml +++ b/crates/rpc/rpc-eth-types/Cargo.toml @@ -32,6 +32,7 @@ reth-trie.workspace = true alloy-primitives.workspace = true alloy-consensus.workspace = true alloy-sol-types.workspace = true +alloy-rpc-types-eth.workspace = true revm.workspace = true revm-inspectors.workspace = true revm-primitives = { workspace = true, features = ["dev"] } diff --git a/crates/rpc/rpc-eth-types/src/revm_utils.rs b/crates/rpc/rpc-eth-types/src/revm_utils.rs index 0e1cb9d7d..6a8ef76ec 100644 --- a/crates/rpc/rpc-eth-types/src/revm_utils.rs +++ b/crates/rpc/rpc-eth-types/src/revm_utils.rs @@ -66,7 +66,7 @@ where .unwrap_or_default()) } -/// Helper type for representing the fees of a [`reth_rpc_types::TransactionRequest`] +/// Helper type for representing the fees of a `TransactionRequest` #[derive(Debug)] pub struct CallFees { /// EIP-1559 priority fee @@ -85,7 +85,7 @@ pub struct CallFees { // === impl CallFees === impl CallFees { - /// Ensures the fields of a [`reth_rpc_types::TransactionRequest`] are not conflicting. + /// Ensures the fields of a `TransactionRequest` are not conflicting. /// /// # EIP-4844 transactions /// diff --git a/crates/rpc/rpc-eth-types/src/simulate.rs b/crates/rpc/rpc-eth-types/src/simulate.rs index 5160982ea..4ce214ccc 100644 --- a/crates/rpc/rpc-eth-types/src/simulate.rs +++ b/crates/rpc/rpc-eth-types/src/simulate.rs @@ -1,6 +1,7 @@ //! Utilities for serving `eth_simulateV1` use alloy_consensus::{TxEip4844Variant, TxType, TypedTransaction}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee_types::ErrorObject; use reth_primitives::{ logs_bloom, @@ -11,7 +12,7 @@ use reth_revm::database::StateProviderDatabase; use reth_rpc_server_types::result::rpc_err; use reth_rpc_types::{ simulate::{SimCallResult, SimulateError, SimulatedBlock}, - Block, BlockTransactionsKind, ToRpcError, TransactionRequest, + Block, BlockTransactionsKind, ToRpcError, }; use reth_rpc_types_compat::{block::from_block, TransactionCompat}; use reth_storage_api::StateRootProvider; diff --git a/crates/rpc/rpc-testing-util/Cargo.toml b/crates/rpc/rpc-testing-util/Cargo.toml index 59672595d..3c041bb49 100644 --- a/crates/rpc/rpc-testing-util/Cargo.toml +++ b/crates/rpc/rpc-testing-util/Cargo.toml @@ -19,6 +19,7 @@ reth-rpc-api = { workspace = true, features = ["client"] } # ethereum alloy-primitives.workspace = true +alloy-rpc-types-eth.workspace = true # async futures.workspace = true diff --git a/crates/rpc/rpc-testing-util/src/debug.rs b/crates/rpc/rpc-testing-util/src/debug.rs index 0ec5311fe..b52ac3e26 100644 --- a/crates/rpc/rpc-testing-util/src/debug.rs +++ b/crates/rpc/rpc-testing-util/src/debug.rs @@ -7,6 +7,7 @@ use std::{ }; use alloy_primitives::{TxHash, B256}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use futures::{Stream, StreamExt}; use jsonrpsee::core::client::Error as RpcError; use reth_primitives::{BlockId, Receipt}; @@ -16,7 +17,7 @@ use reth_rpc_types::{ common::TraceResult, geth::{GethDebugTracerType, GethDebugTracingOptions, GethTrace}, }, - Block, Transaction, TransactionRequest, + Block, Transaction, }; const NOOP_TRACER: &str = include_str!("../assets/noop-tracer.js"); diff --git a/crates/rpc/rpc-testing-util/src/trace.rs b/crates/rpc/rpc-testing-util/src/trace.rs index 5a1843935..d75779c84 100644 --- a/crates/rpc/rpc-testing-util/src/trace.rs +++ b/crates/rpc/rpc-testing-util/src/trace.rs @@ -1,6 +1,7 @@ //! Helpers for testing trace calls. use alloy_primitives::{Bytes, TxHash, B256}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use futures::{Stream, StreamExt}; use jsonrpsee::core::client::Error as RpcError; use reth_primitives::BlockId; @@ -11,7 +12,7 @@ use reth_rpc_types::{ parity::{LocalizedTransactionTrace, TraceResults, TraceType}, tracerequest::TraceCallRequest, }, - Index, TransactionRequest, + Index, }; use std::{ collections::HashSet, diff --git a/crates/rpc/rpc-types/src/eth/transaction/mod.rs b/crates/rpc/rpc-types/src/eth/transaction/mod.rs index b7a9ab73f..d29411965 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/mod.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/mod.rs @@ -1,5 +1,3 @@ //! RPC types for transactions -mod request; mod typed; -pub use request::TransactionRequest; pub use typed::*; diff --git a/crates/rpc/rpc-types/src/eth/transaction/request.rs b/crates/rpc/rpc-types/src/eth/transaction/request.rs deleted file mode 100644 index 831718f35..000000000 --- a/crates/rpc/rpc-types/src/eth/transaction/request.rs +++ /dev/null @@ -1 +0,0 @@ -pub use alloy_rpc_types::request::TransactionRequest; diff --git a/crates/rpc/rpc-types/src/eth/transaction/typed.rs b/crates/rpc/rpc-types/src/eth/transaction/typed.rs index e3d70d354..578bb2cb0 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/typed.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/typed.rs @@ -1,7 +1,3 @@ -//! The [`TransactionRequest`][crate::TransactionRequest] is a universal representation for a -//! transaction deserialized from the json input of an RPC call. Depending on what fields are set, -//! it can be converted into the container type [`TypedTransactionRequest`]. - use alloy_primitives::{Address, Bytes, TxKind, B256, U256}; use alloy_rpc_types::{AccessList, BlobTransactionSidecar}; diff --git a/crates/rpc/rpc-types/src/lib.rs b/crates/rpc/rpc-types/src/lib.rs index dc0eb3dec..cb7237ce2 100644 --- a/crates/rpc/rpc-types/src/lib.rs +++ b/crates/rpc/rpc-types/src/lib.rs @@ -52,7 +52,7 @@ pub use alloy_rpc_types_debug as debug; // Ethereum specific rpc types related to typed transaction requests and the engine API. #[cfg(feature = "jsonrpsee-types")] pub use eth::error::ToRpcError; -pub use eth::transaction::{self, TransactionRequest, TypedTransactionRequest}; +pub use eth::transaction::{self, TypedTransactionRequest}; #[cfg(feature = "jsonrpsee-types")] pub use eth::{ engine, diff --git a/crates/rpc/rpc/Cargo.toml b/crates/rpc/rpc/Cargo.toml index 9f8235725..d69596a6a 100644 --- a/crates/rpc/rpc/Cargo.toml +++ b/crates/rpc/rpc/Cargo.toml @@ -42,6 +42,7 @@ alloy-genesis.workspace = true alloy-network.workspace = true alloy-primitives.workspace = true alloy-rlp.workspace = true +alloy-rpc-types-eth.workspace = true revm = { workspace = true, features = [ "optional_block_gas_limit", "optional_eip3607", diff --git a/crates/rpc/rpc/src/debug.rs b/crates/rpc/rpc/src/debug.rs index 8e4078ea4..e3f0f47b3 100644 --- a/crates/rpc/rpc/src/debug.rs +++ b/crates/rpc/rpc/src/debug.rs @@ -1,5 +1,6 @@ use alloy_primitives::{Address, Bytes, B256, U256}; use alloy_rlp::{Decodable, Encodable}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use async_trait::async_trait; use jsonrpsee::core::RpcResult; use reth_chainspec::{ChainSpec, EthereumHardforks}; @@ -27,7 +28,7 @@ use reth_rpc_types::{ BlockTraceResult, FourByteFrame, GethDebugBuiltInTracerType, GethDebugTracerType, GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, NoopFrame, TraceResult, }, - Block as RpcBlock, BlockError, Bundle, StateContext, TransactionRequest, + Block as RpcBlock, BlockError, Bundle, StateContext, }; use reth_tasks::pool::BlockingTaskGuard; use reth_trie::{HashedPostState, HashedStorage}; diff --git a/crates/rpc/rpc/src/engine.rs b/crates/rpc/rpc/src/engine.rs index c646d6809..40b0a9adf 100644 --- a/crates/rpc/rpc/src/engine.rs +++ b/crates/rpc/rpc/src/engine.rs @@ -1,4 +1,5 @@ use alloy_primitives::{Address, Bytes, B256, U256, U64}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::core::RpcResult as Result; use reth_primitives::{BlockId, BlockNumberOrTag}; use reth_rpc_api::{EngineEthApiServer, EthApiServer, EthFilterApiServer}; @@ -7,7 +8,7 @@ pub use reth_rpc_engine_api::EngineApi; use reth_rpc_eth_api::{FullEthApiTypes, RpcBlock, RpcReceipt, RpcTransaction}; use reth_rpc_types::{ state::StateOverride, BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log, - SyncStatus, TransactionRequest, + SyncStatus, }; use tracing_futures::Instrument; diff --git a/crates/rpc/rpc/src/trace.rs b/crates/rpc/rpc/src/trace.rs index 83e41d9a9..ee543ecc9 100644 --- a/crates/rpc/rpc/src/trace.rs +++ b/crates/rpc/rpc/src/trace.rs @@ -1,6 +1,7 @@ use std::{collections::HashSet, sync::Arc}; use alloy_primitives::{Bytes, B256, U256}; +use alloy_rpc_types_eth::transaction::TransactionRequest; use async_trait::async_trait; use jsonrpsee::core::RpcResult; use reth_chainspec::{ChainSpec, EthereumHardforks}; @@ -25,7 +26,7 @@ use reth_rpc_types::{ parity::*, tracerequest::TraceCallRequest, }, - BlockOverrides, Index, TransactionRequest, + BlockOverrides, Index, }; use reth_tasks::pool::BlockingTaskGuard; use revm::{