From 757f39f1a8a4ec997dcd5e12e154071dd9e7e0bb Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Thu, 13 Mar 2025 09:25:39 -0400 Subject: [PATCH] chore: rm reth-primitives from reth-rpc-eth-types (#15004) --- Cargo.lock | 2 +- crates/rpc/rpc-eth-types/Cargo.toml | 2 +- crates/rpc/rpc-eth-types/src/cache/db.rs | 6 +++--- crates/rpc/rpc-eth-types/src/cache/mod.rs | 3 +-- crates/rpc/rpc-eth-types/src/error/mod.rs | 8 ++++---- crates/rpc/rpc-eth-types/src/fee_history.rs | 3 +-- crates/rpc/rpc-eth-types/src/logs_utils.rs | 3 +-- crates/rpc/rpc-eth-types/src/pending_block.rs | 6 +++--- crates/rpc/rpc-eth-types/src/receipt.rs | 2 +- crates/rpc/rpc-eth-types/src/simulate.rs | 5 +++-- crates/rpc/rpc-eth-types/src/transaction.rs | 4 ++-- crates/rpc/rpc-eth-types/src/utils.rs | 3 +-- 12 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 834a067f5d..c46e978a78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9555,10 +9555,10 @@ dependencies = [ "reth-chain-state", "reth-chainspec", "reth-errors", + "reth-ethereum-primitives", "reth-evm", "reth-execution-types", "reth-metrics", - "reth-primitives", "reth-primitives-traits", "reth-revm", "reth-rpc-server-types", diff --git a/crates/rpc/rpc-eth-types/Cargo.toml b/crates/rpc/rpc-eth-types/Cargo.toml index 0aa10ec875..60d94fbc9b 100644 --- a/crates/rpc/rpc-eth-types/Cargo.toml +++ b/crates/rpc/rpc-eth-types/Cargo.toml @@ -18,7 +18,7 @@ reth-errors.workspace = true reth-evm.workspace = true reth-execution-types.workspace = true reth-metrics.workspace = true -reth-primitives = { workspace = true, features = ["secp256k1"] } +reth-ethereum-primitives.workspace = true reth-primitives-traits.workspace = true reth-storage-api.workspace = true reth-revm.workspace = true diff --git a/crates/rpc/rpc-eth-types/src/cache/db.rs b/crates/rpc/rpc-eth-types/src/cache/db.rs index e7039253c1..03095f0f69 100644 --- a/crates/rpc/rpc-eth-types/src/cache/db.rs +++ b/crates/rpc/rpc-eth-types/src/cache/db.rs @@ -110,7 +110,7 @@ impl reth_storage_api::AccountReader for StateProviderTraitObjWrapper<'_> { fn basic_account( &self, address: &revm_primitives::Address, - ) -> reth_errors::ProviderResult> { + ) -> reth_errors::ProviderResult> { self.0.basic_account(address) } } @@ -160,14 +160,14 @@ impl StateProvider for StateProviderTraitObjWrapper<'_> { fn bytecode_by_hash( &self, code_hash: &B256, - ) -> reth_errors::ProviderResult> { + ) -> reth_errors::ProviderResult> { self.0.bytecode_by_hash(code_hash) } fn account_code( &self, addr: &revm_primitives::Address, - ) -> reth_errors::ProviderResult> { + ) -> reth_errors::ProviderResult> { self.0.account_code(addr) } diff --git a/crates/rpc/rpc-eth-types/src/cache/mod.rs b/crates/rpc/rpc-eth-types/src/cache/mod.rs index 4b03e6226f..8577305213 100644 --- a/crates/rpc/rpc-eth-types/src/cache/mod.rs +++ b/crates/rpc/rpc-eth-types/src/cache/mod.rs @@ -7,8 +7,7 @@ use futures::{future::Either, Stream, StreamExt}; use reth_chain_state::CanonStateNotification; use reth_errors::{ProviderError, ProviderResult}; use reth_execution_types::Chain; -use reth_primitives::{NodePrimitives, RecoveredBlock}; -use reth_primitives_traits::{Block, BlockBody}; +use reth_primitives_traits::{Block, BlockBody, NodePrimitives, RecoveredBlock}; use reth_storage_api::{BlockReader, TransactionVariant}; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use schnellru::{ByLength, Limiter}; diff --git a/crates/rpc/rpc-eth-types/src/error/mod.rs b/crates/rpc/rpc-eth-types/src/error/mod.rs index 14ad0c35e3..57fc84761e 100644 --- a/crates/rpc/rpc-eth-types/src/error/mod.rs +++ b/crates/rpc/rpc-eth-types/src/error/mod.rs @@ -9,7 +9,7 @@ use alloy_sol_types::{ContractError, RevertReason}; pub use api::{AsEthApiError, FromEthApiError, FromEvmError, IntoEthApiError}; use core::time::Duration; use reth_errors::{BlockExecutionError, RethError}; -use reth_primitives_traits::transaction::signed::RecoveryError; +use reth_primitives_traits::transaction::{error::InvalidTransactionError, signed::RecoveryError}; use reth_rpc_server_types::result::{ block_id_to_str, internal_rpc_err, invalid_params_rpc_err, rpc_err, rpc_error_with_code, }; @@ -584,9 +584,9 @@ impl From for RpcInvalidTransactionError { } } -impl From for RpcInvalidTransactionError { - fn from(err: reth_primitives::InvalidTransactionError) -> Self { - use reth_primitives::InvalidTransactionError; +impl From for RpcInvalidTransactionError { + fn from(err: InvalidTransactionError) -> Self { + use InvalidTransactionError; // This conversion is used to convert any transaction errors that could occur inside the // txpool (e.g. `eth_sendRawTransaction`) to their corresponding RPC match err { diff --git a/crates/rpc/rpc-eth-types/src/fee_history.rs b/crates/rpc/rpc-eth-types/src/fee_history.rs index 80a5933605..374761de85 100644 --- a/crates/rpc/rpc-eth-types/src/fee_history.rs +++ b/crates/rpc/rpc-eth-types/src/fee_history.rs @@ -17,8 +17,7 @@ use futures::{ use metrics::atomics::AtomicU64; use reth_chain_state::CanonStateNotification; use reth_chainspec::{ChainSpecProvider, EthChainSpec}; -use reth_primitives::{NodePrimitives, SealedBlock}; -use reth_primitives_traits::{Block, BlockBody}; +use reth_primitives_traits::{Block, BlockBody, NodePrimitives, SealedBlock}; use reth_rpc_server_types::constants::gas_oracle::MAX_HEADER_HISTORY; use reth_storage_api::BlockReaderIdExt; 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 147159b40d..0ea14bb160 100644 --- a/crates/rpc/rpc-eth-types/src/logs_utils.rs +++ b/crates/rpc/rpc-eth-types/src/logs_utils.rs @@ -8,8 +8,7 @@ use alloy_primitives::TxHash; use alloy_rpc_types_eth::{FilteredParams, Log}; use reth_chainspec::ChainInfo; use reth_errors::ProviderError; -use reth_primitives::RecoveredBlock; -use reth_primitives_traits::{BlockBody, SignedTransaction}; +use reth_primitives_traits::{BlockBody, RecoveredBlock, SignedTransaction}; use reth_storage_api::{BlockReader, ProviderBlock}; use std::sync::Arc; diff --git a/crates/rpc/rpc-eth-types/src/pending_block.rs b/crates/rpc/rpc-eth-types/src/pending_block.rs index 246bc6c49e..7990e2334b 100644 --- a/crates/rpc/rpc-eth-types/src/pending_block.rs +++ b/crates/rpc/rpc-eth-types/src/pending_block.rs @@ -8,9 +8,9 @@ use alloy_consensus::BlockHeader; use alloy_eips::{BlockId, BlockNumberOrTag}; use alloy_primitives::B256; use derive_more::Constructor; +use reth_ethereum_primitives::Receipt; use reth_evm::EvmEnv; -use reth_primitives::{Receipt, RecoveredBlock, SealedHeader}; -use reth_primitives_traits::Block; +use reth_primitives_traits::{Block, RecoveredBlock, SealedHeader}; /// Configured [`EvmEnv`] for a pending block. #[derive(Debug, Clone, Constructor)] @@ -23,7 +23,7 @@ pub struct PendingBlockEnv { /// The origin for a configured [`PendingBlockEnv`] #[derive(Clone, Debug)] -pub enum PendingBlockEnvOrigin { +pub enum PendingBlockEnvOrigin { /// The pending block as received from the CL. ActualPending(RecoveredBlock, Vec), /// The _modified_ header of the latest block. diff --git a/crates/rpc/rpc-eth-types/src/receipt.rs b/crates/rpc/rpc-eth-types/src/receipt.rs index 07688ba38f..a58d9104e8 100644 --- a/crates/rpc/rpc-eth-types/src/receipt.rs +++ b/crates/rpc/rpc-eth-types/src/receipt.rs @@ -5,7 +5,7 @@ use alloy_consensus::{transaction::TransactionMeta, ReceiptEnvelope, TxReceipt}; use alloy_eips::eip7840::BlobParams; use alloy_primitives::{Address, TxKind}; use alloy_rpc_types_eth::{Log, ReceiptWithBloom, TransactionReceipt}; -use reth_primitives::{Receipt, TransactionSigned, TxType}; +use reth_ethereum_primitives::{Receipt, TransactionSigned, TxType}; use reth_primitives_traits::SignedTransaction; /// Builds an [`TransactionReceipt`] obtaining the inner receipt envelope from the given closure. diff --git a/crates/rpc/rpc-eth-types/src/simulate.rs b/crates/rpc/rpc-eth-types/src/simulate.rs index 76a76aa28b..9aa21734e8 100644 --- a/crates/rpc/rpc-eth-types/src/simulate.rs +++ b/crates/rpc/rpc-eth-types/src/simulate.rs @@ -11,8 +11,9 @@ use reth_evm::{ execute::{BlockBuilder, BlockBuilderOutcome, BlockExecutor}, Evm, }; -use reth_primitives::{Recovered, RecoveredBlock, TxTy}; -use reth_primitives_traits::{block::BlockTx, BlockBody as _, SignedTransaction}; +use reth_primitives_traits::{ + block::BlockTx, BlockBody as _, Recovered, RecoveredBlock, SignedTransaction, TxTy, +}; use reth_rpc_server_types::result::rpc_err; use reth_rpc_types_compat::{block::from_block, TransactionCompat}; use reth_storage_api::noop::NoopProvider; diff --git a/crates/rpc/rpc-eth-types/src/transaction.rs b/crates/rpc/rpc-eth-types/src/transaction.rs index fa24de905b..34d80d9114 100644 --- a/crates/rpc/rpc-eth-types/src/transaction.rs +++ b/crates/rpc/rpc-eth-types/src/transaction.rs @@ -4,8 +4,8 @@ use alloy_primitives::B256; use alloy_rpc_types_eth::TransactionInfo; -use reth_primitives::{Recovered, TransactionSigned}; -use reth_primitives_traits::SignedTransaction; +use reth_ethereum_primitives::TransactionSigned; +use reth_primitives_traits::{Recovered, SignedTransaction}; use reth_rpc_types_compat::TransactionCompat; /// Represents from where a transaction was fetched. diff --git a/crates/rpc/rpc-eth-types/src/utils.rs b/crates/rpc/rpc-eth-types/src/utils.rs index cb63f7eec7..e7873920a9 100644 --- a/crates/rpc/rpc-eth-types/src/utils.rs +++ b/crates/rpc/rpc-eth-types/src/utils.rs @@ -1,8 +1,7 @@ //! Commonly used code snippets use super::{EthApiError, EthResult}; -use reth_primitives::Recovered; -use reth_primitives_traits::SignedTransaction; +use reth_primitives_traits::{Recovered, SignedTransaction}; use std::future::Future; /// Recovers a [`SignedTransaction`] from an enveloped encoded byte stream.