primitives: rm alloy Header reexport (#12515)

This commit is contained in:
Thomas Coratger
2024-11-13 17:41:25 +01:00
committed by GitHub
parent e6f3191c62
commit 001f3899fd
134 changed files with 493 additions and 439 deletions

View File

@ -29,7 +29,8 @@ reth-tasks = { workspace = true, features = ["rayon"] }
reth-transaction-pool.workspace = true
reth-evm.workspace = true
reth-engine-primitives.workspace = true
reth-primitives.workspace = true
alloy-consensus.workspace = true
# rpc/net
jsonrpsee = { workspace = true, features = ["server"] }
@ -63,6 +64,7 @@ reth-rpc-engine-api.workspace = true
reth-tracing.workspace = true
reth-transaction-pool = { workspace = true, features = ["test-utils"] }
reth-rpc-types-compat.workspace = true
reth-primitives.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true

View File

@ -1,5 +1,5 @@
use alloy_consensus::Header;
use reth_evm::ConfigureEvm;
use reth_primitives::Header;
use reth_provider::{BlockReader, CanonStateSubscriptions, EvmEnvProvider, StateProviderFactory};
use reth_rpc::{EthFilter, EthPubSub};
use reth_rpc_eth_api::EthApiTypes;

View File

@ -16,9 +16,9 @@
//! Configure only an http server with a selection of [`RethRpcModule`]s
//!
//! ```
//! use alloy_consensus::Header;
//! use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
//! use reth_network_api::{NetworkInfo, Peers};
//! use reth_primitives::Header;
//! use reth_provider::{AccountReader, CanonStateSubscriptions, ChangeSetReader, FullRpcProvider};
//! use reth_rpc::EthApi;
//! use reth_rpc_builder::{
@ -73,10 +73,10 @@
//!
//!
//! ```
//! use alloy_consensus::Header;
//! use reth_engine_primitives::EngineTypes;
//! use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
//! use reth_network_api::{NetworkInfo, Peers};
//! use reth_primitives::Header;
//! use reth_provider::{AccountReader, CanonStateSubscriptions, ChangeSetReader, FullRpcProvider};
//! use reth_rpc::EthApi;
//! use reth_rpc_api::EngineApiServer;
@ -167,6 +167,7 @@ use std::{
};
use crate::{auth::AuthRpcModule, error::WsHttpSamePortError, metrics::RpcRequestMetrics};
use alloy_consensus::Header;
use error::{ConflictingModules, RpcError, ServerKind};
use eth::DynEthApiBuilder;
use http::{header::AUTHORIZATION, HeaderMap};
@ -183,7 +184,6 @@ use reth_consensus::Consensus;
use reth_engine_primitives::EngineTypes;
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
use reth_network_api::{noop::NoopNetwork, NetworkInfo, Peers};
use reth_primitives::Header;
use reth_provider::{
AccountReader, BlockReader, CanonStateSubscriptions, ChainSpecProvider, ChangeSetReader,
EvmEnvProvider, FullRpcProvider, StateProviderFactory,
@ -259,7 +259,7 @@ where
Network: NetworkInfo + Peers + Clone + 'static,
Tasks: TaskSpawner + Clone + 'static,
Events: CanonStateSubscriptions + Clone + 'static,
EvmConfig: ConfigureEvm<Header = reth_primitives::Header>,
EvmConfig: ConfigureEvm<Header = alloy_consensus::Header>,
EthApi: FullEthApiServer,
BlockExecutor: BlockExecutorProvider,
{
@ -679,11 +679,11 @@ where
/// # Example
///
/// ```no_run
/// use alloy_consensus::Header;
/// use reth_consensus::noop::NoopConsensus;
/// use reth_evm::ConfigureEvm;
/// use reth_evm_ethereum::execute::EthExecutorProvider;
/// use reth_network_api::noop::NoopNetwork;
/// use reth_primitives::Header;
/// use reth_provider::test_utils::{NoopProvider, TestCanonStateSubscriptions};
/// use reth_rpc::EthApi;
/// use reth_rpc_builder::RpcModuleBuilder;

View File

@ -163,7 +163,7 @@ pub trait EthBlocks: LoadBlock {
fn ommers(
&self,
block_id: BlockId,
) -> Result<Option<Vec<reth_primitives::Header>>, Self::Error> {
) -> Result<Option<Vec<alloy_consensus::Header>>, Self::Error> {
self.provider().ommers_by_id(block_id).map_err(Self::Error::from_eth_err)
}

View File

@ -5,7 +5,7 @@ use crate::{
AsEthApiError, FromEthApiError, FromEvmError, FullEthApiTypes, IntoEthApiError, RpcBlock,
RpcNodeCore,
};
use alloy_consensus::BlockHeader;
use alloy_consensus::{BlockHeader, Header};
use alloy_eips::{eip1559::calc_next_block_base_fee, eip2930::AccessListResult};
use alloy_primitives::{Address, Bytes, TxKind, B256, U256};
use alloy_rpc_types_eth::{
@ -22,7 +22,7 @@ use reth_primitives::{
BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, HaltReason,
ResultAndState, TransactTo, TxEnv,
},
Header, TransactionSigned,
TransactionSigned,
};
use reth_provider::{BlockIdReader, ChainSpecProvider, HeaderProvider, StateProvider};
use reth_revm::{database::StateProviderDatabase, db::CacheDB, DatabaseRef};

View File

@ -5,7 +5,7 @@ use std::time::{Duration, Instant};
use crate::{EthApiTypes, FromEthApiError, FromEvmError, RpcNodeCore};
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_consensus::{Header, EMPTY_OMMER_ROOT_HASH};
use alloy_eips::{
eip4844::MAX_DATA_GAS_PER_BLOCK, eip7685::EMPTY_REQUESTS_HASH, merge::BEACON_NONCE,
};
@ -24,8 +24,7 @@ use reth_primitives::{
BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, EVMError, Env, ExecutionResult, InvalidTransaction,
ResultAndState, SpecId,
},
Block, BlockBody, Header, Receipt, SealedBlockWithSenders, SealedHeader,
TransactionSignedEcRecovered,
Block, BlockBody, Receipt, SealedBlockWithSenders, SealedHeader, TransactionSignedEcRecovered,
};
use reth_provider::{
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ProviderError,

View File

@ -1,7 +1,7 @@
//! Loads a pending block from database. Helper trait for `eth_` block, transaction, call and trace
//! RPC methods.
use alloy_consensus::constants::KECCAK_EMPTY;
use alloy_consensus::{constants::KECCAK_EMPTY, Header};
use alloy_eips::BlockId;
use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rpc_types_eth::{Account, EIP1186AccountProofResponse};
@ -10,7 +10,6 @@ use futures::Future;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_errors::RethError;
use reth_evm::ConfigureEvmEnv;
use reth_primitives::Header;
use reth_provider::{
BlockIdReader, BlockNumReader, ChainSpecProvider, StateProvider, StateProviderBox,
StateProviderFactory,

View File

@ -3,12 +3,13 @@
use std::{fmt::Display, sync::Arc};
use crate::{FromEvmError, RpcNodeCore};
use alloy_consensus::Header;
use alloy_primitives::B256;
use alloy_rpc_types_eth::{BlockId, TransactionInfo};
use futures::Future;
use reth_chainspec::ChainSpecProvider;
use reth_evm::{system_calls::SystemCaller, ConfigureEvm, ConfigureEvmEnv};
use reth_primitives::{Header, SealedBlockWithSenders};
use reth_primitives::SealedBlockWithSenders;
use reth_revm::database::StateProviderDatabase;
use reth_rpc_eth_types::{
cache::db::{StateCacheDb, StateCacheDbRefMutWrapper, StateProviderTraitObjWrapper},

View File

@ -1,5 +1,6 @@
//! Async caching support for eth RPC
use alloy_consensus::Header;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::B256;
use futures::{future::Either, Stream, StreamExt};
@ -7,7 +8,7 @@ use reth_chain_state::CanonStateNotification;
use reth_errors::{ProviderError, ProviderResult};
use reth_evm::{provider::EvmEnvProvider, ConfigureEvm};
use reth_execution_types::Chain;
use reth_primitives::{Header, Receipt, SealedBlockWithSenders, TransactionSigned};
use reth_primitives::{Receipt, SealedBlockWithSenders, TransactionSigned};
use reth_storage_api::{BlockReader, StateProviderFactory, TransactionVariant};
use reth_tasks::{TaskSpawner, TokioTaskExecutor};
use revm::primitives::{BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, SpecId};

View File

@ -275,7 +275,7 @@ pub fn build_block<T: TransactionCompat<Error: FromEthApiError>>(
let state_root = db.db.state_root(hashed_state).map_err(T::Error::from_eth_err)?;
let header = reth_primitives::Header {
let header = alloy_consensus::Header {
beneficiary: block_env.coinbase,
difficulty: block_env.difficulty,
number: block_env.number.to(),

View File

@ -1,7 +1,7 @@
//! Standalone Conversion Functions for Handling Different Versions of Execution Payloads in
//! Ethereum's Engine
use alloy_consensus::{constants::MAXIMUM_EXTRA_DATA_SIZE, EMPTY_OMMER_ROOT_HASH};
use alloy_consensus::{constants::MAXIMUM_EXTRA_DATA_SIZE, Header, EMPTY_OMMER_ROOT_HASH};
use alloy_eips::{
eip2718::{Decodable2718, Encodable2718},
eip4895::Withdrawals,
@ -15,7 +15,7 @@ use alloy_rpc_types_engine::{
};
use reth_primitives::{
proofs::{self},
Block, BlockBody, Header, SealedBlock, TransactionSigned,
Block, BlockBody, SealedBlock, TransactionSigned,
};
/// Converts [`ExecutionPayloadV1`] to [`Block`]

View File

@ -405,6 +405,7 @@ impl<Provider, Pool, Network, EvmConfig> EthApiInner<Provider, Pool, Network, Ev
#[cfg(test)]
mod tests {
use alloy_consensus::Header;
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{B256, U64};
use alloy_rpc_types::FeeHistory;
@ -412,7 +413,7 @@ mod tests {
use reth_chainspec::{BaseFeeParams, ChainSpec, EthChainSpec};
use reth_evm_ethereum::EthEvmConfig;
use reth_network_api::noop::NoopNetwork;
use reth_primitives::{Block, BlockBody, Header, TransactionSigned};
use reth_primitives::{Block, BlockBody, TransactionSigned};
use reth_provider::{
test_utils::{MockEthProvider, NoopProvider},
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProviderFactory,

View File

@ -1,7 +1,7 @@
//! Contains RPC handler implementations specific to endpoints that call/execute within evm.
use alloy_consensus::Header;
use reth_evm::ConfigureEvm;
use reth_primitives::Header;
use reth_rpc_eth_api::helpers::{Call, EthCall, LoadPendingBlock, LoadState, SpawnBlocking};
use crate::EthApi;

View File

@ -1,8 +1,8 @@
//! Support for building a pending block with transactions from local view of mempool.
use alloy_consensus::Header;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_evm::ConfigureEvm;
use reth_primitives::Header;
use reth_provider::{BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProviderFactory};
use reth_rpc_eth_api::{
helpers::{LoadPendingBlock, SpawnBlocking},

View File

@ -1,7 +1,7 @@
//! Contains RPC handler implementations specific to tracing.
use alloy_consensus::Header;
use reth_evm::ConfigureEvm;
use reth_primitives::Header;
use reth_rpc_eth_api::helpers::{LoadState, Trace};
use crate::EthApi;

View File

@ -1,3 +1,4 @@
use alloy_consensus::Header;
use alloy_eips::BlockId;
use alloy_primitives::{map::HashSet, Bytes, B256, U256};
use alloy_rpc_types_eth::{
@ -18,7 +19,6 @@ use reth_consensus_common::calc::{
base_block_reward, base_block_reward_pre_merge, block_reward, ommer_reward,
};
use reth_evm::ConfigureEvmEnv;
use reth_primitives::Header;
use reth_provider::{BlockReader, ChainSpecProvider, EvmEnvProvider, StateProviderFactory};
use reth_revm::database::StateProviderDatabase;
use reth_rpc_api::TraceApiServer;