diff --git a/Cargo.lock b/Cargo.lock index 1178b5473..2ae6d14a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2712,6 +2712,7 @@ name = "example-custom-engine-types" version = "0.0.0" dependencies = [ "alloy-genesis", + "alloy-rpc-types", "eyre", "reth", "reth-basic-payload-builder", @@ -2750,6 +2751,7 @@ dependencies = [ name = "example-custom-inspector" version = "0.0.0" dependencies = [ + "alloy-rpc-types", "clap", "futures-util", "reth", @@ -2809,6 +2811,7 @@ dependencies = [ name = "example-db-access" version = "0.0.0" dependencies = [ + "alloy-rpc-types", "eyre", "reth-chainspec", "reth-db", @@ -6644,6 +6647,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-provider", + "alloy-rpc-types", "auto_impl", "eyre", "futures", @@ -8106,6 +8110,7 @@ name = "reth-optimism-rpc" version = "1.0.7" dependencies = [ "alloy-primitives", + "alloy-rpc-types", "alloy-rpc-types-eth", "derive_more", "jsonrpsee-types", @@ -8128,7 +8133,6 @@ dependencies = [ "reth-rpc-eth-api", "reth-rpc-eth-types", "reth-rpc-server-types", - "reth-rpc-types", "reth-tasks", "reth-transaction-pool", "revm", @@ -8381,6 +8385,7 @@ dependencies = [ "alloy-network", "alloy-primitives", "alloy-rlp", + "alloy-rpc-types", "alloy-rpc-types-debug", "alloy-rpc-types-eth", "alloy-rpc-types-mev", @@ -8442,6 +8447,7 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-primitives", + "alloy-rpc-types", "alloy-rpc-types-anvil", "alloy-rpc-types-debug", "alloy-rpc-types-eth", @@ -8462,6 +8468,7 @@ name = "reth-rpc-api-testing-util" version = "1.0.7" dependencies = [ "alloy-primitives", + "alloy-rpc-types", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "futures", @@ -8470,7 +8477,6 @@ dependencies = [ "reth-primitives", "reth-rpc-api", "reth-rpc-eth-api", - "reth-rpc-types", "serde_json", "similar-asserts", "tokio", @@ -8482,6 +8488,7 @@ version = "1.0.7" dependencies = [ "alloy-network", "alloy-primitives", + "alloy-rpc-types", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "clap", @@ -8570,6 +8577,7 @@ dependencies = [ "alloy-json-rpc", "alloy-network", "alloy-primitives", + "alloy-rpc-types", "alloy-rpc-types-eth", "alloy-rpc-types-mev", "async-trait", diff --git a/crates/consensus/debug-client/Cargo.toml b/crates/consensus/debug-client/Cargo.toml index bb31de5be..8a03c0527 100644 --- a/crates/consensus/debug-client/Cargo.toml +++ b/crates/consensus/debug-client/Cargo.toml @@ -23,6 +23,7 @@ reth-tracing.workspace = true alloy-consensus = { workspace = true, features = ["serde"] } alloy-eips.workspace = true alloy-provider = { workspace = true, features = ["ws"] } +alloy-rpc-types.workspace = true auto_impl.workspace = true futures.workspace = true diff --git a/crates/consensus/debug-client/src/client.rs b/crates/consensus/debug-client/src/client.rs index 5e70e120b..eec1b5b99 100644 --- a/crates/consensus/debug-client/src/client.rs +++ b/crates/consensus/debug-client/src/client.rs @@ -1,9 +1,10 @@ use alloy_consensus::TxEnvelope; use alloy_eips::eip2718::Encodable2718; +use alloy_rpc_types::{Block, BlockTransactions}; use reth_node_api::EngineTypes; use reth_node_core::{ primitives::B256, - rpc::types::{Block, BlockTransactions, ExecutionPayloadV2, ExecutionPayloadV3}, + rpc::types::{ExecutionPayloadV2, ExecutionPayloadV3}, }; use reth_rpc_builder::auth::AuthServerHandle; use reth_rpc_types::ExecutionPayloadV1; diff --git a/crates/consensus/debug-client/src/providers/etherscan.rs b/crates/consensus/debug-client/src/providers/etherscan.rs index c6955a20d..59b402f3e 100644 --- a/crates/consensus/debug-client/src/providers/etherscan.rs +++ b/crates/consensus/debug-client/src/providers/etherscan.rs @@ -1,7 +1,7 @@ use crate::BlockProvider; use alloy_eips::BlockNumberOrTag; +use alloy_rpc_types::Block; use reqwest::Client; -use reth_node_core::rpc::types::Block; use reth_tracing::tracing::warn; use serde::Deserialize; use std::time::Duration; diff --git a/crates/consensus/debug-client/src/providers/rpc.rs b/crates/consensus/debug-client/src/providers/rpc.rs index 088ec9652..a8cd15c10 100644 --- a/crates/consensus/debug-client/src/providers/rpc.rs +++ b/crates/consensus/debug-client/src/providers/rpc.rs @@ -1,9 +1,8 @@ use crate::BlockProvider; use alloy_eips::BlockNumberOrTag; use alloy_provider::{Provider, ProviderBuilder}; +use alloy_rpc_types::{Block, BlockTransactionsKind}; use futures::StreamExt; -use reth_node_core::rpc::types::Block; -use reth_rpc_types::BlockTransactionsKind; use tokio::sync::mpsc::Sender; /// Block provider that fetches new blocks from an RPC endpoint using a websocket connection. diff --git a/crates/optimism/rpc/Cargo.toml b/crates/optimism/rpc/Cargo.toml index 3b8416356..443830cc5 100644 --- a/crates/optimism/rpc/Cargo.toml +++ b/crates/optimism/rpc/Cargo.toml @@ -19,7 +19,6 @@ reth-provider.workspace = true reth-rpc-eth-api.workspace = true reth-rpc-eth-types.workspace = true reth-rpc-server-types.workspace = true -reth-rpc-types.workspace = true reth-tasks = { workspace = true, features = ["rayon"] } reth-transaction-pool.workspace = true reth-rpc.workspace = true @@ -35,6 +34,7 @@ reth-optimism-forks.workspace = true # ethereum alloy-primitives.workspace = true alloy-rpc-types-eth.workspace = true +alloy-rpc-types.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/error.rs b/crates/optimism/rpc/src/error.rs index 2d9cd559c..35bc14798 100644 --- a/crates/optimism/rpc/src/error.rs +++ b/crates/optimism/rpc/src/error.rs @@ -1,12 +1,12 @@ //! RPC errors specific to OP. +use alloy_rpc_types::error::EthRpcErrorCode; use jsonrpsee_types::error::INTERNAL_ERROR_CODE; use reth_evm_optimism::OptimismBlockExecutionError; use reth_primitives::revm_primitives::{InvalidTransaction, OptimismInvalidTransaction}; use reth_rpc_eth_api::AsEthApiError; use reth_rpc_eth_types::EthApiError; use reth_rpc_server_types::result::{internal_rpc_err, rpc_err}; -use reth_rpc_types::error::EthRpcErrorCode; /// Optimism specific errors, that extend [`EthApiError`]. #[derive(Debug, thiserror::Error)] diff --git a/crates/optimism/rpc/src/eth/block.rs b/crates/optimism/rpc/src/eth/block.rs index ac1a060f5..eb8c192ba 100644 --- a/crates/optimism/rpc/src/eth/block.rs +++ b/crates/optimism/rpc/src/eth/block.rs @@ -1,5 +1,6 @@ //! Loads and formats OP block RPC response. +use alloy_rpc_types::BlockId; use op_alloy_network::Network; use op_alloy_rpc_types::OpTransactionReceipt; use reth_chainspec::{ChainSpec, ChainSpecProvider}; @@ -11,7 +12,6 @@ use reth_rpc_eth_api::{ RpcReceipt, }; use reth_rpc_eth_types::EthStateCache; -use reth_rpc_types::BlockId; use crate::{OpEthApi, OpEthApiError, OpReceiptBuilder}; diff --git a/crates/optimism/rpc/src/eth/receipt.rs b/crates/optimism/rpc/src/eth/receipt.rs index 30213062a..c08cbf5d3 100644 --- a/crates/optimism/rpc/src/eth/receipt.rs +++ b/crates/optimism/rpc/src/eth/receipt.rs @@ -1,5 +1,6 @@ //! Loads and formats OP receipt RPC response. +use alloy_rpc_types::{AnyReceiptEnvelope, Log, TransactionReceipt}; use op_alloy_consensus::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope}; use op_alloy_rpc_types::{ receipt::L1BlockInfo, OpTransactionReceipt, OptimismTransactionReceiptFields, @@ -12,7 +13,6 @@ use reth_primitives::{Receipt, TransactionMeta, TransactionSigned, TxType}; use reth_provider::ChainSpecProvider; use reth_rpc_eth_api::{helpers::LoadReceipt, FromEthApiError, RpcReceipt}; use reth_rpc_eth_types::{EthApiError, EthStateCache, ReceiptBuilder}; -use reth_rpc_types::{AnyReceiptEnvelope, Log, TransactionReceipt}; use crate::{OpEthApi, OpEthApiError}; diff --git a/crates/optimism/rpc/src/eth/transaction.rs b/crates/optimism/rpc/src/eth/transaction.rs index 20809d6b0..2556c8957 100644 --- a/crates/optimism/rpc/src/eth/transaction.rs +++ b/crates/optimism/rpc/src/eth/transaction.rs @@ -1,6 +1,7 @@ //! Loads and formats OP transaction RPC response. use alloy_primitives::{Bytes, B256}; +use alloy_rpc_types::TransactionInfo; use op_alloy_rpc_types::Transaction; use reth_node_api::FullNodeComponents; use reth_primitives::TransactionSignedEcRecovered; @@ -11,7 +12,6 @@ use reth_rpc_eth_api::{ FromEthApiError, FullEthApiTypes, TransactionCompat, }; use reth_rpc_eth_types::{utils::recover_raw_transaction, EthStateCache}; -use reth_rpc_types::TransactionInfo; use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool}; use crate::{OpEthApi, SequencerClient}; diff --git a/crates/rpc/rpc-api/Cargo.toml b/crates/rpc/rpc-api/Cargo.toml index 775f36ac9..ceccb827a 100644 --- a/crates/rpc/rpc-api/Cargo.toml +++ b/crates/rpc/rpc-api/Cargo.toml @@ -24,6 +24,7 @@ alloy-eips.workspace = true alloy-json-rpc.workspace = true alloy-primitives.workspace = true alloy-rpc-types-eth.workspace = true +alloy-rpc-types.workspace = true alloy-rpc-types-debug.workspace = true alloy-rpc-types-trace.workspace = true alloy-rpc-types-anvil.workspace = true diff --git a/crates/rpc/rpc-api/src/anvil.rs b/crates/rpc/rpc-api/src/anvil.rs index 99ed3721d..baa09166b 100644 --- a/crates/rpc/rpc-api/src/anvil.rs +++ b/crates/rpc/rpc-api/src/anvil.rs @@ -1,8 +1,8 @@ use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use alloy_primitives::{Address, Bytes, B256, U256}; +use alloy_rpc_types::Block; use alloy_rpc_types_anvil::{Forking, Metadata, MineOptions, NodeInfo}; -use reth_rpc_types::Block; /// Anvil rpc interface. /// https://book.getfoundry.sh/reference/anvil/#custom-methods diff --git a/crates/rpc/rpc-api/src/debug.rs b/crates/rpc/rpc-api/src/debug.rs index 0a81cfc65..4ea8c0f0e 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::{Block, Bundle, StateContext}; use alloy_rpc_types_debug::ExecutionWitness; use alloy_rpc_types_eth::transaction::TransactionRequest; use alloy_rpc_types_trace::geth::{ @@ -6,7 +7,6 @@ use alloy_rpc_types_trace::geth::{ }; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{BlockId, BlockNumberOrTag}; -use reth_rpc_types::{Block, Bundle, StateContext}; /// Debug rpc interface. #[cfg_attr(not(feature = "client"), rpc(server, namespace = "debug"))] diff --git a/crates/rpc/rpc-api/src/engine.rs b/crates/rpc/rpc-api/src/engine.rs index 0767f12d6..5a9371721 100644 --- a/crates/rpc/rpc-api/src/engine.rs +++ b/crates/rpc/rpc-api/src/engine.rs @@ -6,6 +6,9 @@ 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::{ + state::StateOverride, BlockOverrides, EIP1186AccountProofResponse, Filter, Log, SyncStatus, +}; use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_engine_primitives::EngineTypes; @@ -15,8 +18,7 @@ use reth_rpc_types::{ ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3, ExecutionPayloadV4, ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus, TransitionConfiguration, }, - state::StateOverride, - BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log, SyncStatus, + JsonStorageKey, }; // 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/otterscan.rs b/crates/rpc/rpc-api/src/otterscan.rs index 388f71c89..ee805b482 100644 --- a/crates/rpc/rpc-api/src/otterscan.rs +++ b/crates/rpc/rpc-api/src/otterscan.rs @@ -1,12 +1,12 @@ use alloy_json_rpc::RpcObject; use alloy_primitives::{Address, Bytes, TxHash, B256}; +use alloy_rpc_types::Header; use alloy_rpc_types_trace::otterscan::{ BlockDetails, ContractCreator, InternalOperation, OtsBlockTransactions, TraceEntry, TransactionsWithReceipts, }; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::BlockId; -use reth_rpc_types::Header; /// Otterscan rpc interface. #[cfg_attr(not(feature = "client"), rpc(server, namespace = "ots"))] diff --git a/crates/rpc/rpc-api/src/rpc.rs b/crates/rpc/rpc-api/src/rpc.rs index 43c669691..4900eee3c 100644 --- a/crates/rpc/rpc-api/src/rpc.rs +++ b/crates/rpc/rpc-api/src/rpc.rs @@ -1,5 +1,5 @@ +use alloy_rpc_types::RpcModules; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; -use reth_rpc_types::RpcModules; /// RPC namespace, used to find the versions of all rpc modules #[cfg_attr(not(feature = "client"), rpc(server, namespace = "rpc"))] diff --git a/crates/rpc/rpc-api/src/trace.rs b/crates/rpc/rpc-api/src/trace.rs index b615a33b8..91f3c253d 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::{state::StateOverride, BlockOverrides, Index}; use alloy_rpc_types_eth::transaction::TransactionRequest; use alloy_rpc_types_trace::{ filter::TraceFilter, @@ -7,7 +8,6 @@ use alloy_rpc_types_trace::{ }; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::BlockId; -use reth_rpc_types::{state::StateOverride, BlockOverrides, Index}; use std::collections::HashSet; /// Ethereum trace API diff --git a/crates/rpc/rpc-builder/Cargo.toml b/crates/rpc/rpc-builder/Cargo.toml index 10000ca2b..8b54a0d56 100644 --- a/crates/rpc/rpc-builder/Cargo.toml +++ b/crates/rpc/rpc-builder/Cargo.toml @@ -33,6 +33,7 @@ reth-primitives.workspace = true # ethereum alloy-network.workspace = true +alloy-rpc-types.workspace = true # rpc/net jsonrpsee = { workspace = true, features = ["server"] } diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index 38c505905..52af1f3ff 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -816,7 +816,7 @@ where + EthTransactions< NetworkTypes: alloy_network::Network< TransactionResponse = reth_rpc_types::WithOtherFields< - reth_rpc_types::Transaction, + alloy_rpc_types::Transaction, >, >, >, diff --git a/crates/rpc/rpc-builder/tests/it/http.rs b/crates/rpc/rpc-builder/tests/it/http.rs index e3bab2df1..7a8093c50 100644 --- a/crates/rpc/rpc-builder/tests/it/http.rs +++ b/crates/rpc/rpc-builder/tests/it/http.rs @@ -3,6 +3,10 @@ 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::{ + Block, FeeHistory, Filter, Index, Log, PendingTransactionFilterKind, SyncStatus, Transaction, + TransactionReceipt, +}; use alloy_rpc_types_eth::transaction::TransactionRequest; use alloy_rpc_types_trace::filter::TraceFilter; use jsonrpsee::{ @@ -22,10 +26,6 @@ use reth_rpc_api::{ Web3ApiClient, }; use reth_rpc_server_types::RethRpcModule; -use reth_rpc_types::{ - Block, FeeHistory, Filter, Index, Log, PendingTransactionFilterKind, SyncStatus, Transaction, - TransactionReceipt, -}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashSet; diff --git a/crates/rpc/rpc-builder/tests/it/middleware.rs b/crates/rpc/rpc-builder/tests/it/middleware.rs index e95ee0764..bcc26dcad 100644 --- a/crates/rpc/rpc-builder/tests/it/middleware.rs +++ b/crates/rpc/rpc-builder/tests/it/middleware.rs @@ -1,4 +1,5 @@ use crate::utils::{test_address, test_rpc_builder}; +use alloy_rpc_types::{Block, Receipt, Transaction}; use jsonrpsee::{ server::{middleware::rpc::RpcServiceT, RpcServiceBuilder}, types::Request, @@ -8,7 +9,6 @@ use reth_rpc::EthApi; use reth_rpc_builder::{RpcServerConfig, TransportRpcModuleConfig}; use reth_rpc_eth_api::EthApiClient; use reth_rpc_server_types::RpcModuleSelection; -use reth_rpc_types::{Block, Receipt, Transaction}; use std::{ future::Future, pin::Pin, diff --git a/crates/rpc/rpc-eth-api/Cargo.toml b/crates/rpc/rpc-eth-api/Cargo.toml index f1f8ccc98..a551ff0b5 100644 --- a/crates/rpc/rpc-eth-api/Cargo.toml +++ b/crates/rpc/rpc-eth-api/Cargo.toml @@ -38,6 +38,7 @@ alloy-json-rpc.workspace = true alloy-network.workspace = true alloy-primitives.workspace = true alloy-rpc-types-eth.workspace = true +alloy-rpc-types.workspace = true alloy-rpc-types-mev.workspace = true # rpc diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 64a37e2d1..3a8b08428 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -3,17 +3,17 @@ 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}; -use reth_rpc_types::{ +use alloy_rpc_types::{ serde_helpers::JsonStorageKey, simulate::{SimulatePayload, SimulatedBlock}, state::{EvmOverrides, StateOverride}, BlockOverrides, Bundle, EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Header, Index, StateContext, SyncStatus, Work, }; +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}; use tracing::trace; use crate::{ @@ -276,7 +276,7 @@ pub trait EthApi { &self, address: Address, block: BlockId, - ) -> RpcResult>; + ) -> RpcResult>; /// Introduced in EIP-1559, returns suggestion for the priority for dynamic fee transactions. #[method(name = "maxPriorityFeePerGas")] @@ -694,7 +694,7 @@ where &self, address: Address, block: BlockId, - ) -> RpcResult> { + ) -> RpcResult> { trace!(target: "rpc::eth", "Serving eth_getAccount"); Ok(EthState::get_account(self, address, block).await?) } diff --git a/crates/rpc/rpc-eth-api/src/filter.rs b/crates/rpc/rpc-eth-api/src/filter.rs index 26c47226c..c73d96728 100644 --- a/crates/rpc/rpc-eth-api/src/filter.rs +++ b/crates/rpc/rpc-eth-api/src/filter.rs @@ -1,8 +1,8 @@ //! `eth_` RPC API for filtering. use alloy_json_rpc::RpcObject; +use alloy_rpc_types::{Filter, FilterChanges, FilterId, Log, PendingTransactionFilterKind}; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; -use reth_rpc_types::{Filter, FilterChanges, FilterId, Log, PendingTransactionFilterKind}; /// Rpc Interface for poll-based ethereum filter API. #[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))] diff --git a/crates/rpc/rpc-eth-api/src/helpers/block.rs b/crates/rpc/rpc-eth-api/src/helpers/block.rs index 19e81e270..381c8c505 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/block.rs @@ -2,11 +2,11 @@ use std::sync::Arc; +use alloy_rpc_types::{Header, Index}; use futures::Future; use reth_primitives::{BlockId, Receipt, SealedBlock, SealedBlockWithSenders}; use reth_provider::{BlockIdReader, BlockReader, BlockReaderIdExt, HeaderProvider}; use reth_rpc_eth_types::{EthApiError, EthStateCache}; -use reth_rpc_types::{Header, Index}; use reth_rpc_types_compat::block::{from_block, uncle_block_from_header}; use crate::{FromEthApiError, FullEthApiTypes, RpcBlock, RpcReceipt}; diff --git a/crates/rpc/rpc-eth-api/src/helpers/call.rs b/crates/rpc/rpc-eth-api/src/helpers/call.rs index 19148bfdf..5c651b10b 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/call.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/call.rs @@ -5,6 +5,11 @@ use crate::{ AsEthApiError, FromEthApiError, FromEvmError, FullEthApiTypes, IntoEthApiError, RpcBlock, }; use alloy_primitives::{Bytes, TxKind, B256, U256}; +use alloy_rpc_types::{ + simulate::{SimBlock, SimulatePayload, SimulatedBlock}, + state::{EvmOverrides, StateOverride}, + BlockId, Bundle, EthCallResponse, StateContext, TransactionInfo, +}; use alloy_rpc_types_eth::transaction::TransactionRequest; use futures::Future; use reth_chainspec::MIN_TRANSACTION_GAS; @@ -31,11 +36,6 @@ use reth_rpc_eth_types::{ EthApiError, RevertError, RpcInvalidTransactionError, StateCacheDb, }; use reth_rpc_server_types::constants::gas_oracle::{CALL_STIPEND_GAS, ESTIMATE_GAS_ERROR_RATIO}; -use reth_rpc_types::{ - simulate::{SimBlock, SimulatePayload, SimulatedBlock}, - state::{EvmOverrides, StateOverride}, - BlockId, Bundle, EthCallResponse, StateContext, TransactionInfo, -}; use revm::{Database, DatabaseCommit, GetInspector}; use revm_inspectors::{access_list::AccessListInspector, transfer::TransferInspector}; use tracing::trace; diff --git a/crates/rpc/rpc-eth-api/src/helpers/fee.rs b/crates/rpc/rpc-eth-api/src/helpers/fee.rs index 43f202a7d..736e34191 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/fee.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/fee.rs @@ -1,6 +1,7 @@ //! Loads fee history from database. Helper trait for `eth_` fee and transaction RPC methods. use alloy_primitives::U256; +use alloy_rpc_types::{BlockNumberOrTag, FeeHistory}; use futures::Future; use reth_chainspec::ChainSpec; use reth_provider::{BlockIdReader, BlockReaderIdExt, ChainSpecProvider, HeaderProvider}; @@ -8,7 +9,6 @@ use reth_rpc_eth_types::{ fee_history::calculate_reward_percentiles_for_block, EthApiError, EthStateCache, FeeHistoryCache, FeeHistoryEntry, GasPriceOracle, RpcInvalidTransactionError, }; -use reth_rpc_types::{BlockNumberOrTag, FeeHistory}; use tracing::debug; use crate::FromEthApiError; diff --git a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs index d19adff6e..2bebb9afc 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs @@ -5,6 +5,7 @@ use std::time::{Duration, Instant}; use crate::{EthApiTypes, FromEthApiError, FromEvmError}; use alloy_primitives::{BlockNumber, B256, U256}; +use alloy_rpc_types::BlockNumberOrTag; use futures::Future; use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_evm::{ @@ -30,7 +31,6 @@ use reth_revm::{ database::StateProviderDatabase, state_change::post_block_withdrawals_balance_increments, }; use reth_rpc_eth_types::{EthApiError, PendingBlock, PendingBlockEnv, PendingBlockEnvOrigin}; -use reth_rpc_types::BlockNumberOrTag; use reth_transaction_pool::{BestTransactionsAttributes, TransactionPool}; use reth_trie::HashedPostState; use revm::{db::states::bundle_state::BundleRetention, DatabaseCommit, State}; diff --git a/crates/rpc/rpc-eth-api/src/helpers/spec.rs b/crates/rpc/rpc-eth-api/src/helpers/spec.rs index f404ec7db..e852a352a 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/spec.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/spec.rs @@ -3,12 +3,12 @@ use std::sync::Arc; use alloy_primitives::{Address, U256, U64}; +use alloy_rpc_types::{Stage, SyncInfo, SyncStatus}; use futures::Future; use reth_chainspec::{ChainInfo, ChainSpec}; use reth_errors::{RethError, RethResult}; use reth_network_api::NetworkInfo; use reth_provider::{BlockNumReader, ChainSpecProvider, StageCheckpointReader}; -use reth_rpc_types::{Stage, SyncInfo, SyncStatus}; use super::EthSigner; diff --git a/crates/rpc/rpc-eth-api/src/helpers/state.rs b/crates/rpc/rpc-eth-api/src/helpers/state.rs index 86c6895b6..9a72ec982 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/state.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/state.rs @@ -2,6 +2,7 @@ //! RPC methods. use alloy_primitives::{Address, Bytes, B256, U256}; +use alloy_rpc_types::{serde_helpers::JsonStorageKey, Account, EIP1186AccountProofResponse}; use futures::Future; use reth_chainspec::ChainSpec; use reth_errors::RethError; @@ -11,7 +12,6 @@ use reth_provider::{ BlockIdReader, ChainSpecProvider, StateProvider, StateProviderBox, StateProviderFactory, }; use reth_rpc_eth_types::{EthApiError, EthStateCache, PendingBlockEnv, RpcInvalidTransactionError}; -use reth_rpc_types::{serde_helpers::JsonStorageKey, Account, EIP1186AccountProofResponse}; use reth_rpc_types_compat::proof::from_primitive_account_proof; use reth_transaction_pool::{PoolTransaction, TransactionPool}; use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, SpecId}; diff --git a/crates/rpc/rpc-eth-api/src/helpers/trace.rs b/crates/rpc/rpc-eth-api/src/helpers/trace.rs index 7c774c088..0bebb1408 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/trace.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/trace.rs @@ -1,6 +1,7 @@ //! Loads a pending block from database. Helper trait for `eth_` call and trace RPC methods. use alloy_primitives::B256; +use alloy_rpc_types::{BlockId, TransactionInfo}; use futures::Future; use reth_evm::{ConfigureEvm, ConfigureEvmEnv}; use reth_primitives::Header; @@ -9,7 +10,6 @@ use reth_rpc_eth_types::{ cache::db::{StateCacheDb, StateCacheDbRefMutWrapper, StateProviderTraitObjWrapper}, EthApiError, }; -use reth_rpc_types::{BlockId, TransactionInfo}; use revm::{db::CacheDB, Database, DatabaseCommit, GetInspector, Inspector}; use revm_inspectors::tracing::{TracingInspector, TracingInspectorConfig}; use revm_primitives::{EnvWithHandlerCfg, EvmState, ExecutionResult, ResultAndState}; diff --git a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs index 1d0d1c4c8..126af39d5 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::{BlockNumberOrTag, TransactionInfo}; use alloy_rpc_types_eth::transaction::TransactionRequest; use futures::Future; use reth_primitives::{ @@ -18,7 +19,7 @@ use reth_rpc_types::{ EIP1559TransactionRequest, EIP2930TransactionRequest, EIP4844TransactionRequest, LegacyTransactionRequest, }, - BlockNumberOrTag, TransactionInfo, TypedTransactionRequest, + 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-api/src/pubsub.rs b/crates/rpc/rpc-eth-api/src/pubsub.rs index 8282e6b6a..32c668688 100644 --- a/crates/rpc/rpc-eth-api/src/pubsub.rs +++ b/crates/rpc/rpc-eth-api/src/pubsub.rs @@ -1,8 +1,8 @@ //! `eth_` RPC API for pubsub subscription. use alloy_json_rpc::RpcObject; +use alloy_rpc_types::pubsub::{Params, SubscriptionKind}; use jsonrpsee::proc_macros::rpc; -use reth_rpc_types::pubsub::{Params, SubscriptionKind}; /// Ethereum pub-sub rpc interface. #[rpc(server, namespace = "eth")] diff --git a/crates/rpc/rpc-eth-api/src/types.rs b/crates/rpc/rpc-eth-api/src/types.rs index 900817964..9ddc23ea3 100644 --- a/crates/rpc/rpc-eth-api/src/types.rs +++ b/crates/rpc/rpc-eth-api/src/types.rs @@ -3,8 +3,8 @@ use std::{error::Error, fmt}; use alloy_network::{AnyNetwork, Network}; +use alloy_rpc_types::Block; use reth_rpc_eth_types::EthApiError; -use reth_rpc_types::Block; use reth_rpc_types_compat::TransactionCompat; use crate::{AsEthApiError, FromEthApiError, FromEvmError}; @@ -20,7 +20,7 @@ pub trait EthApiTypes: Send + Sync + Clone { + Send + Sync; /// Blockchain primitive types, specific to network, e.g. block and transaction. - type NetworkTypes: Network; + type NetworkTypes: Network; /// Conversion methods for transaction RPC type. type TransactionCompat: Send + Sync + Clone + fmt::Debug; } diff --git a/crates/rpc/rpc-eth-types/src/cache/db.rs b/crates/rpc/rpc-eth-types/src/cache/db.rs index 82f90ebc5..10ab9a5fe 100644 --- a/crates/rpc/rpc-eth-types/src/cache/db.rs +++ b/crates/rpc/rpc-eth-types/src/cache/db.rs @@ -111,7 +111,7 @@ impl<'a> reth_storage_api::BlockHashReader for StateProviderTraitObjWrapper<'a> fn convert_block_hash( &self, - hash_or_number: reth_rpc_types::BlockHashOrNumber, + hash_or_number: alloy_rpc_types::BlockHashOrNumber, ) -> reth_errors::ProviderResult> { self.0.convert_block_hash(hash_or_number) } diff --git a/crates/rpc/rpc-eth-types/src/error.rs b/crates/rpc/rpc-eth-types/src/error.rs index 977300cad..90aec2127 100644 --- a/crates/rpc/rpc-eth-types/src/error.rs +++ b/crates/rpc/rpc-eth-types/src/error.rs @@ -3,15 +3,14 @@ use std::time::Duration; use alloy_primitives::{Address, Bytes, U256}; +use alloy_rpc_types::{error::EthRpcErrorCode, request::TransactionInputError, BlockError}; use alloy_sol_types::decode_revert_reason; use reth_errors::RethError; use reth_primitives::{revm_primitives::InvalidHeader, BlockId}; use reth_rpc_server_types::result::{ block_id_to_str, internal_rpc_err, invalid_params_rpc_err, rpc_err, rpc_error_with_code, }; -use reth_rpc_types::{ - error::EthRpcErrorCode, request::TransactionInputError, BlockError, ToRpcError, -}; +use reth_rpc_types::ToRpcError; use reth_transaction_pool::error::{ Eip4844PoolTransactionError, Eip7702PoolTransactionError, InvalidPoolTransactionError, PoolError, PoolErrorKind, PoolTransactionError, diff --git a/crates/rpc/rpc-eth-types/src/fee_history.rs b/crates/rpc/rpc-eth-types/src/fee_history.rs index 17e1fea8a..b511af7a3 100644 --- a/crates/rpc/rpc-eth-types/src/fee_history.rs +++ b/crates/rpc/rpc-eth-types/src/fee_history.rs @@ -7,6 +7,7 @@ use std::{ }; use alloy_primitives::B256; +use alloy_rpc_types::TxGasAndReward; use futures::{ future::{Fuse, FusedFuture}, FutureExt, Stream, StreamExt, @@ -19,7 +20,6 @@ use reth_primitives::{ eip4844::{calc_blob_gasprice, calculate_excess_blob_gas}, Receipt, SealedBlock, TransactionSigned, }; -use reth_rpc_types::TxGasAndReward; use reth_storage_api::BlockReaderIdExt; use serde::{Deserialize, Serialize}; use tracing::trace; diff --git a/crates/rpc/rpc-eth-types/src/gas_oracle.rs b/crates/rpc/rpc-eth-types/src/gas_oracle.rs index b5f9ca58d..f853778ba 100644 --- a/crates/rpc/rpc-eth-types/src/gas_oracle.rs +++ b/crates/rpc/rpc-eth-types/src/gas_oracle.rs @@ -4,10 +4,10 @@ use std::fmt::{self, Debug, Formatter}; use alloy_primitives::{B256, U256}; +use alloy_rpc_types::BlockId; use derive_more::{Deref, DerefMut, From, Into}; use reth_primitives::{constants::GWEI_TO_WEI, BlockNumberOrTag}; use reth_rpc_server_types::constants; -use reth_rpc_types::BlockId; use reth_storage_api::BlockReaderIdExt; use schnellru::{ByLength, LruMap}; use serde::{Deserialize, Serialize}; diff --git a/crates/rpc/rpc-eth-types/src/logs_utils.rs b/crates/rpc/rpc-eth-types/src/logs_utils.rs index d332a0445..f630b9aed 100644 --- a/crates/rpc/rpc-eth-types/src/logs_utils.rs +++ b/crates/rpc/rpc-eth-types/src/logs_utils.rs @@ -3,11 +3,11 @@ //! Log parsing for building filter. use alloy_primitives::TxHash; +use alloy_rpc_types::{FilterId, FilteredParams, Log}; use reth_chainspec::ChainInfo; use reth_errors::ProviderError; use reth_primitives::{BlockNumHash, Receipt}; use reth_rpc_server_types::result::rpc_error_with_code; -use reth_rpc_types::{FilterId, FilteredParams, Log}; use reth_storage_api::BlockReader; use crate::EthApiError; @@ -210,7 +210,7 @@ pub fn get_filter_block_range( #[cfg(test)] mod tests { - use reth_rpc_types::Filter; + use alloy_rpc_types::Filter; use super::*; @@ -273,8 +273,8 @@ mod tests { let start_block = info.best_number; let (from_block_number, to_block_number) = get_filter_block_range( - from_block.and_then(reth_rpc_types::BlockNumberOrTag::as_number), - to_block.and_then(reth_rpc_types::BlockNumberOrTag::as_number), + from_block.and_then(alloy_rpc_types::BlockNumberOrTag::as_number), + to_block.and_then(alloy_rpc_types::BlockNumberOrTag::as_number), start_block, info, ); diff --git a/crates/rpc/rpc-eth-types/src/receipt.rs b/crates/rpc/rpc-eth-types/src/receipt.rs index 63d148d44..d2d9c50d1 100644 --- a/crates/rpc/rpc-eth-types/src/receipt.rs +++ b/crates/rpc/rpc-eth-types/src/receipt.rs @@ -1,11 +1,11 @@ //! RPC receipt response builder, extends a layer one receipt with layer two data. use alloy_primitives::{Address, TxKind}; -use reth_primitives::{Receipt, TransactionMeta, TransactionSigned}; -use reth_rpc_types::{ - AnyReceiptEnvelope, AnyTransactionReceipt, Log, OtherFields, ReceiptWithBloom, - TransactionReceipt, WithOtherFields, +use alloy_rpc_types::{ + AnyReceiptEnvelope, AnyTransactionReceipt, Log, ReceiptWithBloom, TransactionReceipt, }; +use reth_primitives::{Receipt, TransactionMeta, TransactionSigned}; +use reth_rpc_types::{OtherFields, WithOtherFields}; use revm_primitives::calc_blob_gasprice; use super::{EthApiError, EthResult}; @@ -75,7 +75,7 @@ impl ReceiptBuilder { }) .collect(); - let rpc_receipt = reth_rpc_types::Receipt { + let rpc_receipt = alloy_rpc_types::Receipt { status: receipt.success.into(), cumulative_gas_used: receipt.cumulative_gas_used as u128, logs, diff --git a/crates/rpc/rpc-eth-types/src/revm_utils.rs b/crates/rpc/rpc-eth-types/src/revm_utils.rs index 6a8ef76ec..f6fbdc2f7 100644 --- a/crates/rpc/rpc-eth-types/src/revm_utils.rs +++ b/crates/rpc/rpc-eth-types/src/revm_utils.rs @@ -1,7 +1,7 @@ //! utilities for working with revm use alloy_primitives::{Address, B256, U256}; -use reth_rpc_types::{ +use alloy_rpc_types::{ state::{AccountOverride, StateOverride}, BlockOverrides, }; diff --git a/crates/rpc/rpc-eth-types/src/simulate.rs b/crates/rpc/rpc-eth-types/src/simulate.rs index 4ce214ccc..da7ee796f 100644 --- a/crates/rpc/rpc-eth-types/src/simulate.rs +++ b/crates/rpc/rpc-eth-types/src/simulate.rs @@ -1,6 +1,10 @@ //! Utilities for serving `eth_simulateV1` use alloy_consensus::{TxEip4844Variant, TxType, TypedTransaction}; +use alloy_rpc_types::{ + simulate::{SimCallResult, SimulateError, SimulatedBlock}, + Block, BlockTransactionsKind, +}; use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee_types::ErrorObject; use reth_primitives::{ @@ -10,10 +14,7 @@ use reth_primitives::{ }; use reth_revm::database::StateProviderDatabase; use reth_rpc_server_types::result::rpc_err; -use reth_rpc_types::{ - simulate::{SimCallResult, SimulateError, SimulatedBlock}, - Block, BlockTransactionsKind, ToRpcError, -}; +use reth_rpc_types::ToRpcError; use reth_rpc_types_compat::{block::from_block, TransactionCompat}; use reth_storage_api::StateRootProvider; use reth_trie::{HashedPostState, HashedStorage}; @@ -223,7 +224,7 @@ pub fn build_block( .into_iter() .map(|log| { log_index += 1; - reth_rpc_types::Log { + alloy_rpc_types::Log { inner: log, log_index: Some(log_index - 1), transaction_index: Some(transaction_index as u64), diff --git a/crates/rpc/rpc-testing-util/Cargo.toml b/crates/rpc/rpc-testing-util/Cargo.toml index 68ab05cc0..4977c3a2c 100644 --- a/crates/rpc/rpc-testing-util/Cargo.toml +++ b/crates/rpc/rpc-testing-util/Cargo.toml @@ -14,12 +14,12 @@ workspace = true [dependencies] # reth reth-primitives.workspace = true -reth-rpc-types.workspace = true reth-rpc-api = { workspace = true, features = ["client"] } # ethereum alloy-primitives.workspace = true alloy-rpc-types-eth.workspace = true +alloy-rpc-types.workspace = true alloy-rpc-types-trace.workspace = true # async diff --git a/crates/rpc/rpc-testing-util/src/debug.rs b/crates/rpc/rpc-testing-util/src/debug.rs index 01b055265..cdcb454a2 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::{Block, Transaction}; use alloy_rpc_types_eth::transaction::TransactionRequest; use alloy_rpc_types_trace::{ common::TraceResult, @@ -16,7 +17,6 @@ use futures::{Stream, StreamExt}; use jsonrpsee::core::client::Error as RpcError; use reth_primitives::{BlockId, Receipt}; use reth_rpc_api::{clients::DebugApiClient, EthApiClient}; -use reth_rpc_types::{Block, Transaction}; const NOOP_TRACER: &str = include_str!("../assets/noop-tracer.js"); const JS_TRACER_TEMPLATE: &str = include_str!("../assets/tracer-template.js"); diff --git a/crates/rpc/rpc-testing-util/src/trace.rs b/crates/rpc/rpc-testing-util/src/trace.rs index c9721d402..2326a9e89 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::Index; use alloy_rpc_types_eth::transaction::TransactionRequest; use alloy_rpc_types_trace::{ filter::TraceFilter, @@ -11,7 +12,6 @@ use futures::{Stream, StreamExt}; use jsonrpsee::core::client::Error as RpcError; use reth_primitives::BlockId; use reth_rpc_api::clients::TraceApiClient; -use reth_rpc_types::Index; use std::{ collections::HashSet, pin::Pin, diff --git a/crates/rpc/rpc-testing-util/tests/it/trace.rs b/crates/rpc/rpc-testing-util/tests/it/trace.rs index 2c4b74606..607833518 100644 --- a/crates/rpc/rpc-testing-util/tests/it/trace.rs +++ b/crates/rpc/rpc-testing-util/tests/it/trace.rs @@ -1,5 +1,6 @@ //! Integration tests for the trace API. +use alloy_rpc_types::{Block, Transaction}; use alloy_rpc_types_trace::{ filter::TraceFilter, parity::TraceType, tracerequest::TraceCallRequest, }; @@ -9,7 +10,6 @@ use jsonrpsee_http_client::HttpClient; use reth_primitives::Receipt; use reth_rpc_api_testing_util::{debug::DebugApiExt, trace::TraceApiExt, utils::parse_env_url}; use reth_rpc_eth_api::EthApiClient; -use reth_rpc_types::{Block, Transaction}; use std::{collections::HashSet, time::Instant}; /// This is intended to be run locally against a running node. diff --git a/crates/rpc/rpc-types-compat/src/block.rs b/crates/rpc/rpc-types-compat/src/block.rs index bf500a209..6e918cefb 100644 --- a/crates/rpc/rpc-types-compat/src/block.rs +++ b/crates/rpc/rpc-types-compat/src/block.rs @@ -2,12 +2,12 @@ use alloy_primitives::{B256, U256}; use alloy_rlp::Encodable; +use alloy_rpc_types::{ + Block, BlockError, BlockTransactions, BlockTransactionsKind, Header, TransactionInfo, +}; use reth_primitives::{ Block as PrimitiveBlock, BlockWithSenders, Header as PrimitiveHeader, Withdrawals, }; -use reth_rpc_types::{ - Block, BlockError, BlockTransactions, BlockTransactionsKind, Header, TransactionInfo, -}; use crate::{transaction::from_recovered_with_block_context, TransactionCompat}; @@ -96,7 +96,7 @@ pub fn from_block_full( )) } -/// Converts from a [`reth_primitives::SealedHeader`] to a [`reth_rpc_types::Header`] +/// Converts from a [`reth_primitives::SealedHeader`] to a [`alloy-rpc-types::Header`] /// /// # Note /// diff --git a/crates/rpc/rpc-types-compat/src/proof.rs b/crates/rpc/rpc-types-compat/src/proof.rs index edf585516..b80fbd139 100644 --- a/crates/rpc/rpc-types-compat/src/proof.rs +++ b/crates/rpc/rpc-types-compat/src/proof.rs @@ -1,6 +1,6 @@ //! Compatibility functions for rpc proof related types. -use reth_rpc_types::{ +use alloy_rpc_types::{ serde_helpers::JsonStorageKey, EIP1186AccountProofResponse, EIP1186StorageProof, }; use reth_trie_common::{AccountProof, StorageProof}; diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index 8fd4860e1..adf909a7c 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -10,10 +10,10 @@ use std::fmt; use alloy_rpc_types::{ request::{TransactionInput, TransactionRequest}, - TransactionInfo, + Transaction, TransactionInfo, }; use reth_primitives::{TransactionSigned, TransactionSignedEcRecovered, TxType}; -use reth_rpc_types::{Transaction, WithOtherFields}; +use reth_rpc_types::WithOtherFields; /// Create a new rpc transaction result for a mined transaction, using the given block hash, /// number, and tx index fields to populate the corresponding fields in the rpc result. diff --git a/crates/rpc/rpc-types-compat/src/transaction/signature.rs b/crates/rpc/rpc-types-compat/src/transaction/signature.rs index 34866677d..6932f82e3 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/signature.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/signature.rs @@ -1,6 +1,6 @@ use alloy_primitives::U256; +use alloy_rpc_types::{Parity, Signature}; use reth_primitives::{Signature as PrimitiveSignature, TxType}; -use reth_rpc_types::{Parity, Signature}; /// Creates a new rpc signature from a legacy [primitive /// signature](reth_primitives::Signature), using the give chain id to compute the signature's diff --git a/crates/rpc/rpc-types/src/lib.rs b/crates/rpc/rpc-types/src/lib.rs index 7d9361c0b..2f475e08a 100644 --- a/crates/rpc/rpc-types/src/lib.rs +++ b/crates/rpc/rpc-types/src/lib.rs @@ -16,11 +16,6 @@ mod eth; pub type PeerId = B512; use alloy_primitives::B512; -// re-export for convenience -pub use alloy_rpc_types::serde_helpers; - -// Ethereum specific rpc types coming from alloy. -pub use alloy_rpc_types::*; // Ethereum specific serde types coming from alloy. pub use alloy_serde::*; diff --git a/crates/rpc/rpc/Cargo.toml b/crates/rpc/rpc/Cargo.toml index 80d948bc2..a5a4ddba9 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.workspace = true alloy-rpc-types-eth.workspace = true alloy-rpc-types-debug.workspace = true alloy-rpc-types-trace.workspace = true diff --git a/crates/rpc/rpc/src/debug.rs b/crates/rpc/rpc/src/debug.rs index 4ebc3d1bb..14999c70b 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::{state::EvmOverrides, Block as RpcBlock, BlockError, Bundle, StateContext}; use alloy_rpc_types_debug::ExecutionWitness; use alloy_rpc_types_eth::transaction::TransactionRequest; use alloy_rpc_types_trace::geth::{ @@ -26,7 +27,6 @@ use reth_rpc_eth_api::{ }; use reth_rpc_eth_types::{EthApiError, StateCacheDb}; use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult}; -use reth_rpc_types::{state::EvmOverrides, Block as RpcBlock, BlockError, Bundle, StateContext}; use reth_tasks::pool::BlockingTaskGuard; use reth_trie::{HashedPostState, HashedStorage}; use revm::{ diff --git a/crates/rpc/rpc/src/engine.rs b/crates/rpc/rpc/src/engine.rs index 40b0a9adf..f8b6600a1 100644 --- a/crates/rpc/rpc/src/engine.rs +++ b/crates/rpc/rpc/src/engine.rs @@ -1,4 +1,7 @@ use alloy_primitives::{Address, Bytes, B256, U256, U64}; +use alloy_rpc_types::{ + state::StateOverride, BlockOverrides, EIP1186AccountProofResponse, Filter, Log, SyncStatus, +}; use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::core::RpcResult as Result; use reth_primitives::{BlockId, BlockNumberOrTag}; @@ -6,10 +9,7 @@ use reth_rpc_api::{EngineEthApiServer, EthApiServer, EthFilterApiServer}; /// Re-export for convenience 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, -}; +use reth_rpc_types::JsonStorageKey; use tracing_futures::Instrument; macro_rules! engine_span { diff --git a/crates/rpc/rpc/src/eth/bundle.rs b/crates/rpc/rpc/src/eth/bundle.rs index dd7b2c858..c2999c2d3 100644 --- a/crates/rpc/rpc/src/eth/bundle.rs +++ b/crates/rpc/rpc/src/eth/bundle.rs @@ -101,7 +101,7 @@ where .into()) } - let block_id: reth_rpc_types::BlockId = state_block_number.into(); + let block_id: alloy_rpc_types::BlockId = state_block_number.into(); // Note: the block number is considered the `parent` block: let (cfg, mut block_env, at) = self.inner.eth_api.evm_env_at(block_id).await?; diff --git a/crates/rpc/rpc/src/eth/core.rs b/crates/rpc/rpc/src/eth/core.rs index c70d16a0c..c56011250 100644 --- a/crates/rpc/rpc/src/eth/core.rs +++ b/crates/rpc/rpc/src/eth/core.rs @@ -374,6 +374,7 @@ impl EthApiInner::parse() diff --git a/examples/db-access/Cargo.toml b/examples/db-access/Cargo.toml index 6ddfeb5e5..c0fbe74e1 100644 --- a/examples/db-access/Cargo.toml +++ b/examples/db-access/Cargo.toml @@ -15,5 +15,7 @@ reth-rpc-types.workspace = true reth-node-ethereum.workspace = true reth-node-types.workspace = true +alloy-rpc-types.workspace = true + eyre.workspace = true diff --git a/examples/db-access/src/main.rs b/examples/db-access/src/main.rs index 7886a3bdd..810c7a355 100644 --- a/examples/db-access/src/main.rs +++ b/examples/db-access/src/main.rs @@ -1,3 +1,4 @@ +use alloy_rpc_types::{Filter, FilteredParams}; use reth_chainspec::ChainSpecBuilder; use reth_node_ethereum::EthereumNode; use reth_node_types::NodeTypesWithDBAdapter; @@ -6,7 +7,6 @@ use reth_provider::{ providers::StaticFileProvider, AccountReader, BlockReader, BlockSource, HeaderProvider, ProviderFactory, ReceiptProvider, StateProvider, TransactionsProvider, }; -use reth_rpc_types::{Filter, FilteredParams}; use std::path::Path; // Providers are zero cost abstractions on top of an opened MDBX Transaction