From ea1d04aa75cbd8fcf680c79671290b108642de1a Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Sun, 29 Sep 2024 18:48:54 +0200 Subject: [PATCH] primitives: rm more `alloy_primitives` reexports (#11255) --- Cargo.lock | 8 +++++++- bin/reth-bench/Cargo.toml | 1 + bin/reth-bench/src/bench/new_payload_fcu.rs | 3 ++- bin/reth-bench/src/bench/new_payload_only.rs | 3 ++- bin/reth-bench/src/valid_payload.rs | 2 +- bin/reth/src/commands/debug_cmd/build_block.rs | 3 +-- bin/reth/src/commands/debug_cmd/execution.rs | 4 ++-- crates/consensus/debug-client/Cargo.toml | 2 +- crates/consensus/debug-client/src/client.rs | 2 +- crates/engine/tree/src/tree/persistence_state.rs | 2 +- crates/exex/exex/src/wal/mod.rs | 2 +- crates/net/downloaders/src/receipt_file_client.rs | 4 ++-- crates/net/network/src/protocol.rs | 2 +- crates/net/network/tests/it/multiplex.rs | 5 +++-- crates/node/builder/src/setup.rs | 3 +-- crates/node/core/src/args/gas_price_oracle.rs | 2 +- crates/optimism/cli/src/commands/init_state/bedrock.rs | 4 ++-- crates/optimism/primitives/src/bedrock.rs | 4 ++-- crates/payload/builder/src/lib.rs | 3 ++- crates/primitives/src/block.rs | 4 ++-- crates/primitives/src/lib.rs | 6 +----- crates/primitives/src/proofs.rs | 8 ++++---- crates/primitives/src/receipt.rs | 4 ++-- crates/primitives/src/transaction/access_list.rs | 3 +-- crates/primitives/src/transaction/compat.rs | 4 ++-- crates/primitives/src/transaction/error.rs | 3 ++- crates/primitives/src/transaction/meta.rs | 2 +- crates/primitives/src/transaction/mod.rs | 8 ++++---- crates/primitives/src/transaction/pooled.rs | 4 ++-- crates/primitives/src/transaction/signature.rs | 8 ++++---- crates/primitives/src/transaction/variant.rs | 4 ++-- crates/revm/src/database.rs | 4 ++-- crates/revm/src/state_change.rs | 4 ++-- crates/revm/src/test_utils.rs | 4 ++-- crates/stages/stages/benches/setup/mod.rs | 4 ++-- crates/stages/stages/src/lib.rs | 2 +- crates/stages/stages/src/sets.rs | 2 +- crates/stages/stages/src/stages/bodies.rs | 6 ++---- crates/stages/stages/src/stages/execution.rs | 4 ++-- crates/stages/stages/src/stages/hashing_account.rs | 9 +++++---- crates/stages/stages/src/stages/hashing_storage.rs | 8 ++++---- crates/stages/stages/src/stages/headers.rs | 7 ++++--- crates/stages/stages/src/stages/index_account_history.rs | 3 +-- crates/stages/stages/src/stages/index_storage_history.rs | 4 ++-- crates/stages/stages/src/stages/merkle.rs | 8 ++++---- crates/stages/stages/src/stages/mod.rs | 4 ++-- crates/stages/stages/src/stages/prune.rs | 3 ++- crates/stages/stages/src/stages/sender_recovery.rs | 4 ++-- crates/stages/stages/src/stages/tx_lookup.rs | 4 ++-- crates/stages/stages/src/test_utils/test_db.rs | 5 ++--- crates/storage/provider/src/providers/state/macros.rs | 2 +- crates/storage/provider/src/test_utils/blocks.rs | 7 ++++--- crates/trie/db/src/state.rs | 7 ++++--- examples/beacon-api-sidecar-fetcher/Cargo.toml | 1 + examples/beacon-api-sidecar-fetcher/src/main.rs | 3 ++- examples/beacon-api-sidecar-fetcher/src/mined_sidecar.rs | 3 ++- examples/bsc-p2p/Cargo.toml | 8 +++++++- examples/bsc-p2p/src/chainspec.rs | 2 +- examples/custom-dev-node/Cargo.toml | 1 + examples/custom-dev-node/src/main.rs | 2 +- examples/custom-engine-types/src/main.rs | 4 ++-- examples/custom-evm/src/main.rs | 5 ++--- examples/custom-rlpx-subprotocol/Cargo.toml | 1 + .../src/subprotocol/connection/mod.rs | 2 +- .../src/subprotocol/protocol/proto.rs | 2 +- examples/db-access/src/main.rs | 4 ++-- examples/polygon-p2p/Cargo.toml | 7 ++++++- examples/polygon-p2p/src/chain_cfg.rs | 3 ++- examples/stateful-precompile/src/main.rs | 4 ++-- testing/testing-utils/src/genesis_allocator.rs | 4 ++-- 70 files changed, 150 insertions(+), 128 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9954a4c655f7..7b7cc7f2ca8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2635,6 +2635,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" name = "example-beacon-api-sidecar-fetcher" version = "0.1.0" dependencies = [ + "alloy-primitives", "alloy-rpc-types-beacon", "clap", "eyre", @@ -2665,6 +2666,7 @@ dependencies = [ name = "example-bsc-p2p" version = "0.0.0" dependencies = [ + "alloy-primitives", "reth-chainspec", "reth-discv4", "reth-network", @@ -2683,6 +2685,7 @@ name = "example-custom-dev-node" version = "0.0.0" dependencies = [ "alloy-genesis", + "alloy-primitives", "eyre", "futures-util", "reth", @@ -2779,6 +2782,7 @@ dependencies = [ name = "example-custom-rlpx-subprotocol" version = "0.0.0" dependencies = [ + "alloy-primitives", "eyre", "futures", "rand 0.8.5", @@ -2874,6 +2878,7 @@ dependencies = [ name = "example-polygon-p2p" version = "0.0.0" dependencies = [ + "alloy-primitives", "reth-chainspec", "reth-discv4", "reth-network", @@ -6311,6 +6316,7 @@ version = "1.0.7" dependencies = [ "alloy-eips", "alloy-json-rpc", + "alloy-primitives", "alloy-provider", "alloy-pubsub", "alloy-rpc-client", @@ -6616,6 +6622,7 @@ version = "1.0.7" dependencies = [ "alloy-consensus", "alloy-eips", + "alloy-primitives", "alloy-provider", "alloy-rpc-types", "alloy-rpc-types-engine", @@ -6624,7 +6631,6 @@ dependencies = [ "futures", "reqwest", "reth-node-api", - "reth-node-core", "reth-rpc-api", "reth-rpc-builder", "reth-tracing", diff --git a/bin/reth-bench/Cargo.toml b/bin/reth-bench/Cargo.toml index d9e980f3b0b8..e4e40daeca91 100644 --- a/bin/reth-bench/Cargo.toml +++ b/bin/reth-bench/Cargo.toml @@ -36,6 +36,7 @@ alloy-pubsub.workspace = true alloy-json-rpc.workspace = true alloy-rpc-client.workspace = true alloy-eips.workspace = true +alloy-primitives.workspace = true # reqwest reqwest = { workspace = true, default-features = false, features = [ diff --git a/bin/reth-bench/src/bench/new_payload_fcu.rs b/bin/reth-bench/src/bench/new_payload_fcu.rs index 61780b3ab208..b50b59db3c6e 100644 --- a/bin/reth-bench/src/bench/new_payload_fcu.rs +++ b/bin/reth-bench/src/bench/new_payload_fcu.rs @@ -11,13 +11,14 @@ use crate::{ }, valid_payload::{call_forkchoice_updated, call_new_payload}, }; +use alloy_primitives::B256; use alloy_provider::Provider; use alloy_rpc_types_engine::ForkchoiceState; use clap::Parser; use csv::Writer; use reth_cli_runner::CliContext; use reth_node_core::args::BenchmarkArgs; -use reth_primitives::{Block, B256}; +use reth_primitives::Block; use reth_rpc_types_compat::engine::payload::block_to_payload; use std::time::Instant; use tracing::{debug, info}; diff --git a/bin/reth-bench/src/bench/new_payload_only.rs b/bin/reth-bench/src/bench/new_payload_only.rs index 866ffa5b46e8..ad2d012108b0 100644 --- a/bin/reth-bench/src/bench/new_payload_only.rs +++ b/bin/reth-bench/src/bench/new_payload_only.rs @@ -10,12 +10,13 @@ use crate::{ }, valid_payload::call_new_payload, }; +use alloy_primitives::B256; use alloy_provider::Provider; use clap::Parser; use csv::Writer; use reth_cli_runner::CliContext; use reth_node_core::args::BenchmarkArgs; -use reth_primitives::{Block, B256}; +use reth_primitives::Block; use reth_rpc_types_compat::engine::payload::block_to_payload; use std::time::Instant; use tracing::{debug, info}; diff --git a/bin/reth-bench/src/valid_payload.rs b/bin/reth-bench/src/valid_payload.rs index 51b48227cb2f..6353aea71233 100644 --- a/bin/reth-bench/src/valid_payload.rs +++ b/bin/reth-bench/src/valid_payload.rs @@ -2,6 +2,7 @@ //! response. This is useful for benchmarking, as it allows us to wait for a payload to be valid //! before sending additional calls. +use alloy_primitives::B256; use alloy_provider::{ext::EngineApi, Network}; use alloy_rpc_types_engine::{ ExecutionPayload, ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3, @@ -9,7 +10,6 @@ use alloy_rpc_types_engine::{ }; use alloy_transport::{Transport, TransportResult}; use reth_node_api::EngineApiMessageVersion; -use reth_primitives::B256; use tracing::error; /// An extension trait for providers that implement the engine API, to wait for a VALID response. diff --git a/bin/reth/src/commands/debug_cmd/build_block.rs b/bin/reth/src/commands/debug_cmd/build_block.rs index 57a8ee8a6b8d..3d2dfa62e873 100644 --- a/bin/reth/src/commands/debug_cmd/build_block.rs +++ b/bin/reth/src/commands/debug_cmd/build_block.rs @@ -1,6 +1,6 @@ //! Command for debugging block building. use alloy_consensus::TxEip4844; -use alloy_primitives::Address; +use alloy_primitives::{Address, B256, U256}; use alloy_rlp::Decodable; use alloy_rpc_types::engine::{BlobsBundleV1, PayloadAttributes}; use clap::Parser; @@ -27,7 +27,6 @@ use reth_payload_builder::database::CachedReads; use reth_primitives::{ revm_primitives::KzgSettings, BlobTransaction, BlobTransactionSidecar, Bytes, PooledTransactionsElement, SealedBlock, SealedBlockWithSenders, Transaction, TransactionSigned, - B256, U256, }; use reth_provider::{ providers::BlockchainProvider, BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider, diff --git a/bin/reth/src/commands/debug_cmd/execution.rs b/bin/reth/src/commands/debug_cmd/execution.rs index 46cc6064d25e..215afacb583c 100644 --- a/bin/reth/src/commands/debug_cmd/execution.rs +++ b/bin/reth/src/commands/debug_cmd/execution.rs @@ -1,7 +1,7 @@ //! Command for debugging execution. use crate::{args::NetworkArgs, utils::get_single_header}; -use alloy_primitives::BlockNumber; +use alloy_primitives::{BlockNumber, B256}; use clap::Parser; use futures::{stream::select as stream_select, StreamExt}; use reth_beacon_consensus::EthBeaconConsensus; @@ -23,7 +23,7 @@ use reth_network_api::NetworkInfo; use reth_network_p2p::{headers::client::HeadersClient, BlockClient}; use reth_node_api::{NodeTypesWithDB, NodeTypesWithDBAdapter, NodeTypesWithEngine}; use reth_node_ethereum::EthExecutorProvider; -use reth_primitives::{BlockHashOrNumber, B256}; +use reth_primitives::BlockHashOrNumber; use reth_provider::{ BlockExecutionWriter, ChainSpecProvider, ProviderFactory, StageCheckpointReader, }; diff --git a/crates/consensus/debug-client/Cargo.toml b/crates/consensus/debug-client/Cargo.toml index 74ea61da3451..c37beef10742 100644 --- a/crates/consensus/debug-client/Cargo.toml +++ b/crates/consensus/debug-client/Cargo.toml @@ -13,7 +13,6 @@ workspace = true [dependencies] # reth reth-node-api.workspace = true -reth-node-core.workspace = true reth-rpc-api.workspace = true reth-rpc-builder.workspace = true reth-tracing.workspace = true @@ -24,6 +23,7 @@ alloy-eips.workspace = true alloy-provider = { workspace = true, features = ["ws"] } alloy-rpc-types.workspace = true alloy-rpc-types-engine.workspace = true +alloy-primitives.workspace = true auto_impl.workspace = true futures.workspace = true diff --git a/crates/consensus/debug-client/src/client.rs b/crates/consensus/debug-client/src/client.rs index 1acdd197bfa9..f95d02fbb2f2 100644 --- a/crates/consensus/debug-client/src/client.rs +++ b/crates/consensus/debug-client/src/client.rs @@ -1,9 +1,9 @@ use alloy_consensus::TxEnvelope; use alloy_eips::eip2718::Encodable2718; +use alloy_primitives::B256; use alloy_rpc_types::{Block, BlockTransactions}; use alloy_rpc_types_engine::{ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3}; use reth_node_api::EngineTypes; -use reth_node_core::primitives::B256; use reth_rpc_builder::auth::AuthServerHandle; use reth_tracing::tracing::warn; use ringbuffer::{AllocRingBuffer, RingBuffer}; diff --git a/crates/engine/tree/src/tree/persistence_state.rs b/crates/engine/tree/src/tree/persistence_state.rs index fca51291bb5d..b00b7175ff53 100644 --- a/crates/engine/tree/src/tree/persistence_state.rs +++ b/crates/engine/tree/src/tree/persistence_state.rs @@ -1,5 +1,5 @@ use alloy_eips::BlockNumHash; -use reth_primitives::B256; +use alloy_primitives::B256; use std::{collections::VecDeque, time::Instant}; use tokio::sync::oneshot; use tracing::{debug, trace}; diff --git a/crates/exex/exex/src/wal/mod.rs b/crates/exex/exex/src/wal/mod.rs index 72e60fe1a3db..06c2f6485f00 100644 --- a/crates/exex/exex/src/wal/mod.rs +++ b/crates/exex/exex/src/wal/mod.rs @@ -9,8 +9,8 @@ pub use storage::Storage; use std::{path::Path, sync::Arc}; use alloy_eips::BlockNumHash; +use alloy_primitives::B256; use reth_exex_types::ExExNotification; -use reth_primitives::B256; use reth_tracing::tracing::{debug, instrument}; /// WAL is a write-ahead log (WAL) that stores the notifications sent to ExExes. diff --git a/crates/net/downloaders/src/receipt_file_client.rs b/crates/net/downloaders/src/receipt_file_client.rs index 7e66a4d876e2..980a72025407 100644 --- a/crates/net/downloaders/src/receipt_file_client.rs +++ b/crates/net/downloaders/src/receipt_file_client.rs @@ -213,9 +213,9 @@ pub struct ReceiptWithBlockNumber { #[cfg(test)] mod test { - use alloy_primitives::{hex, Address, Bytes, Log, LogData, B256}; + use alloy_primitives::{bytes::BytesMut, hex, Address, Bytes, Log, LogData, B256}; use alloy_rlp::{Decodable, RlpDecodable}; - use reth_primitives::{Buf, BytesMut, Receipt, TxType}; + use reth_primitives::{Buf, Receipt, TxType}; use reth_tracing::init_test_tracing; use tokio_util::codec::Decoder; diff --git a/crates/net/network/src/protocol.rs b/crates/net/network/src/protocol.rs index 8ea34fff1ed6..eeffd1c95f4f 100644 --- a/crates/net/network/src/protocol.rs +++ b/crates/net/network/src/protocol.rs @@ -9,12 +9,12 @@ use std::{ pin::Pin, }; +use alloy_primitives::bytes::BytesMut; use futures::Stream; use reth_eth_wire::{ capability::SharedCapabilities, multiplex::ProtocolConnection, protocol::Protocol, }; use reth_network_api::{Direction, PeerId}; -use reth_primitives::BytesMut; /// A trait that allows to offer additional RLPx-based application-level protocols when establishing /// a peer-to-peer connection. diff --git a/crates/net/network/tests/it/multiplex.rs b/crates/net/network/tests/it/multiplex.rs index 9c3fce7c5ed3..3eaf0a5eb422 100644 --- a/crates/net/network/tests/it/multiplex.rs +++ b/crates/net/network/tests/it/multiplex.rs @@ -7,6 +7,7 @@ use std::{ task::{ready, Context, Poll}, }; +use alloy_primitives::bytes::BytesMut; use futures::{Stream, StreamExt}; use reth_eth_wire::{ capability::SharedCapabilities, multiplex::ProtocolConnection, protocol::Protocol, @@ -16,7 +17,6 @@ use reth_network::{ test_utils::Testnet, }; use reth_network_api::{Direction, PeerId}; -use reth_primitives::BytesMut; use reth_provider::test_utils::MockEthProvider; use tokio::sync::{mpsc, oneshot}; use tokio_stream::wrappers::UnboundedReceiverStream; @@ -26,8 +26,9 @@ use crate::multiplex::proto::{PingPongProtoMessage, PingPongProtoMessageKind}; /// A simple Rlpx subprotocol that sends pings and pongs mod proto { use super::*; + use alloy_primitives::bytes::BufMut; use reth_eth_wire::Capability; - use reth_primitives::{Buf, BufMut}; + use reth_primitives::Buf; #[repr(u8)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] diff --git a/crates/node/builder/src/setup.rs b/crates/node/builder/src/setup.rs index 44c9f19e84b3..3591868ddad9 100644 --- a/crates/node/builder/src/setup.rs +++ b/crates/node/builder/src/setup.rs @@ -2,7 +2,7 @@ use std::sync::Arc; -use alloy_primitives::BlockNumber; +use alloy_primitives::{BlockNumber, B256}; use reth_config::{config::StageConfig, PruneConfig}; use reth_consensus::Consensus; use reth_downloaders::{ @@ -14,7 +14,6 @@ use reth_exex::ExExManagerHandle; use reth_network_p2p::{ bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader, BlockClient, }; -use reth_node_core::primitives::B256; use reth_provider::{providers::ProviderNodeTypes, ProviderFactory}; use reth_stages::{prelude::DefaultStages, stages::ExecutionStage, Pipeline, StageSet}; use reth_static_file::StaticFileProducer; diff --git a/crates/node/core/src/args/gas_price_oracle.rs b/crates/node/core/src/args/gas_price_oracle.rs index abdd8e14214f..b7a704cdf55e 100644 --- a/crates/node/core/src/args/gas_price_oracle.rs +++ b/crates/node/core/src/args/gas_price_oracle.rs @@ -1,4 +1,4 @@ -use crate::primitives::U256; +use alloy_primitives::U256; use clap::Args; use reth_rpc_eth_types::GasPriceOracleConfig; use reth_rpc_server_types::constants::gas_oracle::{ diff --git a/crates/optimism/cli/src/commands/init_state/bedrock.rs b/crates/optimism/cli/src/commands/init_state/bedrock.rs index 2426a195a8b6..efff065e5051 100644 --- a/crates/optimism/cli/src/commands/init_state/bedrock.rs +++ b/crates/optimism/cli/src/commands/init_state/bedrock.rs @@ -1,7 +1,7 @@ -use alloy_primitives::{BlockNumber, B256}; +use alloy_primitives::{BlockNumber, B256, U256}; use reth_optimism_primitives::bedrock::{BEDROCK_HEADER, BEDROCK_HEADER_HASH, BEDROCK_HEADER_TTD}; use reth_primitives::{ - BlockBody, Header, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, U256, + BlockBody, Header, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, }; use reth_provider::{ providers::StaticFileProvider, BlockWriter, StageCheckpointWriter, StaticFileWriter, diff --git a/crates/optimism/primitives/src/bedrock.rs b/crates/optimism/primitives/src/bedrock.rs index 00c8093ddef1..4ece12ad679e 100644 --- a/crates/optimism/primitives/src/bedrock.rs +++ b/crates/optimism/primitives/src/bedrock.rs @@ -1,7 +1,7 @@ //! OP mainnet bedrock related data. -use alloy_primitives::{b256, bloom, bytes, B256, B64, U256}; -use reth_primitives::{address, Header}; +use alloy_primitives::{address, b256, bloom, bytes, B256, B64, U256}; +use reth_primitives::Header; use reth_primitives_traits::constants::EMPTY_OMMER_ROOT_HASH; /// Transaction 0x9ed8f713b2cc6439657db52dcd2fdb9cc944915428f3c6e2a7703e242b259cb9 in block 985, diff --git a/crates/payload/builder/src/lib.rs b/crates/payload/builder/src/lib.rs index 51f9efd301ef..70b4296da4e6 100644 --- a/crates/payload/builder/src/lib.rs +++ b/crates/payload/builder/src/lib.rs @@ -27,8 +27,9 @@ //! use std::future::Future; //! use std::pin::Pin; //! use std::task::{Context, Poll}; +//! use alloy_primitives::U256; //! use reth_payload_builder::{EthBuiltPayload, PayloadBuilderError, KeepPayloadJobAlive, EthPayloadBuilderAttributes, PayloadJob, PayloadJobGenerator}; -//! use reth_primitives::{Block, Header, U256}; +//! use reth_primitives::{Block, Header}; //! //! /// The generator type that creates new jobs that builds empty blocks. //! pub struct EmptyBlockPayloadJobGenerator; diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index 78a98f78ab2a..8c923dab7dd9 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -1,12 +1,12 @@ use crate::{ Bytes, GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, - Withdrawals, B256, + Withdrawals, }; use alloc::vec::Vec; pub use alloy_eips::eip1898::{ BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash, }; -use alloy_primitives::{Address, Sealable}; +use alloy_primitives::{Address, Sealable, B256}; use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable}; use derive_more::{Deref, DerefMut}; #[cfg(any(test, feature = "arbitrary"))] diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 778230f5f870..390777422b01 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -69,11 +69,7 @@ pub use transaction::{ }; // Re-exports -pub use alloy_primitives::{ - self, address, b256, bloom, bytes, - bytes::{Buf, BufMut, BytesMut}, - hex, Bytes, TxHash, B256, U256, U64, -}; +pub use alloy_primitives::{self, bloom, bytes, bytes::Buf, hex, Bytes, TxHash}; pub use reth_ethereum_forks::*; pub use revm_primitives::{self, JumpTable}; diff --git a/crates/primitives/src/proofs.rs b/crates/primitives/src/proofs.rs index 454524081f0b..2fe611db1d2d 100644 --- a/crates/primitives/src/proofs.rs +++ b/crates/primitives/src/proofs.rs @@ -2,11 +2,11 @@ use crate::{ constants::EMPTY_OMMER_ROOT_HASH, Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, - Request, TransactionSigned, Withdrawal, B256, + Request, TransactionSigned, Withdrawal, }; use alloc::vec::Vec; use alloy_eips::eip7685::Encodable7685; -use alloy_primitives::keccak256; +use alloy_primitives::{keccak256, B256}; use reth_trie_common::root::{ordered_trie_root, ordered_trie_root_with_encoder}; /// Calculate a transaction root. @@ -65,9 +65,9 @@ pub fn calculate_ommers_root(ommers: &[Header]) -> B256 { #[cfg(test)] mod tests { use super::*; - use crate::{constants::EMPTY_ROOT_HASH, Block, U256}; + use crate::{constants::EMPTY_ROOT_HASH, Block}; use alloy_genesis::GenesisAccount; - use alloy_primitives::{b256, hex_literal::hex, Address}; + use alloy_primitives::{b256, hex_literal::hex, Address, U256}; use alloy_rlp::Decodable; use reth_chainspec::{HOLESKY, MAINNET, SEPOLIA}; use reth_trie_common::root::{state_root_ref_unhashed, state_root_unhashed}; diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index 0b32e0899a12..59c819da9116 100644 --- a/crates/primitives/src/receipt.rs +++ b/crates/primitives/src/receipt.rs @@ -1,11 +1,11 @@ #[cfg(feature = "reth-codec")] use crate::compression::{RECEIPT_COMPRESSOR, RECEIPT_DECOMPRESSOR}; use crate::{ - logs_bloom, Bytes, TxType, B256, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, + logs_bloom, Bytes, TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID, }; use alloc::{vec, vec::Vec}; -use alloy_primitives::{Bloom, Log}; +use alloy_primitives::{Bloom, Log, B256}; use alloy_rlp::{length_of_length, Decodable, Encodable, RlpDecodable, RlpEncodable}; use bytes::{Buf, BufMut}; use core::{cmp::Ordering, ops::Deref}; diff --git a/crates/primitives/src/transaction/access_list.rs b/crates/primitives/src/transaction/access_list.rs index 32beb293f9c1..8406e5a5b481 100644 --- a/crates/primitives/src/transaction/access_list.rs +++ b/crates/primitives/src/transaction/access_list.rs @@ -2,9 +2,8 @@ #[cfg(test)] mod tests { - use crate::B256; use alloy_eips::eip2930::{AccessList, AccessListItem}; - use alloy_primitives::Address; + use alloy_primitives::{Address, B256}; use alloy_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper}; use proptest::proptest; use proptest_arbitrary_interop::arb; diff --git a/crates/primitives/src/transaction/compat.rs b/crates/primitives/src/transaction/compat.rs index ac39671f34a8..cb8a4a92d7d1 100644 --- a/crates/primitives/src/transaction/compat.rs +++ b/crates/primitives/src/transaction/compat.rs @@ -1,5 +1,5 @@ -use crate::{Transaction, TransactionSigned, U256}; -use alloy_primitives::{Address, TxKind}; +use crate::{Transaction, TransactionSigned}; +use alloy_primitives::{Address, TxKind, U256}; use revm_primitives::{AuthorizationList, TxEnv}; /// Implements behaviour to fill a [`TxEnv`] from another transaction. diff --git a/crates/primitives/src/transaction/error.rs b/crates/primitives/src/transaction/error.rs index 0c53c2c8dcf9..790292cd82b7 100644 --- a/crates/primitives/src/transaction/error.rs +++ b/crates/primitives/src/transaction/error.rs @@ -1,4 +1,5 @@ -use crate::{GotExpectedBoxed, U256}; +use crate::GotExpectedBoxed; +use alloy_primitives::U256; /// Represents error variants that can happen when trying to validate a /// [Transaction](crate::Transaction) diff --git a/crates/primitives/src/transaction/meta.rs b/crates/primitives/src/transaction/meta.rs index 6fc752aad2fe..c7cb9d8b697d 100644 --- a/crates/primitives/src/transaction/meta.rs +++ b/crates/primitives/src/transaction/meta.rs @@ -1,4 +1,4 @@ -use crate::B256; +use alloy_primitives::B256; /// Additional fields in the context of a block that contains this transaction. #[derive(Debug, Clone, Copy, Default, Eq, PartialEq)] diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index d7ab9a22bc2b..425926254405 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -1,8 +1,8 @@ //! Transaction types. -use crate::{BlockHashOrNumber, Bytes, TxHash, B256, U256}; +use crate::{BlockHashOrNumber, Bytes, TxHash}; use alloy_eips::eip7702::SignedAuthorization; -use alloy_primitives::{keccak256, Address, TxKind}; +use alloy_primitives::{keccak256, Address, TxKind, B256, U256}; use alloy_consensus::{SignableTransaction, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy}; use alloy_eips::eip2930::AccessList; @@ -1708,9 +1708,9 @@ mod tests { hex, transaction::{signature::Signature, TxEip1559, TxKind, TxLegacy}, Bytes, Transaction, TransactionSigned, TransactionSignedEcRecovered, - TransactionSignedNoHash, B256, U256, + TransactionSignedNoHash, }; - use alloy_primitives::{address, b256, bytes, Address, Parity}; + use alloy_primitives::{address, b256, bytes, Address, Parity, B256, U256}; use alloy_rlp::{Decodable, Encodable, Error as RlpError}; use reth_chainspec::MIN_TRANSACTION_GAS; use reth_codecs::Compact; diff --git a/crates/primitives/src/transaction/pooled.rs b/crates/primitives/src/transaction/pooled.rs index 3f19b29b36c1..69ca8f88188d 100644 --- a/crates/primitives/src/transaction/pooled.rs +++ b/crates/primitives/src/transaction/pooled.rs @@ -8,14 +8,14 @@ use super::{ }; use crate::{ BlobTransaction, BlobTransactionSidecar, Bytes, Signature, Transaction, TransactionSigned, - TransactionSignedEcRecovered, TxHash, B256, EIP4844_TX_TYPE_ID, + TransactionSignedEcRecovered, TxHash, EIP4844_TX_TYPE_ID, }; use alloc::vec::Vec; use alloy_consensus::{ transaction::{TxEip1559, TxEip2930, TxEip4844, TxLegacy}, SignableTransaction, TxEip4844WithSidecar, }; -use alloy_primitives::Address; +use alloy_primitives::{Address, B256}; use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header, EMPTY_LIST_CODE}; use bytes::Buf; use derive_more::{AsRef, Deref}; diff --git a/crates/primitives/src/transaction/signature.rs b/crates/primitives/src/transaction/signature.rs index 07a2d6195795..829ce2409377 100644 --- a/crates/primitives/src/transaction/signature.rs +++ b/crates/primitives/src/transaction/signature.rs @@ -1,5 +1,5 @@ -use crate::{transaction::util::secp256k1, B256, U256}; -use alloy_primitives::{Address, Parity}; +use crate::transaction::util::secp256k1; +use alloy_primitives::{Address, Parity, B256, U256}; use alloy_rlp::{Decodable, Error as RlpError}; pub use alloy_primitives::Signature; @@ -119,9 +119,9 @@ mod tests { transaction::signature::{ legacy_parity, recover_signer, recover_signer_unchecked, SECP256K1N_HALF, }, - Signature, B256, U256, + Signature, }; - use alloy_primitives::{Address, Parity}; + use alloy_primitives::{Address, Parity, B256, U256}; use std::str::FromStr; #[test] diff --git a/crates/primitives/src/transaction/variant.rs b/crates/primitives/src/transaction/variant.rs index c558e7ccb9ba..888c83946cab 100644 --- a/crates/primitives/src/transaction/variant.rs +++ b/crates/primitives/src/transaction/variant.rs @@ -2,9 +2,9 @@ //! `TransactionSignedEcRecovered` use crate::{ - Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, B256, + Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, }; -use alloy_primitives::Address; +use alloy_primitives::{Address, B256}; use core::ops::Deref; /// Represents various different transaction formats used in reth. diff --git a/crates/revm/src/database.rs b/crates/revm/src/database.rs index e277d63e4bcc..8f40d2be8d91 100644 --- a/crates/revm/src/database.rs +++ b/crates/revm/src/database.rs @@ -1,7 +1,7 @@ use crate::primitives::alloy_primitives::{BlockNumber, StorageKey, StorageValue}; -use alloy_primitives::Address; +use alloy_primitives::{Address, B256, U256}; use core::ops::{Deref, DerefMut}; -use reth_primitives::{Account, B256, U256}; +use reth_primitives::Account; use reth_storage_errors::provider::{ProviderError, ProviderResult}; use revm::{ db::DatabaseRef, diff --git a/crates/revm/src/state_change.rs b/crates/revm/src/state_change.rs index a4f5c6cb04a8..afe92561bcd3 100644 --- a/crates/revm/src/state_change.rs +++ b/crates/revm/src/state_change.rs @@ -1,7 +1,7 @@ -use alloy_primitives::{map::HashMap, Address}; +use alloy_primitives::{map::HashMap, Address, U256}; use reth_chainspec::EthereumHardforks; use reth_consensus_common::calc; -use reth_primitives::{Block, Withdrawal, Withdrawals, U256}; +use reth_primitives::{Block, Withdrawal, Withdrawals}; /// Collect all balance changes at the end of the block. /// diff --git a/crates/revm/src/test_utils.rs b/crates/revm/src/test_utils.rs index 3f89d99125be..f1d1ce600e3b 100644 --- a/crates/revm/src/test_utils.rs +++ b/crates/revm/src/test_utils.rs @@ -2,9 +2,9 @@ use alloc::vec::Vec; use alloy_primitives::{ keccak256, map::{HashMap, HashSet}, - Address, BlockNumber, StorageKey, + Address, BlockNumber, StorageKey, B256, U256, }; -use reth_primitives::{Account, Bytecode, Bytes, B256, U256}; +use reth_primitives::{Account, Bytecode, Bytes}; use reth_storage_api::{ AccountReader, BlockHashReader, StateProofProvider, StateProvider, StateRootProvider, StorageRootProvider, diff --git a/crates/stages/stages/benches/setup/mod.rs b/crates/stages/stages/benches/setup/mod.rs index 85e4e3e5a318..84d96aac848f 100644 --- a/crates/stages/stages/benches/setup/mod.rs +++ b/crates/stages/stages/benches/setup/mod.rs @@ -1,5 +1,5 @@ #![allow(unreachable_pub)] -use alloy_primitives::Address; +use alloy_primitives::{Address, B256, U256}; use itertools::concat; use reth_chainspec::ChainSpec; use reth_db::{tables, test_utils::TempDatabase, Database, DatabaseEnv}; @@ -7,7 +7,7 @@ use reth_db_api::{ cursor::DbCursorRO, transaction::{DbTx, DbTxMut}, }; -use reth_primitives::{alloy_primitives::Sealable, Account, SealedBlock, SealedHeader, B256, U256}; +use reth_primitives::{alloy_primitives::Sealable, Account, SealedBlock, SealedHeader}; use reth_provider::{DatabaseProvider, DatabaseProviderFactory, TrieWriter}; use reth_stages::{ stages::{AccountHashingStage, StorageHashingStage}, diff --git a/crates/stages/stages/src/lib.rs b/crates/stages/stages/src/lib.rs index e33b6e7c0202..38a0f209dbdd 100644 --- a/crates/stages/stages/src/lib.rs +++ b/crates/stages/stages/src/lib.rs @@ -17,7 +17,7 @@ //! # use reth_downloaders::headers::reverse_headers::ReverseHeadersDownloaderBuilder; //! # use reth_network_p2p::test_utils::{TestBodiesClient, TestHeadersClient}; //! # use reth_evm_ethereum::execute::EthExecutorProvider; -//! # use reth_primitives::B256; +//! # use alloy_primitives::B256; //! # use reth_chainspec::MAINNET; //! # use reth_prune_types::PruneModes; //! # use reth_network_peers::PeerId; diff --git a/crates/stages/stages/src/sets.rs b/crates/stages/stages/src/sets.rs index 5a527fbc42c2..a25fcd4e1e57 100644 --- a/crates/stages/stages/src/sets.rs +++ b/crates/stages/stages/src/sets.rs @@ -41,11 +41,11 @@ use crate::{ }, StageSet, StageSetBuilder, }; +use alloy_primitives::B256; use reth_config::config::StageConfig; use reth_consensus::Consensus; use reth_evm::execute::BlockExecutorProvider; use reth_network_p2p::{bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader}; -use reth_primitives::B256; use reth_provider::HeaderSyncGapProvider; use reth_prune_types::PruneModes; use reth_stages_api::Stage; diff --git a/crates/stages/stages/src/stages/bodies.rs b/crates/stages/stages/src/stages/bodies.rs index 248e2ff52748..2d441dee292a 100644 --- a/crates/stages/stages/src/stages/bodies.rs +++ b/crates/stages/stages/src/stages/bodies.rs @@ -622,7 +622,7 @@ mod tests { UnwindStageTestRunner, }, }; - use alloy_primitives::{BlockHash, BlockNumber, TxNumber}; + use alloy_primitives::{BlockHash, BlockNumber, TxNumber, B256}; use futures_util::Stream; use reth_db::{static_file::HeaderMask, tables}; use reth_db_api::{ @@ -637,9 +637,7 @@ mod tests { }, error::DownloadResult, }; - use reth_primitives::{ - BlockBody, Header, SealedBlock, SealedHeader, StaticFileSegment, B256, - }; + use reth_primitives::{BlockBody, Header, SealedBlock, SealedHeader, StaticFileSegment}; use reth_provider::{ providers::StaticFileWriter, test_utils::MockNodeTypesWithDB, HeaderProvider, ProviderFactory, StaticFileProviderFactory, TransactionsProvider, diff --git a/crates/stages/stages/src/stages/execution.rs b/crates/stages/stages/src/stages/execution.rs index 1305e6825451..24dff3422857 100644 --- a/crates/stages/stages/src/stages/execution.rs +++ b/crates/stages/stages/src/stages/execution.rs @@ -658,14 +658,14 @@ where mod tests { use super::*; use crate::test_utils::TestStageDB; - use alloy_primitives::{hex_literal::hex, keccak256, Address}; + use alloy_primitives::{address, hex_literal::hex, keccak256, Address, B256, U256}; use alloy_rlp::Decodable; use assert_matches::assert_matches; use reth_chainspec::ChainSpecBuilder; use reth_db_api::{models::AccountBeforeTx, transaction::DbTxMut}; use reth_evm_ethereum::execute::EthExecutorProvider; use reth_execution_errors::BlockValidationError; - use reth_primitives::{address, Account, Bytecode, SealedBlock, StorageEntry, B256, U256}; + use reth_primitives::{Account, Bytecode, SealedBlock, StorageEntry}; use reth_provider::{ test_utils::create_test_provider_factory, AccountReader, DatabaseProviderFactory, ReceiptProvider, StaticFileProviderFactory, diff --git a/crates/stages/stages/src/stages/hashing_account.rs b/crates/stages/stages/src/stages/hashing_account.rs index bbcb9b8da270..14afb37d81db 100644 --- a/crates/stages/stages/src/stages/hashing_account.rs +++ b/crates/stages/stages/src/stages/hashing_account.rs @@ -1,4 +1,4 @@ -use alloy_primitives::keccak256; +use alloy_primitives::{keccak256, B256}; use itertools::Itertools; use reth_config::config::{EtlConfig, HashingConfig}; use reth_db::{tables, RawKey, RawTable, RawValue}; @@ -7,7 +7,7 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, }; use reth_etl::Collector; -use reth_primitives::{Account, B256}; +use reth_primitives::Account; use reth_provider::{AccountExtReader, DBProvider, HashingWriter, StatsReader}; use reth_stages_api::{ AccountHashingCheckpoint, EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, @@ -65,8 +65,8 @@ impl AccountHashingStage { provider: &reth_provider::DatabaseProvider, opts: SeedOpts, ) -> Result, StageError> { + use alloy_primitives::U256; use reth_db_api::models::AccountBeforeTx; - use reth_primitives::U256; use reth_provider::{StaticFileProviderFactory, StaticFileWriter}; use reth_testing_utils::{ generators, @@ -298,8 +298,9 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, UnwindStageTestRunner, }; + use alloy_primitives::U256; use assert_matches::assert_matches; - use reth_primitives::{Account, U256}; + use reth_primitives::Account; use reth_provider::providers::StaticFileWriter; use reth_stages_api::StageUnitCheckpoint; use test_utils::*; diff --git a/crates/stages/stages/src/stages/hashing_storage.rs b/crates/stages/stages/src/stages/hashing_storage.rs index 1862a3248ded..ef070d30c6d6 100644 --- a/crates/stages/stages/src/stages/hashing_storage.rs +++ b/crates/stages/stages/src/stages/hashing_storage.rs @@ -1,4 +1,4 @@ -use alloy_primitives::keccak256; +use alloy_primitives::{bytes::BufMut, keccak256, B256}; use itertools::Itertools; use reth_config::config::{EtlConfig, HashingConfig}; use reth_db::tables; @@ -9,7 +9,7 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, }; use reth_etl::Collector; -use reth_primitives::{BufMut, StorageEntry, B256}; +use reth_primitives::StorageEntry; use reth_provider::{DBProvider, HashingWriter, StatsReader, StorageReader}; use reth_stages_api::{ EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, StageError, StageId, @@ -212,14 +212,14 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; - use alloy_primitives::Address; + use alloy_primitives::{Address, U256}; use assert_matches::assert_matches; use rand::Rng; use reth_db_api::{ cursor::{DbCursorRW, DbDupCursorRO}, models::StoredBlockBodyIndices, }; - use reth_primitives::{SealedBlock, U256}; + use reth_primitives::SealedBlock; use reth_provider::providers::StaticFileWriter; use reth_testing_utils::generators::{ self, random_block_range, random_contract_account_range, BlockRangeParams, diff --git a/crates/stages/stages/src/stages/headers.rs b/crates/stages/stages/src/stages/headers.rs index 25c7abaee48a..02a360b65eee 100644 --- a/crates/stages/stages/src/stages/headers.rs +++ b/crates/stages/stages/src/stages/headers.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{BlockHash, BlockNumber}; +use alloy_primitives::{BlockHash, BlockNumber, B256}; use futures_util::StreamExt; use reth_codecs::Compact; use reth_config::config::EtlConfig; @@ -11,7 +11,7 @@ use reth_db_api::{ }; use reth_etl::Collector; use reth_network_p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError}; -use reth_primitives::{SealedHeader, StaticFileSegment, B256}; +use reth_primitives::{SealedHeader, StaticFileSegment}; use reth_provider::{ providers::{StaticFileProvider, StaticFileWriter}, BlockHashReader, DBProvider, HeaderProvider, HeaderSyncGap, HeaderSyncGapProvider, @@ -378,10 +378,11 @@ mod tests { use crate::test_utils::{ stage_test_suite, ExecuteStageTestRunner, StageTestRunner, UnwindStageTestRunner, }; + use alloy_primitives::B256; use assert_matches::assert_matches; use reth_execution_types::ExecutionOutcome; use reth_primitives::{ - alloy_primitives::Sealable, BlockBody, SealedBlock, SealedBlockWithSenders, B256, + alloy_primitives::Sealable, BlockBody, SealedBlock, SealedBlockWithSenders, }; use reth_provider::{BlockWriter, ProviderFactory, StaticFileProviderFactory}; use reth_stages_api::StageUnitCheckpoint; diff --git a/crates/stages/stages/src/stages/index_account_history.rs b/crates/stages/stages/src/stages/index_account_history.rs index 1e9641980771..8b10283fb4b7 100644 --- a/crates/stages/stages/src/stages/index_account_history.rs +++ b/crates/stages/stages/src/stages/index_account_history.rs @@ -148,7 +148,7 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; - use alloy_primitives::BlockNumber; + use alloy_primitives::{address, BlockNumber, B256}; use itertools::Itertools; use reth_db::BlockNumberList; use reth_db_api::{ @@ -159,7 +159,6 @@ mod tests { }, transaction::DbTx, }; - use reth_primitives::{address, B256}; use reth_provider::{providers::StaticFileWriter, DatabaseProviderFactory}; use reth_testing_utils::generators::{ self, random_block_range, random_changeset_range, random_contract_account_range, diff --git a/crates/stages/stages/src/stages/index_storage_history.rs b/crates/stages/stages/src/stages/index_storage_history.rs index ee68e934f4ed..ac645b8dd754 100644 --- a/crates/stages/stages/src/stages/index_storage_history.rs +++ b/crates/stages/stages/src/stages/index_storage_history.rs @@ -153,7 +153,7 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; - use alloy_primitives::{Address, BlockNumber}; + use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256}; use itertools::Itertools; use reth_db::BlockNumberList; use reth_db_api::{ @@ -164,7 +164,7 @@ mod tests { }, transaction::DbTx, }; - use reth_primitives::{address, b256, StorageEntry, B256, U256}; + use reth_primitives::StorageEntry; use reth_provider::{providers::StaticFileWriter, DatabaseProviderFactory}; use reth_testing_utils::generators::{ self, random_block_range, random_changeset_range, random_contract_account_range, diff --git a/crates/stages/stages/src/stages/merkle.rs b/crates/stages/stages/src/stages/merkle.rs index 7b94067e9926..15f6e9702be3 100644 --- a/crates/stages/stages/src/stages/merkle.rs +++ b/crates/stages/stages/src/stages/merkle.rs @@ -1,9 +1,9 @@ -use alloy_primitives::BlockNumber; +use alloy_primitives::{BlockNumber, B256}; use reth_codecs::Compact; use reth_consensus::ConsensusError; use reth_db::tables; use reth_db_api::transaction::{DbTx, DbTxMut}; -use reth_primitives::{alloy_primitives::Sealable, GotExpected, SealedHeader, B256}; +use reth_primitives::{alloy_primitives::Sealable, GotExpected, SealedHeader}; use reth_provider::{ DBProvider, HeaderProvider, ProviderError, StageCheckpointReader, StageCheckpointWriter, StatsReader, TrieWriter, @@ -374,10 +374,10 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, StorageKind, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; - use alloy_primitives::keccak256; + use alloy_primitives::{keccak256, U256}; use assert_matches::assert_matches; use reth_db_api::cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}; - use reth_primitives::{SealedBlock, StaticFileSegment, StorageEntry, U256}; + use reth_primitives::{SealedBlock, StaticFileSegment, StorageEntry}; use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory}; use reth_stages_api::StageUnitCheckpoint; use reth_testing_utils::generators::{ diff --git a/crates/stages/stages/src/stages/mod.rs b/crates/stages/stages/src/stages/mod.rs index 6ae1b30e7e24..17ffcf2e90eb 100644 --- a/crates/stages/stages/src/stages/mod.rs +++ b/crates/stages/stages/src/stages/mod.rs @@ -42,7 +42,7 @@ use utils::*; mod tests { use super::*; use crate::test_utils::{StorageKind, TestStageDB}; - use alloy_primitives::{hex_literal::hex, keccak256, BlockNumber}; + use alloy_primitives::{address, hex_literal::hex, keccak256, BlockNumber, B256, U256}; use alloy_rlp::Decodable; use reth_chainspec::ChainSpecBuilder; use reth_db::{ @@ -56,7 +56,7 @@ mod tests { }; use reth_evm_ethereum::execute::EthExecutorProvider; use reth_exex::ExExManagerHandle; - use reth_primitives::{address, Account, Bytecode, SealedBlock, StaticFileSegment, B256, U256}; + use reth_primitives::{Account, Bytecode, SealedBlock, StaticFileSegment}; use reth_provider::{ providers::{StaticFileProvider, StaticFileWriter}, test_utils::MockNodeTypesWithDB, diff --git a/crates/stages/stages/src/stages/prune.rs b/crates/stages/stages/src/stages/prune.rs index 3512e6210183..8adf2fcad546 100644 --- a/crates/stages/stages/src/stages/prune.rs +++ b/crates/stages/stages/src/stages/prune.rs @@ -169,7 +169,8 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, StorageKind, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; - use reth_primitives::{SealedBlock, B256}; + use alloy_primitives::B256; + use reth_primitives::SealedBlock; use reth_provider::{ providers::StaticFileWriter, TransactionsProvider, TransactionsProviderExt, }; diff --git a/crates/stages/stages/src/stages/sender_recovery.rs b/crates/stages/stages/src/stages/sender_recovery.rs index 8ffbb2070aa1..14b77ccbf9d0 100644 --- a/crates/stages/stages/src/stages/sender_recovery.rs +++ b/crates/stages/stages/src/stages/sender_recovery.rs @@ -334,10 +334,10 @@ struct FailedSenderRecoveryError { #[cfg(test)] mod tests { - use alloy_primitives::BlockNumber; + use alloy_primitives::{BlockNumber, B256}; use assert_matches::assert_matches; use reth_db_api::cursor::DbCursorRO; - use reth_primitives::{SealedBlock, TransactionSigned, B256}; + use reth_primitives::{SealedBlock, TransactionSigned}; use reth_provider::{ providers::StaticFileWriter, DatabaseProviderFactory, PruneCheckpointWriter, StaticFileProviderFactory, TransactionsProvider, diff --git a/crates/stages/stages/src/stages/tx_lookup.rs b/crates/stages/stages/src/stages/tx_lookup.rs index 1744b933c2d3..60c958abf862 100644 --- a/crates/stages/stages/src/stages/tx_lookup.rs +++ b/crates/stages/stages/src/stages/tx_lookup.rs @@ -250,9 +250,9 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, StorageKind, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; - use alloy_primitives::BlockNumber; + use alloy_primitives::{BlockNumber, B256}; use assert_matches::assert_matches; - use reth_primitives::{SealedBlock, B256}; + use reth_primitives::SealedBlock; use reth_provider::{ providers::StaticFileWriter, DatabaseProviderFactory, StaticFileProviderFactory, }; diff --git a/crates/stages/stages/src/test_utils/test_db.rs b/crates/stages/stages/src/test_utils/test_db.rs index 7607b1d3142c..f062f15914fb 100644 --- a/crates/stages/stages/src/test_utils/test_db.rs +++ b/crates/stages/stages/src/test_utils/test_db.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{keccak256, Address, BlockNumber, TxNumber}; +use alloy_primitives::{keccak256, Address, BlockNumber, TxNumber, B256, U256}; use reth_chainspec::MAINNET; use reth_db::{ tables, @@ -15,8 +15,7 @@ use reth_db_api::{ DatabaseError as DbError, }; use reth_primitives::{ - Account, Receipt, SealedBlock, SealedHeader, StaticFileSegment, StorageEntry, TxHash, B256, - U256, + Account, Receipt, SealedBlock, SealedHeader, StaticFileSegment, StorageEntry, TxHash, }; use reth_provider::{ providers::{StaticFileProvider, StaticFileProviderRWRefMut, StaticFileWriter}, diff --git a/crates/storage/provider/src/providers/state/macros.rs b/crates/storage/provider/src/providers/state/macros.rs index e6ed31938cd8..388b59ab0a1e 100644 --- a/crates/storage/provider/src/providers/state/macros.rs +++ b/crates/storage/provider/src/providers/state/macros.rs @@ -52,7 +52,7 @@ macro_rules! delegate_provider_impls { } StateProofProvider $(where [$($generics)*])? { fn proof(&self, input: reth_trie::TrieInput, address: alloy_primitives::Address, slots: &[alloy_primitives::B256]) -> reth_storage_errors::provider::ProviderResult; - fn multiproof(&self, input: reth_trie::TrieInput, targets: alloy_primitives::map::HashMap>) -> reth_storage_errors::provider::ProviderResult; + fn multiproof(&self, input: reth_trie::TrieInput, targets: alloy_primitives::map::HashMap>) -> reth_storage_errors::provider::ProviderResult; fn witness(&self, input: reth_trie::TrieInput, target: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult>; } ); diff --git a/crates/storage/provider/src/test_utils/blocks.rs b/crates/storage/provider/src/test_utils/blocks.rs index 32033bcb2803..0ad933fc7aee 100644 --- a/crates/storage/provider/src/test_utils/blocks.rs +++ b/crates/storage/provider/src/test_utils/blocks.rs @@ -2,15 +2,16 @@ use crate::{DatabaseProviderRW, ExecutionOutcome}; use alloy_consensus::TxLegacy; use alloy_primitives::{ - hex_literal::hex, map::HashMap, Address, BlockNumber, Log, Parity, Sealable, TxKind, + b256, hex_literal::hex, map::HashMap, Address, BlockNumber, Log, Parity, Sealable, TxKind, + B256, U256, }; use once_cell::sync::Lazy; use reth_db::tables; use reth_db_api::{database::Database, models::StoredBlockBodyIndices}; use reth_primitives::{ - alloy_primitives, b256, Account, BlockBody, Bytes, Header, Receipt, SealedBlock, + alloy_primitives, Account, BlockBody, Bytes, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, Signature, Transaction, TransactionSigned, TxType, - Withdrawal, Withdrawals, B256, U256, + Withdrawal, Withdrawals, }; use reth_trie::root::{state_root_unhashed, storage_root_unhashed}; use revm::{db::BundleState, primitives::AccountInfo}; diff --git a/crates/trie/db/src/state.rs b/crates/trie/db/src/state.rs index 48a676c85a5d..35ed064e5231 100644 --- a/crates/trie/db/src/state.rs +++ b/crates/trie/db/src/state.rs @@ -77,9 +77,10 @@ pub trait DatabaseStateRoot<'a, TX>: Sized { /// # Example /// /// ``` + /// use alloy_primitives::U256; /// use reth_db::test_utils::create_test_rw_db; /// use reth_db_api::database::Database; - /// use reth_primitives::{Account, U256}; + /// use reth_primitives::Account; /// use reth_trie::{updates::TrieUpdates, HashedPostState, StateRoot}; /// use reth_trie_db::DatabaseStateRoot; /// @@ -267,10 +268,10 @@ impl DatabaseHashedPostState for HashedPostState { #[cfg(test)] mod tests { use super::*; - use alloy_primitives::{map::HashMap, Address}; + use alloy_primitives::{map::HashMap, Address, U256}; use reth_db::test_utils::create_test_rw_db; use reth_db_api::database::Database; - use reth_primitives::{hex, revm_primitives::AccountInfo, U256}; + use reth_primitives::{hex, revm_primitives::AccountInfo}; use revm::db::BundleState; #[test] diff --git a/examples/beacon-api-sidecar-fetcher/Cargo.toml b/examples/beacon-api-sidecar-fetcher/Cargo.toml index 80f5f726d96d..47a2a181f7e5 100644 --- a/examples/beacon-api-sidecar-fetcher/Cargo.toml +++ b/examples/beacon-api-sidecar-fetcher/Cargo.toml @@ -10,6 +10,7 @@ reth.workspace = true reth-node-ethereum.workspace = true alloy-rpc-types-beacon.workspace = true +alloy-primitives.workspace = true clap.workspace = true eyre.workspace = true diff --git a/examples/beacon-api-sidecar-fetcher/src/main.rs b/examples/beacon-api-sidecar-fetcher/src/main.rs index ff6659642705..631a17a095c6 100644 --- a/examples/beacon-api-sidecar-fetcher/src/main.rs +++ b/examples/beacon-api-sidecar-fetcher/src/main.rs @@ -18,11 +18,12 @@ use std::{ net::{IpAddr, Ipv4Addr}, }; +use alloy_primitives::B256; use clap::Parser; use futures_util::{stream::FuturesUnordered, StreamExt}; use mined_sidecar::MinedSidecarStream; use reth::{ - args::utils::DefaultChainSpecParser, builder::NodeHandle, cli::Cli, primitives::B256, + args::utils::DefaultChainSpecParser, builder::NodeHandle, cli::Cli, providers::CanonStateSubscriptions, }; use reth_node_ethereum::EthereumNode; diff --git a/examples/beacon-api-sidecar-fetcher/src/mined_sidecar.rs b/examples/beacon-api-sidecar-fetcher/src/mined_sidecar.rs index 04fbd5fbfbc0..d2d9181592b5 100644 --- a/examples/beacon-api-sidecar-fetcher/src/mined_sidecar.rs +++ b/examples/beacon-api-sidecar-fetcher/src/mined_sidecar.rs @@ -1,10 +1,11 @@ use crate::BeaconSidecarConfig; +use alloy_primitives::B256; use alloy_rpc_types_beacon::sidecar::{BeaconBlobBundle, SidecarIterator}; use eyre::Result; use futures_util::{stream::FuturesUnordered, Future, Stream, StreamExt}; use reqwest::{Error, StatusCode}; use reth::{ - primitives::{BlobTransaction, SealedBlockWithSenders, B256}, + primitives::{BlobTransaction, SealedBlockWithSenders}, providers::CanonStateNotification, transaction_pool::{BlobStoreError, TransactionPoolExt}, }; diff --git a/examples/bsc-p2p/Cargo.toml b/examples/bsc-p2p/Cargo.toml index dde02080d135..fecbab7a8f93 100644 --- a/examples/bsc-p2p/Cargo.toml +++ b/examples/bsc-p2p/Cargo.toml @@ -16,9 +16,15 @@ reth-network-peers.workspace = true reth-primitives.workspace = true reth-tracing.workspace = true -secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] } +secp256k1 = { workspace = true, features = [ + "global-context", + "rand-std", + "recovery", +] } tokio.workspace = true tokio-stream.workspace = true serde_json.workspace = true + +alloy-primitives.workspace = true diff --git a/examples/bsc-p2p/src/chainspec.rs b/examples/bsc-p2p/src/chainspec.rs index 11c570233263..8a47a604e726 100644 --- a/examples/bsc-p2p/src/chainspec.rs +++ b/examples/bsc-p2p/src/chainspec.rs @@ -1,8 +1,8 @@ +use alloy_primitives::{b256, B256}; use reth_chainspec::{ once_cell_set, BaseFeeParams, Chain, ChainHardforks, ChainSpec, EthereumHardfork, ForkCondition, }; use reth_network_peers::NodeRecord; -use reth_primitives::{b256, B256}; use std::sync::Arc; diff --git a/examples/custom-dev-node/Cargo.toml b/examples/custom-dev-node/Cargo.toml index e4c5a9dab2ed..2586795b45b5 100644 --- a/examples/custom-dev-node/Cargo.toml +++ b/examples/custom-dev-node/Cargo.toml @@ -19,3 +19,4 @@ tokio.workspace = true serde_json.workspace = true alloy-genesis.workspace = true +alloy-primitives.workspace = true diff --git a/examples/custom-dev-node/src/main.rs b/examples/custom-dev-node/src/main.rs index 93e5df6287c4..7fa44418c523 100644 --- a/examples/custom-dev-node/src/main.rs +++ b/examples/custom-dev-node/src/main.rs @@ -6,6 +6,7 @@ use std::sync::Arc; use alloy_genesis::Genesis; +use alloy_primitives::{b256, hex}; use futures_util::StreamExt; use reth::{ builder::{NodeBuilder, NodeHandle}, @@ -16,7 +17,6 @@ use reth::{ use reth_chainspec::ChainSpec; use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig}; use reth_node_ethereum::EthereumNode; -use reth_primitives::{b256, hex}; #[tokio::main] async fn main() -> eyre::Result<()> { diff --git a/examples/custom-engine-types/src/main.rs b/examples/custom-engine-types/src/main.rs index c4f640e9b87f..213a156af8fd 100644 --- a/examples/custom-engine-types/src/main.rs +++ b/examples/custom-engine-types/src/main.rs @@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize}; use thiserror::Error; use alloy_genesis::Genesis; -use alloy_primitives::Address; +use alloy_primitives::{Address, B256}; use alloy_rpc_types::{ engine::{ ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4, @@ -64,7 +64,7 @@ use reth_payload_builder::{ EthBuiltPayload, EthPayloadBuilderAttributes, PayloadBuilderError, PayloadBuilderHandle, PayloadBuilderService, }; -use reth_primitives::{Withdrawals, B256}; +use reth_primitives::Withdrawals; use reth_tracing::{RethTracer, Tracer}; /// A custom payload attributes type. diff --git a/examples/custom-evm/src/main.rs b/examples/custom-evm/src/main.rs index 4f1c0c7eb299..b3bf36ce6d5d 100644 --- a/examples/custom-evm/src/main.rs +++ b/examples/custom-evm/src/main.rs @@ -3,7 +3,7 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] use alloy_genesis::Genesis; -use alloy_primitives::Address; +use alloy_primitives::{address, Address, U256}; use reth::{ builder::{ components::{ExecutorBuilder, PayloadServiceBuilder}, @@ -11,7 +11,6 @@ use reth::{ }, payload::{EthBuiltPayload, EthPayloadBuilderAttributes}, primitives::{ - address, revm_primitives::{Env, PrecompileResult}, Bytes, }, @@ -39,7 +38,7 @@ use reth_node_ethereum::{ }; use reth_primitives::{ revm_primitives::{CfgEnvWithHandlerCfg, TxEnv}, - Header, TransactionSigned, U256, + Header, TransactionSigned, }; use reth_tracing::{RethTracer, Tracer}; use std::sync::Arc; diff --git a/examples/custom-rlpx-subprotocol/Cargo.toml b/examples/custom-rlpx-subprotocol/Cargo.toml index d2d1caab6355..886d83da48cd 100644 --- a/examples/custom-rlpx-subprotocol/Cargo.toml +++ b/examples/custom-rlpx-subprotocol/Cargo.toml @@ -21,3 +21,4 @@ tokio-stream.workspace = true eyre.workspace = true rand.workspace = true tracing.workspace = true +alloy-primitives.workspace = true diff --git a/examples/custom-rlpx-subprotocol/src/subprotocol/connection/mod.rs b/examples/custom-rlpx-subprotocol/src/subprotocol/connection/mod.rs index a6d835b70c26..6017871d2f99 100644 --- a/examples/custom-rlpx-subprotocol/src/subprotocol/connection/mod.rs +++ b/examples/custom-rlpx-subprotocol/src/subprotocol/connection/mod.rs @@ -1,7 +1,7 @@ use super::protocol::proto::{CustomRlpxProtoMessage, CustomRlpxProtoMessageKind}; +use alloy_primitives::bytes::BytesMut; use futures::{Stream, StreamExt}; use reth_eth_wire::multiplex::ProtocolConnection; -use reth_primitives::BytesMut; use std::{ pin::Pin, task::{ready, Context, Poll}, diff --git a/examples/custom-rlpx-subprotocol/src/subprotocol/protocol/proto.rs b/examples/custom-rlpx-subprotocol/src/subprotocol/protocol/proto.rs index 8b179a447d9f..043d37c4f6ae 100644 --- a/examples/custom-rlpx-subprotocol/src/subprotocol/protocol/proto.rs +++ b/examples/custom-rlpx-subprotocol/src/subprotocol/protocol/proto.rs @@ -1,8 +1,8 @@ //! Simple RLPx Ping Pong protocol that also support sending messages, //! following [RLPx specs](https://github.com/ethereum/devp2p/blob/master/rlpx.md) +use alloy_primitives::bytes::{Buf, BufMut, BytesMut}; use reth_eth_wire::{protocol::Protocol, Capability}; -use reth_primitives::{Buf, BufMut, BytesMut}; #[repr(u8)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] diff --git a/examples/db-access/src/main.rs b/examples/db-access/src/main.rs index 5730e6753522..7878ba3c8a89 100644 --- a/examples/db-access/src/main.rs +++ b/examples/db-access/src/main.rs @@ -1,9 +1,9 @@ -use alloy_primitives::Address; +use alloy_primitives::{Address, B256}; use alloy_rpc_types::{Filter, FilteredParams}; use reth_chainspec::ChainSpecBuilder; use reth_node_ethereum::EthereumNode; use reth_node_types::NodeTypesWithDBAdapter; -use reth_primitives::{alloy_primitives::Sealable, SealedHeader, B256}; +use reth_primitives::{alloy_primitives::Sealable, SealedHeader}; use reth_provider::{ providers::StaticFileProvider, AccountReader, BlockReader, BlockSource, HeaderProvider, ProviderFactory, ReceiptProvider, StateProvider, TransactionsProvider, diff --git a/examples/polygon-p2p/Cargo.toml b/examples/polygon-p2p/Cargo.toml index b3a7af7506b4..bdf9a27ce560 100644 --- a/examples/polygon-p2p/Cargo.toml +++ b/examples/polygon-p2p/Cargo.toml @@ -8,7 +8,11 @@ license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] } +secp256k1 = { workspace = true, features = [ + "global-context", + "rand-std", + "recovery", +] } tokio.workspace = true reth-network.workspace = true reth-chainspec.workspace = true @@ -18,3 +22,4 @@ reth-tracing.workspace = true tokio-stream.workspace = true reth-provider = { workspace = true, features = ["test-utils"] } reth-discv4 = { workspace = true, features = ["test-utils"] } +alloy-primitives.workspace = true diff --git a/examples/polygon-p2p/src/chain_cfg.rs b/examples/polygon-p2p/src/chain_cfg.rs index eabcfb2e71db..84bfac8f209f 100644 --- a/examples/polygon-p2p/src/chain_cfg.rs +++ b/examples/polygon-p2p/src/chain_cfg.rs @@ -1,8 +1,9 @@ +use alloy_primitives::{b256, B256}; use reth_chainspec::{ once_cell_set, BaseFeeParams, Chain, ChainHardforks, ChainSpec, EthereumHardfork, ForkCondition, }; use reth_discv4::NodeRecord; -use reth_primitives::{b256, Head, B256}; +use reth_primitives::Head; use std::sync::Arc; diff --git a/examples/stateful-precompile/src/main.rs b/examples/stateful-precompile/src/main.rs index effece640d26..f58c7a557b8a 100644 --- a/examples/stateful-precompile/src/main.rs +++ b/examples/stateful-precompile/src/main.rs @@ -3,14 +3,14 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] use alloy_genesis::Genesis; -use alloy_primitives::Address; +use alloy_primitives::{Address, U256}; use parking_lot::RwLock; use reth::{ api::NextBlockEnvAttributes, builder::{components::ExecutorBuilder, BuilderContext, NodeBuilder}, primitives::{ revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, Env, PrecompileResult, TxEnv}, - Bytes, U256, + Bytes, }, revm::{ handler::register::EvmHandler, diff --git a/testing/testing-utils/src/genesis_allocator.rs b/testing/testing-utils/src/genesis_allocator.rs index d2da3bbabd28..ebdef9eb1932 100644 --- a/testing/testing-utils/src/genesis_allocator.rs +++ b/testing/testing-utils/src/genesis_allocator.rs @@ -18,8 +18,8 @@ use std::{ /// /// # Example /// ``` -/// # use alloy_primitives::Address; -/// # use reth_primitives::{U256, hex, Bytes}; +/// # use alloy_primitives::{Address, U256}; +/// # use reth_primitives::{hex, Bytes}; /// # use reth_testing_utils::GenesisAllocator; /// # use std::str::FromStr; /// let mut allocator = GenesisAllocator::default();