chore: rm reth-prmitives from rpc (#14957)

This commit is contained in:
Matthias Seitz
2025-03-11 15:49:53 +01:00
committed by GitHub
parent 707c621cad
commit e5615d0d9d
14 changed files with 50 additions and 44 deletions

2
Cargo.lock generated
View File

@@ -9224,6 +9224,7 @@ dependencies = [
"reth-consensus",
"reth-engine-primitives",
"reth-errors",
"reth-ethereum-primitives",
"reth-evm",
"reth-evm-ethereum",
"reth-metrics",
@@ -9231,7 +9232,6 @@ dependencies = [
"reth-network-peers",
"reth-network-types",
"reth-node-api",
"reth-primitives",
"reth-primitives-traits",
"reth-provider",
"reth-revm",

View File

@@ -14,11 +14,11 @@ workspace = true
[dependencies]
# reth
reth-chainspec.workspace = true
reth-primitives = { workspace = true, features = ["secp256k1"] }
reth-primitives-traits.workspace = true
reth-rpc-api.workspace = true
reth-rpc-eth-api.workspace = true
reth-engine-primitives.workspace = true
reth-ethereum-primitives.workspace = true
reth-errors.workspace = true
reth-metrics.workspace = true
reth-provider.workspace = true

View File

@@ -7,11 +7,10 @@ use alloy_rpc_types_admin::{
};
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_chainspec::{EthChainSpec, EthereumHardforks, ForkCondition};
use reth_chainspec::{EthChainSpec, EthereumHardfork, EthereumHardforks, ForkCondition};
use reth_network_api::{NetworkInfo, Peers};
use reth_network_peers::{id2pk, AnyNode, NodeRecord};
use reth_network_types::PeerKind;
use reth_primitives::EthereumHardfork;
use reth_rpc_api::AdminApiServer;
use reth_rpc_server_types::ToRpcResult;

View File

@@ -20,8 +20,9 @@ use reth_evm::{
execute::{BlockExecutorProvider, Executor},
ConfigureEvm, EvmEnvFor, TxEnvFor,
};
use reth_primitives::{NodePrimitives, ReceiptWithBloom, RecoveredBlock};
use reth_primitives_traits::{Block as _, BlockBody, SignedTransaction};
use reth_primitives_traits::{
Block as _, BlockBody, NodePrimitives, ReceiptWithBloom, RecoveredBlock, SignedTransaction,
};
use reth_provider::{
BlockIdReader, BlockReaderIdExt, ChainSpecProvider, HeaderProvider, ProviderBlock,
ReceiptProviderIdExt, StateProofProvider, StateProvider, StateProviderFactory,

View File

@@ -463,15 +463,15 @@ where
#[cfg(test)]
mod tests {
use crate::{EthApi, EthApiBuilder};
use alloy_consensus::Header;
use alloy_consensus::{Block, BlockBody, Header};
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{PrimitiveSignature as Signature, B256, U64};
use alloy_rpc_types::FeeHistory;
use jsonrpsee_types::error::INVALID_PARAMS_CODE;
use reth_chainspec::{BaseFeeParams, ChainSpec};
use reth_ethereum_primitives::TransactionSigned;
use reth_evm_ethereum::EthEvmConfig;
use reth_network_api::noop::NoopNetwork;
use reth_primitives::{Block, BlockBody, TransactionSigned};
use reth_provider::{
test_utils::{MockEthProvider, NoopProvider},
BlockReader, BlockReaderIdExt, CanonStateSubscriptions, ChainSpecProvider,
@@ -483,13 +483,13 @@ mod tests {
fn build_test_eth_api<
P: BlockReaderIdExt<
Block = reth_primitives::Block,
Receipt = reth_primitives::Receipt,
Header = reth_primitives::Header,
Block = reth_ethereum_primitives::Block,
Receipt = reth_ethereum_primitives::Receipt,
Header = alloy_consensus::Header,
> + BlockReader
+ ChainSpecProvider<ChainSpec = ChainSpec>
+ StateProviderFactory
+ CanonStateSubscriptions<Primitives = reth_primitives::EthPrimitives>
+ CanonStateSubscriptions<Primitives = reth_ethereum_primitives::EthPrimitives>
+ Unpin
+ Clone
+ 'static,
@@ -545,18 +545,20 @@ mod tests {
if let Some(base_fee_per_gas) = header.base_fee_per_gas {
let transaction = TransactionSigned::new_unhashed(
reth_primitives::Transaction::Eip1559(alloy_consensus::TxEip1559 {
max_priority_fee_per_gas: random_fee,
max_fee_per_gas: random_fee + base_fee_per_gas as u128,
..Default::default()
}),
reth_ethereum_primitives::Transaction::Eip1559(
alloy_consensus::TxEip1559 {
max_priority_fee_per_gas: random_fee,
max_fee_per_gas: random_fee + base_fee_per_gas as u128,
..Default::default()
},
),
Signature::test_signature(),
);
transactions.push(transaction);
} else {
let transaction = TransactionSigned::new_unhashed(
reth_primitives::Transaction::Legacy(Default::default()),
reth_ethereum_primitives::Transaction::Legacy(Default::default()),
Signature::test_signature(),
);

View File

@@ -9,7 +9,7 @@ use alloy_rpc_types_eth::{
use async_trait::async_trait;
use jsonrpsee::{core::RpcResult, server::IdProvider};
use reth_chainspec::ChainInfo;
use reth_primitives::RecoveredBlock;
use reth_primitives_traits::RecoveredBlock;
use reth_provider::{
BlockHashReader, BlockIdReader, BlockNumReader, BlockReader, HeaderProvider, ProviderBlock,
ProviderError, ProviderReceipt,

View File

@@ -20,8 +20,8 @@ where
Error = EthApiError,
NetworkTypes: RpcTypes<Receipt = TransactionReceipt>,
Provider: BlockReader<
Transaction = reth_primitives::TransactionSigned,
Receipt = reth_primitives::Receipt,
Transaction = reth_ethereum_primitives::TransactionSigned,
Receipt = reth_ethereum_primitives::Receipt,
>,
>,
Provider: BlockReader + ChainSpecProvider,

View File

@@ -4,7 +4,7 @@ use alloy_consensus::BlockHeader;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_evm::{ConfigureEvm, NextBlockEnvAttributes};
use reth_node_api::NodePrimitives;
use reth_primitives::SealedHeader;
use reth_primitives_traits::SealedHeader;
use reth_provider::{
BlockReader, BlockReaderIdExt, ChainSpecProvider, ProviderBlock, ProviderHeader,
ProviderReceipt, ProviderTx, StateProviderFactory,
@@ -28,10 +28,10 @@ where
Error: FromEvmError<Self::Evm>,
> + RpcNodeCore<
Provider: BlockReaderIdExt<
Transaction = reth_primitives::TransactionSigned,
Block = reth_primitives::Block,
Receipt = reth_primitives::Receipt,
Header = reth_primitives::Header,
Transaction = reth_ethereum_primitives::TransactionSigned,
Block = reth_ethereum_primitives::Block,
Receipt = reth_ethereum_primitives::Receipt,
Header = alloy_consensus::Header,
> + ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks>
+ StateProviderFactory,
Pool: TransactionPool<
@@ -47,7 +47,10 @@ where
NextBlockEnvCtx = NextBlockEnvAttributes,
>,
>,
Provider: BlockReader<Block = reth_primitives::Block, Receipt = reth_primitives::Receipt>,
Provider: BlockReader<
Block = reth_ethereum_primitives::Block,
Receipt = reth_ethereum_primitives::Receipt,
>,
{
#[inline]
fn pending_block(

View File

@@ -2,7 +2,7 @@
use alloy_consensus::transaction::TransactionMeta;
use reth_chainspec::EthChainSpec;
use reth_primitives::{Receipt, TransactionSigned};
use reth_ethereum_primitives::{Receipt, TransactionSigned};
use reth_provider::{BlockReader, ChainSpecProvider, ReceiptProvider, TransactionsProvider};
use reth_rpc_eth_api::{helpers::LoadReceipt, FromEthApiError, RpcNodeCoreExt, RpcReceipt};
use reth_rpc_eth_types::{EthApiError, EthReceiptBuilder};
@@ -13,7 +13,7 @@ impl<Provider, Pool, Network, EvmConfig> LoadReceipt for EthApi<Provider, Pool,
where
Self: RpcNodeCoreExt<
Provider: TransactionsProvider<Transaction = TransactionSigned>
+ ReceiptProvider<Receipt = reth_primitives::Receipt>,
+ ReceiptProvider<Receipt = reth_ethereum_primitives::Receipt>,
>,
Provider: BlockReader + ChainSpecProvider,
{

View File

@@ -107,14 +107,13 @@ impl<T: Decodable2718> EthSigner<T> for DevSigner {
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::Transaction;
use alloy_primitives::{Bytes, U256};
use alloy_rpc_types_eth::TransactionInput;
use reth_primitives::TransactionSigned;
use reth_ethereum_primitives::TransactionSigned;
use revm_primitives::TxKind;
use super::*;
fn build_signer() -> DevSigner {
let signer: PrivateKeySigner =
"4646464646464646464646464646464646464646464646464646464646464646".parse().unwrap();
@@ -193,9 +192,10 @@ mod tests {
let data: TypedData = serde_json::from_str(eip_712_example).unwrap();
let signer = build_signer();
let from = *signer.addresses.first().unwrap();
let sig =
EthSigner::<reth_primitives::TransactionSigned>::sign_typed_data(&signer, from, &data)
.unwrap();
let sig = EthSigner::<reth_ethereum_primitives::TransactionSigned>::sign_typed_data(
&signer, from, &data,
)
.unwrap();
let expected = Signature::new(
U256::from_str_radix(
"5318aee9942b84885761bb20e768372b76e7ee454fc4d39b59ce07338d15a06c",
@@ -217,9 +217,10 @@ mod tests {
let message = b"Test message";
let signer = build_signer();
let from = *signer.addresses.first().unwrap();
let sig = EthSigner::<reth_primitives::TransactionSigned>::sign(&signer, from, message)
.await
.unwrap();
let sig =
EthSigner::<reth_ethereum_primitives::TransactionSigned>::sign(&signer, from, message)
.await
.unwrap();
let expected = Signature::new(
U256::from_str_radix(
"54313da7432e4058b8d22491b2e7dbb19c7186c35c24155bec0820a8a2bfe0c1",

View File

@@ -5,7 +5,8 @@ use alloy_network::{Ethereum, Network};
use alloy_primitives::PrimitiveSignature as Signature;
use alloy_rpc_types::TransactionRequest;
use alloy_rpc_types_eth::{Transaction, TransactionInfo};
use reth_primitives::{Recovered, TransactionSigned};
use reth_ethereum_primitives::TransactionSigned;
use reth_primitives_traits::Recovered;
use reth_rpc_eth_api::EthApiTypes;
use reth_rpc_eth_types::EthApiError;
use reth_rpc_types_compat::TransactionCompat;

View File

@@ -12,7 +12,7 @@ use jsonrpsee::{
server::SubscriptionMessage, types::ErrorObject, PendingSubscriptionSink, SubscriptionSink,
};
use reth_network_api::NetworkInfo;
use reth_primitives::NodePrimitives;
use reth_primitives_traits::NodePrimitives;
use reth_provider::{BlockNumReader, CanonStateSubscriptions};
use reth_rpc_eth_api::{
pubsub::EthPubSubApiServer, EthApiTypes, RpcNodeCore, RpcTransaction, TransactionCompat,

View File

@@ -10,8 +10,7 @@ use alloy_rpc_types_mev::{
};
use jsonrpsee::core::RpcResult;
use reth_evm::{ConfigureEvm, Evm};
use reth_primitives::Recovered;
use reth_primitives_traits::SignedTransaction;
use reth_primitives_traits::{Recovered, SignedTransaction};
use reth_provider::ProviderTx;
use reth_revm::{database::StateProviderDatabase, db::CacheDB};
use reth_rpc_api::MevSimApiServer;

View File

@@ -20,9 +20,9 @@ use reth_errors::{BlockExecutionError, ConsensusError, ProviderError};
use reth_evm::execute::{BlockExecutorProvider, Executor};
use reth_metrics::{metrics, metrics::Gauge, Metrics};
use reth_node_api::NewPayloadError;
use reth_primitives::{GotExpected, NodePrimitives, RecoveredBlock};
use reth_primitives_traits::{
constants::GAS_LIMIT_BOUND_DIVISOR, BlockBody, SealedBlock, SealedHeaderFor,
constants::GAS_LIMIT_BOUND_DIVISOR, BlockBody, GotExpected, NodePrimitives, RecoveredBlock,
SealedBlock, SealedHeaderFor,
};
use reth_provider::{BlockExecutionOutput, BlockReaderIdExt, StateProviderFactory};
use reth_revm::{cached::CachedReads, database::StateProviderDatabase};