primitives: rm alloy BlockHashOrNumber reexport (#12302)

This commit is contained in:
Thomas Coratger
2024-11-04 11:15:56 +01:00
committed by GitHub
parent 56b76871ed
commit 566f2b4950
17 changed files with 30 additions and 30 deletions

View File

@ -1,6 +1,7 @@
//! Command for debugging execution. //! Command for debugging execution.
use crate::{args::NetworkArgs, utils::get_single_header}; use crate::{args::NetworkArgs, utils::get_single_header};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{BlockNumber, B256}; use alloy_primitives::{BlockNumber, B256};
use clap::Parser; use clap::Parser;
use futures::{stream::select as stream_select, StreamExt}; use futures::{stream::select as stream_select, StreamExt};
@ -23,7 +24,6 @@ use reth_network_api::NetworkInfo;
use reth_network_p2p::{headers::client::HeadersClient, BlockClient}; use reth_network_p2p::{headers::client::HeadersClient, BlockClient};
use reth_node_api::{NodeTypesWithDB, NodeTypesWithDBAdapter, NodeTypesWithEngine}; use reth_node_api::{NodeTypesWithDB, NodeTypesWithDBAdapter, NodeTypesWithEngine};
use reth_node_ethereum::EthExecutorProvider; use reth_node_ethereum::EthExecutorProvider;
use reth_primitives::BlockHashOrNumber;
use reth_provider::{ use reth_provider::{
BlockExecutionWriter, ChainSpecProvider, ProviderFactory, StageCheckpointReader, BlockExecutionWriter, ChainSpecProvider, ProviderFactory, StageCheckpointReader,
}; };

View File

@ -4,6 +4,7 @@ use crate::{
args::NetworkArgs, args::NetworkArgs,
utils::{get_single_body, get_single_header}, utils::{get_single_body, get_single_header},
}; };
use alloy_eips::BlockHashOrNumber;
use backon::{ConstantBuilder, Retryable}; use backon::{ConstantBuilder, Retryable};
use clap::Parser; use clap::Parser;
use reth_chainspec::ChainSpec; use reth_chainspec::ChainSpec;
@ -19,7 +20,6 @@ use reth_network::{BlockDownloaderProvider, NetworkHandle};
use reth_network_api::NetworkInfo; use reth_network_api::NetworkInfo;
use reth_node_api::{NodeTypesWithDB, NodeTypesWithEngine}; use reth_node_api::{NodeTypesWithDB, NodeTypesWithEngine};
use reth_node_ethereum::EthExecutorProvider; use reth_node_ethereum::EthExecutorProvider;
use reth_primitives::BlockHashOrNumber;
use reth_provider::{ use reth_provider::{
writer::UnifiedStorageWriter, AccountExtReader, ChainSpecProvider, HashingWriter, writer::UnifiedStorageWriter, AccountExtReader, ChainSpecProvider, HashingWriter,
HeaderProvider, LatestStateProviderRef, OriginalValuesKnown, ProviderFactory, HeaderProvider, LatestStateProviderRef, OriginalValuesKnown, ProviderFactory,

View File

@ -1,5 +1,6 @@
//! Command for debugging merkle trie calculation. //! Command for debugging merkle trie calculation.
use crate::{args::NetworkArgs, utils::get_single_header}; use crate::{args::NetworkArgs, utils::get_single_header};
use alloy_eips::BlockHashOrNumber;
use backon::{ConstantBuilder, Retryable}; use backon::{ConstantBuilder, Retryable};
use clap::Parser; use clap::Parser;
use reth_beacon_consensus::EthBeaconConsensus; use reth_beacon_consensus::EthBeaconConsensus;
@ -18,7 +19,6 @@ use reth_network_api::NetworkInfo;
use reth_network_p2p::full_block::FullBlockClient; use reth_network_p2p::full_block::FullBlockClient;
use reth_node_api::{NodeTypesWithDB, NodeTypesWithEngine}; use reth_node_api::{NodeTypesWithDB, NodeTypesWithEngine};
use reth_node_ethereum::EthExecutorProvider; use reth_node_ethereum::EthExecutorProvider;
use reth_primitives::BlockHashOrNumber;
use reth_provider::{ use reth_provider::{
writer::UnifiedStorageWriter, BlockNumReader, BlockWriter, ChainSpecProvider, writer::UnifiedStorageWriter, BlockNumReader, BlockWriter, ChainSpecProvider,
DatabaseProviderFactory, HeaderProvider, LatestStateProviderRef, OriginalValuesKnown, DatabaseProviderFactory, HeaderProvider, LatestStateProviderRef, OriginalValuesKnown,

View File

@ -1,6 +1,7 @@
//! This includes download client implementations for auto sealing miners. //! This includes download client implementations for auto sealing miners.
use crate::Storage; use crate::Storage;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::B256; use alloy_primitives::B256;
use reth_network_p2p::{ use reth_network_p2p::{
bodies::client::{BodiesClient, BodiesFut}, bodies::client::{BodiesClient, BodiesFut},
@ -9,7 +10,7 @@ use reth_network_p2p::{
priority::Priority, priority::Priority,
}; };
use reth_network_peers::{PeerId, WithPeerId}; use reth_network_peers::{PeerId, WithPeerId};
use reth_primitives::{BlockBody, BlockHashOrNumber, Header}; use reth_primitives::{BlockBody, Header};
use std::fmt::Debug; use std::fmt::Debug;
use tracing::{trace, warn}; use tracing::{trace, warn};

View File

@ -15,7 +15,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use alloy_eips::eip7685::Requests; use alloy_eips::{eip1898::BlockHashOrNumber, eip7685::Requests};
use alloy_primitives::{BlockHash, BlockNumber, Bloom, B256, U256}; use alloy_primitives::{BlockHash, BlockNumber, Bloom, B256, U256};
use reth_beacon_consensus::BeaconEngineMessage; use reth_beacon_consensus::BeaconEngineMessage;
use reth_chainspec::{EthChainSpec, EthereumHardforks}; use reth_chainspec::{EthChainSpec, EthereumHardforks};
@ -26,8 +26,8 @@ use reth_execution_errors::{
}; };
use reth_execution_types::ExecutionOutcome; use reth_execution_types::ExecutionOutcome;
use reth_primitives::{ use reth_primitives::{
proofs, Block, BlockBody, BlockHashOrNumber, BlockWithSenders, Header, SealedBlock, proofs, Block, BlockBody, BlockWithSenders, Header, SealedBlock, SealedHeader,
SealedHeader, TransactionSigned, Withdrawals, TransactionSigned, Withdrawals,
}; };
use reth_provider::{BlockReaderIdExt, StateProviderFactory, StateRootProvider}; use reth_provider::{BlockReaderIdExt, StateProviderFactory, StateRootProvider};
use reth_revm::database::StateProviderDatabase; use reth_revm::database::StateProviderDatabase;

View File

@ -275,7 +275,7 @@ pub fn validate_against_parent_4844(
mod tests { mod tests {
use super::*; use super::*;
use alloy_consensus::{TxEip4844, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH}; use alloy_consensus::{TxEip4844, EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloy_eips::eip4895::Withdrawal; use alloy_eips::{eip4895::Withdrawal, BlockHashOrNumber};
use alloy_primitives::{ use alloy_primitives::{
hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, Parity, Sealable, U256, hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, Parity, Sealable, U256,
}; };
@ -283,8 +283,7 @@ mod tests {
use rand::Rng; use rand::Rng;
use reth_chainspec::ChainSpecBuilder; use reth_chainspec::ChainSpecBuilder;
use reth_primitives::{ use reth_primitives::{
proofs, Account, BlockBody, BlockHashOrNumber, Signature, Transaction, TransactionSigned, proofs, Account, BlockBody, Signature, Transaction, TransactionSigned, Withdrawals,
Withdrawals,
}; };
use reth_storage_api::{ use reth_storage_api::{
errors::provider::ProviderResult, AccountReader, HeaderProvider, WithdrawalsProvider, errors::provider::ProviderResult, AccountReader, HeaderProvider, WithdrawalsProvider,

View File

@ -47,7 +47,7 @@ workspace = true
[features] [features]
optimism = [ optimism = [
"op-alloy-rpc-types-engine", "op-alloy-rpc-types-engine",
"reth-beacon-consensus/optimism", "reth-beacon-consensus/optimism",
"reth-provider/optimism" "reth-provider/optimism",
] ]

View File

@ -1,7 +1,7 @@
//! Provider trait for populating the EVM environment. //! Provider trait for populating the EVM environment.
use crate::ConfigureEvmEnv; use crate::ConfigureEvmEnv;
use alloy_eips::eip1898::BlockHashOrNumber; use alloy_eips::BlockHashOrNumber;
use reth_primitives::Header; use reth_primitives::Header;
use reth_storage_errors::provider::ProviderResult; use reth_storage_errors::provider::ProviderResult;
use revm::primitives::{BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, SpecId}; use revm::primitives::{BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, SpecId};

View File

@ -113,9 +113,10 @@ mod tests {
HeadersDirection, HeadersDirection,
}; };
use alloy_consensus::TxLegacy; use alloy_consensus::TxLegacy;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{hex, Parity, TxKind, U256}; use alloy_primitives::{hex, Parity, TxKind, U256};
use alloy_rlp::{Decodable, Encodable}; use alloy_rlp::{Decodable, Encodable};
use reth_primitives::{BlockHashOrNumber, Header, Signature, Transaction, TransactionSigned}; use reth_primitives::{Header, Signature, Transaction, TransactionSigned};
use std::str::FromStr; use std::str::FromStr;
use super::BlockBody; use super::BlockBody;

View File

@ -15,8 +15,9 @@ use reth_network_p2p::headers::client::HeadersClient;
use serde::{de::DeserializeOwned, Serialize}; use serde::{de::DeserializeOwned, Serialize};
use std::{fs, path::Path}; use std::{fs, path::Path};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{BlockNumber, B256}; use alloy_primitives::{BlockNumber, B256};
use reth_primitives::{BlockHashOrNumber, Head, SealedHeader}; use reth_primitives::{Head, SealedHeader};
use reth_stages_types::StageId; use reth_stages_types::StageId;
use reth_storage_api::{ use reth_storage_api::{
BlockHashReader, DatabaseProviderFactory, HeaderProvider, StageCheckpointReader, BlockHashReader, DatabaseProviderFactory, HeaderProvider, StageCheckpointReader,

View File

@ -1,6 +1,7 @@
//! Utility functions for node startup and shutdown, for example path parsing and retrieving single //! Utility functions for node startup and shutdown, for example path parsing and retrieving single
//! blocks from the network. //! blocks from the network.
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::Sealable; use alloy_primitives::Sealable;
use alloy_rpc_types_engine::{JwtError, JwtSecret}; use alloy_rpc_types_engine::{JwtError, JwtSecret};
use eyre::Result; use eyre::Result;
@ -11,7 +12,7 @@ use reth_network_p2p::{
headers::client::{HeadersClient, HeadersDirection, HeadersRequest}, headers::client::{HeadersClient, HeadersDirection, HeadersRequest},
priority::Priority, priority::Priority,
}; };
use reth_primitives::{BlockHashOrNumber, SealedBlock, SealedHeader}; use reth_primitives::{SealedBlock, SealedHeader};
use std::{ use std::{
env::VarError, env::VarError,
path::{Path, PathBuf}, path::{Path, PathBuf},

View File

@ -2,9 +2,7 @@ use crate::{
GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, Withdrawals, GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, Withdrawals,
}; };
use alloc::vec::Vec; use alloc::vec::Vec;
pub use alloy_eips::eip1898::{ pub use alloy_eips::eip1898::{BlockId, BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash};
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash,
};
use alloy_eips::eip2718::Encodable2718; use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{Address, Bytes, Sealable, B256}; use alloy_primitives::{Address, Bytes, Sealable, B256};
use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable}; use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable};

View File

@ -34,8 +34,8 @@ pub mod transaction;
#[cfg(any(test, feature = "arbitrary"))] #[cfg(any(test, feature = "arbitrary"))]
pub use block::{generate_valid_header, valid_header_strategy}; pub use block::{generate_valid_header, valid_header_strategy};
pub use block::{ pub use block::{
Block, BlockBody, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, BlockWithSenders, Block, BlockBody, BlockId, BlockNumHash, BlockNumberOrTag, BlockWithSenders, ForkBlock,
ForkBlock, RpcBlockHash, SealedBlock, SealedBlockWithSenders, RpcBlockHash, SealedBlock, SealedBlockWithSenders,
}; };
#[cfg(feature = "reth-codec")] #[cfg(feature = "reth-codec")]
pub use compression::*; pub use compression::*;

View File

@ -1,12 +1,12 @@
//! Transaction types. //! Transaction types.
use crate::BlockHashOrNumber;
#[cfg(any(test, feature = "reth-codec"))] #[cfg(any(test, feature = "reth-codec"))]
use alloy_consensus::constants::{EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID}; use alloy_consensus::constants::{EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID};
use alloy_consensus::{ use alloy_consensus::{
SignableTransaction, Transaction as _, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy, SignableTransaction, Transaction as _, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy,
}; };
use alloy_eips::{ use alloy_eips::{
eip1898::BlockHashOrNumber,
eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718}, eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718},
eip2930::AccessList, eip2930::AccessList,
eip7702::SignedAuthorization, eip7702::SignedAuthorization,

View File

@ -1,7 +1,7 @@
use crate::{ use crate::{
capabilities::EngineCapabilities, metrics::EngineApiMetrics, EngineApiError, EngineApiResult, capabilities::EngineCapabilities, metrics::EngineApiMetrics, EngineApiError, EngineApiResult,
}; };
use alloy_eips::{eip4844::BlobAndProofV1, eip7685::Requests}; use alloy_eips::{eip1898::BlockHashOrNumber, eip4844::BlobAndProofV1, eip7685::Requests};
use alloy_primitives::{BlockHash, BlockNumber, B256, U64}; use alloy_primitives::{BlockHash, BlockNumber, B256, U64};
use alloy_rpc_types_engine::{ use alloy_rpc_types_engine::{
CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1, CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1,
@ -19,7 +19,7 @@ use reth_payload_primitives::{
validate_payload_timestamp, EngineApiMessageVersion, PayloadBuilderAttributes, validate_payload_timestamp, EngineApiMessageVersion, PayloadBuilderAttributes,
PayloadOrAttributes, PayloadOrAttributes,
}; };
use reth_primitives::{Block, BlockHashOrNumber, EthereumHardfork}; use reth_primitives::{Block, EthereumHardfork};
use reth_rpc_api::EngineApiServer; use reth_rpc_api::EngineApiServer;
use reth_rpc_types_compat::engine::payload::{ use reth_rpc_types_compat::engine::payload::{
convert_payload_input_v2_to_payload, convert_to_payload_body_v1, convert_payload_input_v2_to_payload, convert_to_payload_body_v1,

View File

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

View File

@ -1444,7 +1444,7 @@ mod tests {
assert_eq!( assert_eq!(
provider provider
.withdrawals_by_block( .withdrawals_by_block(
reth_primitives::BlockHashOrNumber::Number(15), alloy_eips::BlockHashOrNumber::Number(15),
shainghai_timestamp shainghai_timestamp
) )
.expect("could not call withdrawals by block"), .expect("could not call withdrawals by block"),
@ -1456,7 +1456,7 @@ mod tests {
assert_eq!( assert_eq!(
provider provider
.withdrawals_by_block( .withdrawals_by_block(
reth_primitives::BlockHashOrNumber::Number(block.number), alloy_eips::BlockHashOrNumber::Number(block.number),
shainghai_timestamp shainghai_timestamp
)? )?
.unwrap(), .unwrap(),