Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

primitives: rm more alloy block reexports #12308

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/optimism/node/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions crates/optimism/rpc/src/eth/pending_block.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
6 changes: 2 additions & 4 deletions crates/payload/basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
};
Expand Down
8 changes: 5 additions & 3 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion crates/rpc/rpc-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc-api/src/debug.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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"))]
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-builder/tests/it/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc-eth-api/src/core.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions crates/rpc/rpc-eth-api/src/helpers/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-types/src/gas_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-eth-types/src/pending_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-testing-util/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
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,
};
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;
Expand Down
5 changes: 3 additions & 2 deletions crates/rpc/rpc/src/eth/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc/src/otterscan.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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},
Expand Down
3 changes: 2 additions & 1 deletion crates/transaction-pool/src/maintain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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};
Expand Down
1 change: 1 addition & 0 deletions examples/custom-inspector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ alloy-rpc-types.workspace = true
clap = { workspace = true, features = ["derive"] }
futures-util.workspace = true
alloy-primitives.workspace = true
alloy-eips.workspace = true
2 changes: 1 addition & 1 deletion examples/custom-inspector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#![cfg_attr(not(test), warn(unused_crate_dependencies))]

use alloy_eips::BlockNumberOrTag;
use alloy_primitives::Address;
use alloy_rpc_types::state::EvmOverrides;
use clap::Parser;
Expand All @@ -18,7 +19,6 @@ use reth::{
builder::NodeHandle,
chainspec::EthereumChainSpecParser,
cli::Cli,
primitives::BlockNumberOrTag,
revm::{
inspector_handle_register,
interpreter::{Interpreter, OpCode},
Expand Down
1 change: 1 addition & 0 deletions examples/custom-payload-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ reth-node-ethereum.workspace = true
reth-ethereum-payload-builder.workspace = true

alloy-primitives.workspace = true
alloy-eips.workspace = true

tracing.workspace = true
futures-util.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion examples/custom-payload-builder/src/generator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::job::EmptyBlockPayloadJob;
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::Bytes;
use reth::{
providers::{BlockReaderIdExt, BlockSource, StateProviderFactory},
Expand All @@ -8,7 +9,7 @@ use reth::{
use reth_basic_payload_builder::{BasicPayloadJobGeneratorConfig, PayloadBuilder, PayloadConfig};
use reth_node_api::PayloadBuilderAttributes;
use reth_payload_builder::{PayloadBuilderError, PayloadJobGenerator};
use reth_primitives::{BlockNumberOrTag, SealedHeader};
use reth_primitives::SealedHeader;
use std::sync::Arc;

/// The generator type that creates new jobs that builds empty blocks.
Expand Down
Loading