primitives: rm more alloy block reexports (#12308)

This commit is contained in:
Thomas Coratger
2024-11-05 12:37:56 +01:00
committed by GitHub
parent 556995fc5d
commit 441ddbf085
23 changed files with 38 additions and 41 deletions

View File

@@ -74,7 +74,7 @@ where
pub fn new(inner: EthTransactionValidator<Client, Tx>) -> Self {
let this = Self::with_block_info(inner, OpL1BlockInfo::default());
if let Ok(Some(block)) =
this.inner.client().block_by_number_or_tag(reth_primitives::BlockNumberOrTag::Latest)
this.inner.client().block_by_number_or_tag(alloy_eips::BlockNumberOrTag::Latest)
{
// genesis block has no txs, so we can't extract L1 info, we set the block info to empty
// so that we will accept txs into the pool before the first block

View File

@@ -1,12 +1,11 @@
//! Loads OP pending block for a RPC response.
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{BlockNumber, B256};
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_evm::ConfigureEvm;
use reth_optimism_consensus::calculate_receipt_root_no_memo_optimism;
use reth_primitives::{
revm_primitives::BlockEnv, BlockNumberOrTag, Header, Receipt, SealedBlockWithSenders,
};
use reth_primitives::{revm_primitives::BlockEnv, Header, Receipt, SealedBlockWithSenders};
use reth_provider::{
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ExecutionOutcome,
ReceiptProvider, StateProviderFactory,

View File

@@ -10,7 +10,7 @@
use crate::metrics::PayloadBuilderMetrics;
use alloy_consensus::constants::EMPTY_WITHDRAWALS;
use alloy_eips::merge::SLOT_DURATION;
use alloy_eips::{merge::SLOT_DURATION, BlockNumberOrTag};
use alloy_primitives::{Bytes, B256, U256};
use futures_core::ready;
use futures_util::FutureExt;
@@ -20,9 +20,7 @@ use reth_payload_builder::{KeepPayloadJobAlive, PayloadId, PayloadJob, PayloadJo
use reth_payload_primitives::{
BuiltPayload, PayloadBuilderAttributes, PayloadBuilderError, PayloadKind,
};
use reth_primitives::{
constants::RETH_CLIENT_VERSION, proofs, BlockNumberOrTag, SealedHeader, Withdrawals,
};
use reth_primitives::{constants::RETH_CLIENT_VERSION, proofs, SealedHeader, Withdrawals};
use reth_provider::{
BlockReaderIdExt, BlockSource, CanonStateNotification, ProviderError, StateProviderFactory,
};

View File

@@ -2,7 +2,6 @@ use crate::{
GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, Withdrawals,
};
use alloc::vec::Vec;
pub use alloy_eips::eip1898::{BlockNumberOrTag, ForkBlock, RpcBlockHash};
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{Address, Bytes, Sealable, B256};
use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable};
@@ -904,8 +903,11 @@ pub(super) mod serde_bincode_compat {
#[cfg(test)]
mod tests {
use super::{BlockNumberOrTag::*, *};
use alloy_eips::{eip1898::HexStringMissingPrefixError, BlockId};
use super::*;
use alloy_eips::{
eip1898::HexStringMissingPrefixError, BlockId, BlockNumberOrTag, BlockNumberOrTag::*,
RpcBlockHash,
};
use alloy_primitives::hex_literal::hex;
use alloy_rlp::{Decodable, Encodable};
use std::str::FromStr;

View File

@@ -33,10 +33,7 @@ pub use reth_static_file_types as static_file;
pub mod transaction;
#[cfg(any(test, feature = "arbitrary"))]
pub use block::{generate_valid_header, valid_header_strategy};
pub use block::{
Block, BlockBody, BlockNumberOrTag, BlockWithSenders, ForkBlock, RpcBlockHash, SealedBlock,
SealedBlockWithSenders,
};
pub use block::{Block, BlockBody, BlockWithSenders, SealedBlock, SealedBlockWithSenders};
#[cfg(feature = "reth-codec")]
pub use compression::*;
pub use constants::HOLESKY_GENESIS_HASH;

View File

@@ -13,7 +13,6 @@ workspace = true
[dependencies]
# reth
reth-primitives.workspace = true
reth-rpc-eth-api.workspace = true
reth-engine-primitives.workspace = true
reth-network-peers.workspace = true

View File

@@ -1,4 +1,4 @@
use alloy_eips::BlockId;
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::{Address, Bytes, B256};
use alloy_rpc_types::{Block, Bundle, StateContext};
use alloy_rpc_types_debug::ExecutionWitness;
@@ -7,7 +7,6 @@ use alloy_rpc_types_trace::geth::{
BlockTraceResult, GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult,
};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::BlockNumberOrTag;
/// Debug rpc interface.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "debug"))]

View File

@@ -2,7 +2,7 @@
//! Standalone http tests
use crate::utils::{launch_http, launch_http_ws, launch_ws};
use alloy_eips::BlockId;
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::{hex_literal::hex, Address, Bytes, TxHash, B256, B64, U256, U64};
use alloy_rpc_types_eth::{
transaction::TransactionRequest, Block, FeeHistory, Filter, Index, Log,
@@ -19,7 +19,7 @@ use jsonrpsee::{
types::error::ErrorCode,
};
use reth_network_peers::NodeRecord;
use reth_primitives::{BlockNumberOrTag, Receipt};
use reth_primitives::Receipt;
use reth_rpc_api::{
clients::{AdminApiClient, EthApiClient},
DebugApiClient, EthFilterApiClient, NetApiClient, OtterscanClient, TraceApiClient,

View File

@@ -1,7 +1,7 @@
//! Implementation of the [`jsonrpsee`] generated [`EthApiServer`] trait. Handles RPC requests for
//! the `eth_` namespace.
use alloy_dyn_abi::TypedData;
use alloy_eips::{eip2930::AccessListResult, BlockId};
use alloy_eips::{eip2930::AccessListResult, BlockId, BlockNumberOrTag};
use alloy_json_rpc::RpcObject;
use alloy_primitives::{Address, Bytes, B256, B64, U256, U64};
use alloy_rpc_types::{
@@ -13,7 +13,6 @@ use alloy_rpc_types::{
};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::BlockNumberOrTag;
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
use tracing::trace;

View File

@@ -30,7 +30,7 @@ pub trait EthState: LoadState + SpawnBlocking {
/// Returns the number of transactions sent from an address at the given block identifier.
///
/// If this is [`BlockNumberOrTag::Pending`](reth_primitives::BlockNumberOrTag) then this will
/// If this is [`BlockNumberOrTag::Pending`](alloy_eips::BlockNumberOrTag) then this will
/// look up the highest transaction in pool and return the next nonce (highest + 1).
fn transaction_count(
&self,
@@ -184,7 +184,7 @@ pub trait LoadState:
/// Returns the state at the given [`BlockId`] enum.
///
/// Note: if not [`BlockNumberOrTag::Pending`](reth_primitives::BlockNumberOrTag) then this
/// Note: if not [`BlockNumberOrTag::Pending`](alloy_eips::BlockNumberOrTag) then this
/// will only return canonical state. See also <https://github.com/paradigmxyz/reth/issues/4515>
fn state_at_block_id(&self, at: BlockId) -> Result<StateProviderBox, Self::Error> {
self.provider().state_by_block_id(at).map_err(Self::Error::from_eth_err)
@@ -302,7 +302,7 @@ pub trait LoadState:
/// Returns the number of transactions sent from an address at the given block identifier.
///
/// If this is [`BlockNumberOrTag::Pending`](reth_primitives::BlockNumberOrTag) then this will
/// If this is [`BlockNumberOrTag::Pending`](alloy_eips::BlockNumberOrTag) then this will
/// look up the highest transaction in pool and return the next nonce (highest + 1).
fn transaction_count(
&self,

View File

@@ -2,11 +2,11 @@
//! previous blocks.
use alloy_consensus::constants::GWEI_TO_WEI;
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{B256, U256};
use alloy_rpc_types::BlockId;
use derive_more::{Deref, DerefMut, From, Into};
use itertools::Itertools;
use reth_primitives::BlockNumberOrTag;
use reth_rpc_server_types::constants;
use reth_storage_api::BlockReaderIdExt;
use schnellru::{ByLength, LruMap};

View File

@@ -4,10 +4,10 @@
use std::time::Instant;
use alloy_eips::BlockId;
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::B256;
use derive_more::Constructor;
use reth_primitives::{BlockNumberOrTag, Receipt, SealedBlockWithSenders, SealedHeader};
use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader};
use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg};
/// Configured [`BlockEnv`] and [`CfgEnvWithHandlerCfg`] for a pending block.

View File

@@ -514,9 +514,9 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloy_eips::BlockNumberOrTag;
use alloy_rpc_types_trace::filter::TraceFilterMode;
use jsonrpsee::http_client::HttpClientBuilder;
use reth_primitives::BlockNumberOrTag;
const fn assert_is_stream<St: Stream>(_: &St) {}

View File

@@ -1,4 +1,4 @@
use alloy_eips::{eip2718::Encodable2718, BlockId};
use alloy_eips::{eip2718::Encodable2718, BlockId, BlockNumberOrTag};
use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rlp::{Decodable, Encodable};
use alloy_rpc_types::{
@@ -19,7 +19,7 @@ use reth_evm::{
system_calls::SystemCaller,
ConfigureEvmEnv,
};
use reth_primitives::{Block, BlockNumberOrTag, TransactionSignedEcRecovered};
use reth_primitives::{Block, TransactionSignedEcRecovered};
use reth_provider::{
BlockReaderIdExt, ChainSpecProvider, HeaderProvider, StateProofProvider, StateProviderFactory,
TransactionVariant,

View File

@@ -1,4 +1,4 @@
use alloy_eips::BlockId;
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::{Address, Bytes, B256, U256, U64};
use alloy_rpc_types::{
state::StateOverride, BlockOverrides, EIP1186AccountProofResponse, Filter, Log, SyncStatus,
@@ -6,7 +6,6 @@ use alloy_rpc_types::{
use alloy_rpc_types_eth::transaction::TransactionRequest;
use alloy_serde::JsonStorageKey;
use jsonrpsee::core::RpcResult as Result;
use reth_primitives::BlockNumberOrTag;
use reth_rpc_api::{EngineEthApiServer, EthApiServer, EthFilterApiServer};
/// Re-export for convenience
pub use reth_rpc_engine_api::EngineApi;

View File

@@ -3,10 +3,10 @@
use std::sync::Arc;
use alloy_eips::BlockNumberOrTag;
use alloy_network::Ethereum;
use alloy_primitives::U256;
use derive_more::Deref;
use reth_primitives::BlockNumberOrTag;
use reth_provider::{BlockReaderIdExt, CanonStateSubscriptions, ChainSpecProvider};
use reth_rpc_eth_api::{
helpers::{EthSigner, SpawnBlocking},
@@ -400,13 +400,14 @@ impl<Provider, Pool, Network, EvmConfig> EthApiInner<Provider, Pool, Network, Ev
#[cfg(test)]
mod tests {
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{B256, U64};
use alloy_rpc_types::FeeHistory;
use jsonrpsee_types::error::INVALID_PARAMS_CODE;
use reth_chainspec::{BaseFeeParams, ChainSpec, EthChainSpec};
use reth_evm_ethereum::EthEvmConfig;
use reth_network_api::noop::NoopNetwork;
use reth_primitives::{Block, BlockBody, BlockNumberOrTag, Header, TransactionSigned};
use reth_primitives::{Block, BlockBody, Header, TransactionSigned};
use reth_provider::{
test_utils::{MockEthProvider, NoopProvider},
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProviderFactory,

View File

@@ -1,5 +1,5 @@
use alloy_consensus::Transaction;
use alloy_eips::BlockId;
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_network::{ReceiptResponse, TransactionResponse};
use alloy_primitives::{Address, Bytes, TxHash, B256, U256};
use alloy_rpc_types::{BlockTransactions, Header, TransactionReceipt};
@@ -12,7 +12,6 @@ use alloy_rpc_types_trace::{
};
use async_trait::async_trait;
use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned};
use reth_primitives::BlockNumberOrTag;
use reth_rpc_api::{EthApiServer, OtterscanServer};
use reth_rpc_eth_api::{
helpers::{EthTransactions, TraceExt},

View File

@@ -7,6 +7,7 @@ use crate::{
traits::{CanonicalStateUpdate, TransactionPool, TransactionPoolExt},
BlockInfo, PoolTransaction,
};
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable};
use futures_util::{
future::{BoxFuture, Fuse, FusedFuture},
@@ -17,7 +18,7 @@ use reth_chainspec::{ChainSpecProvider, EthChainSpec};
use reth_execution_types::ChangedAccount;
use reth_fs_util::FsPathError;
use reth_primitives::{
BlockNumberOrTag, PooledTransactionsElementEcRecovered, SealedHeader, TransactionSigned,
PooledTransactionsElementEcRecovered, SealedHeader, TransactionSigned,
TransactionSignedEcRecovered,
};
use reth_storage_api::{errors::provider::ProviderError, BlockReaderIdExt, StateProviderFactory};