From f2a508df341a9281a81c979be4f91f9fcbf363a9 Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:29:18 +0200 Subject: [PATCH] primitives: rm more `alloy_primitives` reexports (#11222) --- Cargo.lock | 11 ++++++++++- bin/reth/Cargo.toml | 1 + bin/reth/src/commands/debug_cmd/build_block.rs | 3 ++- bin/reth/src/commands/debug_cmd/execution.rs | 3 ++- crates/config/Cargo.toml | 2 +- crates/config/src/config.rs | 2 +- crates/evm/execution-types/Cargo.toml | 1 - crates/node/builder/src/setup.rs | 3 ++- .../optimism/cli/src/commands/init_state/bedrock.rs | 5 ++--- crates/optimism/cli/src/receipt_file_codec.rs | 4 ++-- crates/primitives/src/block.rs | 6 +++--- crates/primitives/src/lib.rs | 5 ++--- crates/primitives/src/proofs.rs | 5 +++-- crates/primitives/src/receipt.rs | 6 +++--- crates/primitives/src/transaction/access_list.rs | 3 ++- crates/primitives/src/transaction/compat.rs | 4 ++-- crates/primitives/src/transaction/mod.rs | 8 ++++---- crates/primitives/src/transaction/pooled.rs | 5 +++-- crates/primitives/src/transaction/sidecar.rs | 3 ++- crates/primitives/src/transaction/signature.rs | 9 ++++----- crates/primitives/src/transaction/tx_type.rs | 3 ++- crates/primitives/src/transaction/util.rs | 9 ++++----- crates/primitives/src/transaction/variant.rs | 4 ++-- crates/revm/Cargo.toml | 2 ++ crates/revm/src/batch.rs | 3 ++- crates/revm/src/database.rs | 3 ++- crates/revm/src/state_change.rs | 3 ++- crates/revm/src/test_utils.rs | 5 ++--- crates/rpc/rpc/src/eth/helpers/types.rs | 4 ++-- crates/stages/stages/Cargo.toml | 2 ++ crates/stages/stages/benches/criterion.rs | 2 +- crates/stages/stages/benches/setup/account_hashing.rs | 2 +- crates/stages/stages/benches/setup/mod.rs | 5 ++--- crates/stages/stages/src/stages/bodies.rs | 4 ++-- crates/stages/stages/src/stages/execution.rs | 9 ++++----- crates/stages/stages/src/stages/hashing_account.rs | 7 ++++--- crates/stages/stages/src/stages/hashing_storage.rs | 6 ++++-- crates/stages/stages/src/stages/headers.rs | 3 ++- .../stages/stages/src/stages/index_account_history.rs | 5 +++-- .../stages/stages/src/stages/index_storage_history.rs | 3 ++- crates/stages/stages/src/stages/merkle.rs | 6 ++++-- crates/stages/stages/src/stages/mod.rs | 4 ++-- crates/stages/stages/src/stages/sender_recovery.rs | 6 ++++-- crates/stages/stages/src/stages/tx_lookup.rs | 3 ++- crates/stages/stages/src/stages/utils.rs | 2 +- crates/stages/stages/src/test_utils/test_db.rs | 5 +++-- .../storage/provider/src/providers/static_file/mod.rs | 4 ++-- crates/storage/provider/src/test_utils/blocks.rs | 8 ++++---- crates/storage/provider/src/writer/mod.rs | 4 ++-- crates/trie/db/src/state.rs | 3 ++- examples/custom-engine-types/Cargo.toml | 1 + examples/custom-engine-types/src/main.rs | 3 ++- examples/custom-evm/Cargo.toml | 1 + examples/custom-evm/src/main.rs | 3 ++- examples/custom-inspector/Cargo.toml | 1 + examples/custom-inspector/src/main.rs | 3 ++- examples/db-access/Cargo.toml | 1 + examples/db-access/src/main.rs | 3 ++- examples/stateful-precompile/Cargo.toml | 1 + examples/stateful-precompile/src/main.rs | 3 ++- examples/txpool-tracing/Cargo.toml | 1 + examples/txpool-tracing/src/main.rs | 3 ++- testing/ef-tests/src/models.rs | 5 ++--- testing/testing-utils/src/genesis_allocator.rs | 3 ++- 64 files changed, 146 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a02679addc75..0e0a0c44743f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2712,6 +2712,7 @@ name = "example-custom-engine-types" version = "0.0.0" dependencies = [ "alloy-genesis", + "alloy-primitives", "alloy-rpc-types", "eyre", "reth", @@ -2734,6 +2735,7 @@ name = "example-custom-evm" version = "0.0.0" dependencies = [ "alloy-genesis", + "alloy-primitives", "eyre", "reth", "reth-chainspec", @@ -2750,6 +2752,7 @@ dependencies = [ name = "example-custom-inspector" version = "0.0.0" dependencies = [ + "alloy-primitives", "alloy-rpc-types", "clap", "futures-util", @@ -2810,6 +2813,7 @@ dependencies = [ name = "example-db-access" version = "0.0.0" dependencies = [ + "alloy-primitives", "alloy-rpc-types", "eyre", "reth-chainspec", @@ -2916,6 +2920,7 @@ name = "example-stateful-precompile" version = "0.0.0" dependencies = [ "alloy-genesis", + "alloy-primitives", "eyre", "parking_lot 0.12.3", "reth", @@ -2933,6 +2938,7 @@ dependencies = [ name = "example-txpool-tracing" version = "0.0.0" dependencies = [ + "alloy-primitives", "alloy-rpc-types-trace", "clap", "futures-util", @@ -6174,6 +6180,7 @@ name = "reth" version = "1.0.7" dependencies = [ "alloy-consensus", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types", "aquamarine", @@ -6610,11 +6617,11 @@ dependencies = [ name = "reth-config" version = "1.0.7" dependencies = [ + "alloy-primitives", "eyre", "humantime-serde", "reth-network-peers", "reth-network-types", - "reth-primitives", "reth-prune-types", "reth-stages-types", "serde", @@ -8403,6 +8410,7 @@ dependencies = [ name = "reth-revm" version = "1.0.7" dependencies = [ + "alloy-primitives", "reth-chainspec", "reth-consensus-common", "reth-ethereum-forks", @@ -8757,6 +8765,7 @@ dependencies = [ name = "reth-stages" version = "1.0.7" dependencies = [ + "alloy-primitives", "alloy-rlp", "assert_matches", "criterion", diff --git a/bin/reth/Cargo.toml b/bin/reth/Cargo.toml index 19d7d18f1c08..e456871facb6 100644 --- a/bin/reth/Cargo.toml +++ b/bin/reth/Cargo.toml @@ -69,6 +69,7 @@ reth-prune.workspace = true alloy-rlp.workspace = true alloy-rpc-types = { workspace = true, features = ["engine"] } alloy-consensus.workspace = true +alloy-primitives.workspace = true # tracing tracing.workspace = true diff --git a/bin/reth/src/commands/debug_cmd/build_block.rs b/bin/reth/src/commands/debug_cmd/build_block.rs index a8589a74ec8d..57a8ee8a6b8d 100644 --- a/bin/reth/src/commands/debug_cmd/build_block.rs +++ b/bin/reth/src/commands/debug_cmd/build_block.rs @@ -1,5 +1,6 @@ //! Command for debugging block building. use alloy_consensus::TxEip4844; +use alloy_primitives::Address; use alloy_rlp::Decodable; use alloy_rpc_types::engine::{BlobsBundleV1, PayloadAttributes}; use clap::Parser; @@ -24,7 +25,7 @@ use reth_node_api::{NodeTypesWithDB, NodeTypesWithEngine, PayloadBuilderAttribut use reth_node_ethereum::{EthEvmConfig, EthExecutorProvider}; use reth_payload_builder::database::CachedReads; use reth_primitives::{ - revm_primitives::KzgSettings, Address, BlobTransaction, BlobTransactionSidecar, Bytes, + revm_primitives::KzgSettings, BlobTransaction, BlobTransactionSidecar, Bytes, PooledTransactionsElement, SealedBlock, SealedBlockWithSenders, Transaction, TransactionSigned, B256, U256, }; diff --git a/bin/reth/src/commands/debug_cmd/execution.rs b/bin/reth/src/commands/debug_cmd/execution.rs index 64ca4dc2dc84..46cc6064d25e 100644 --- a/bin/reth/src/commands/debug_cmd/execution.rs +++ b/bin/reth/src/commands/debug_cmd/execution.rs @@ -1,6 +1,7 @@ //! Command for debugging execution. use crate::{args::NetworkArgs, utils::get_single_header}; +use alloy_primitives::BlockNumber; use clap::Parser; use futures::{stream::select as stream_select, StreamExt}; use reth_beacon_consensus::EthBeaconConsensus; @@ -22,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, BlockNumber, B256}; +use reth_primitives::{BlockHashOrNumber, B256}; use reth_provider::{ BlockExecutionWriter, ChainSpecProvider, ProviderFactory, StageCheckpointReader, }; diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index d8224a3d62ed..a186b8407a8a 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -27,4 +27,4 @@ eyre.workspace = true [dev-dependencies] tempfile.workspace = true reth-network-peers.workspace = true -reth-primitives.workspace = true +alloy-primitives.workspace = true diff --git a/crates/config/src/config.rs b/crates/config/src/config.rs index 24c992fddd82..e4a7fc9677aa 100644 --- a/crates/config/src/config.rs +++ b/crates/config/src/config.rs @@ -444,8 +444,8 @@ where mod tests { use super::{Config, EXTENSION}; use crate::PruneConfig; + use alloy_primitives::Address; use reth_network_peers::TrustedPeer; - use reth_primitives::Address; use reth_prune_types::{PruneMode, PruneModes, ReceiptsLogPruneConfig}; use std::{collections::BTreeMap, path::Path, str::FromStr, time::Duration}; diff --git a/crates/evm/execution-types/Cargo.toml b/crates/evm/execution-types/Cargo.toml index c286f07906bb..65426e3083b4 100644 --- a/crates/evm/execution-types/Cargo.toml +++ b/crates/evm/execution-types/Cargo.toml @@ -25,7 +25,6 @@ serde = { workspace = true, optional = true } [dev-dependencies] reth-primitives = { workspace = true, features = ["test-utils"] } -alloy-primitives.workspace = true alloy-eips.workspace = true [features] diff --git a/crates/node/builder/src/setup.rs b/crates/node/builder/src/setup.rs index 10144d8699de..44c9f19e84b3 100644 --- a/crates/node/builder/src/setup.rs +++ b/crates/node/builder/src/setup.rs @@ -2,6 +2,7 @@ use std::sync::Arc; +use alloy_primitives::BlockNumber; use reth_config::{config::StageConfig, PruneConfig}; use reth_consensus::Consensus; use reth_downloaders::{ @@ -13,7 +14,7 @@ use reth_exex::ExExManagerHandle; use reth_network_p2p::{ bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader, BlockClient, }; -use reth_node_core::primitives::{BlockNumber, B256}; +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/optimism/cli/src/commands/init_state/bedrock.rs b/crates/optimism/cli/src/commands/init_state/bedrock.rs index 41cd467b2f22..2426a195a8b6 100644 --- a/crates/optimism/cli/src/commands/init_state/bedrock.rs +++ b/crates/optimism/cli/src/commands/init_state/bedrock.rs @@ -1,8 +1,7 @@ -use alloy_primitives::B256; +use alloy_primitives::{BlockNumber, B256}; use reth_optimism_primitives::bedrock::{BEDROCK_HEADER, BEDROCK_HEADER_HASH, BEDROCK_HEADER_TTD}; use reth_primitives::{ - BlockBody, BlockNumber, Header, SealedBlock, SealedBlockWithSenders, SealedHeader, - StaticFileSegment, U256, + BlockBody, Header, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, U256, }; use reth_provider::{ providers::StaticFileProvider, BlockWriter, StageCheckpointWriter, StaticFileWriter, diff --git a/crates/optimism/cli/src/receipt_file_codec.rs b/crates/optimism/cli/src/receipt_file_codec.rs index c86bfa12a6bd..c0416fa5f072 100644 --- a/crates/optimism/cli/src/receipt_file_codec.rs +++ b/crates/optimism/cli/src/receipt_file_codec.rs @@ -1,10 +1,10 @@ //! Codec for reading raw receipts from a file. -use alloy_primitives::B256; +use alloy_primitives::{Address, Bloom, B256}; use alloy_rlp::{Decodable, RlpDecodable}; use reth_primitives::{ bytes::{Buf, BytesMut}, - Address, Bloom, Bytes, Log, Receipt, TxType, + Bytes, Log, Receipt, TxType, }; use tokio_util::codec::Decoder; diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index 401757d30bb7..a5357fcec993 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -1,12 +1,12 @@ use crate::{ - Address, Bytes, GotExpected, Header, SealedHeader, TransactionSigned, - TransactionSignedEcRecovered, Withdrawals, B256, + Bytes, GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, + Withdrawals, B256, }; use alloc::vec::Vec; pub use alloy_eips::eip1898::{ BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash, }; -use alloy_primitives::Sealable; +use alloy_primitives::{Address, Sealable}; 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 ca807eddb533..b0564ed07d5a 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -72,10 +72,9 @@ pub use transaction::{ pub use alloy_primitives::{ self, address, b256, bloom, bytes, bytes::{Buf, BufMut, BytesMut}, - eip191_hash_message, hex, hex_literal, keccak256, ruint, + hex, hex_literal, ruint, utils::format_ether, - Address, BlockHash, BlockNumber, Bloom, BloomInput, Bytes, ChainId, Selector, StorageKey, - StorageValue, TxHash, TxIndex, TxNumber, B128, B256, B512, B64, U128, U256, U64, U8, + Bytes, StorageValue, TxHash, TxIndex, TxNumber, B128, B256, B512, B64, U128, U256, U64, }; 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 a19564de0938..040ec365503e 100644 --- a/crates/primitives/src/proofs.rs +++ b/crates/primitives/src/proofs.rs @@ -1,11 +1,12 @@ //! Helper function for calculating Merkle proofs and hashes. use crate::{ - constants::EMPTY_OMMER_ROOT_HASH, keccak256, Header, Receipt, ReceiptWithBloom, - ReceiptWithBloomRef, Request, TransactionSigned, Withdrawal, B256, + constants::EMPTY_OMMER_ROOT_HASH, Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, + Request, TransactionSigned, Withdrawal, B256, }; use alloc::vec::Vec; use alloy_eips::eip7685::Encodable7685; +use alloy_primitives::keccak256; use reth_trie_common::root::{ordered_trie_root, ordered_trie_root_with_encoder}; /// Calculate a transaction root. diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index aa9b6c6d7c23..6b43e77e913a 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, Bloom, Bytes, TxType, B256, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, - EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID, + logs_bloom, Bytes, TxType, B256, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, + EIP7702_TX_TYPE_ID, }; use alloc::{vec, vec::Vec}; -use alloy_primitives::Log; +use alloy_primitives::{Bloom, Log}; 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 7a0782bef761..32beb293f9c1 100644 --- a/crates/primitives/src/transaction/access_list.rs +++ b/crates/primitives/src/transaction/access_list.rs @@ -2,8 +2,9 @@ #[cfg(test)] mod tests { - use crate::{Address, B256}; + use crate::B256; use alloy_eips::eip2930::{AccessList, AccessListItem}; + use alloy_primitives::Address; 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 319ae55b1af1..ac39671f34a8 100644 --- a/crates/primitives/src/transaction/compat.rs +++ b/crates/primitives/src/transaction/compat.rs @@ -1,5 +1,5 @@ -use crate::{Address, Transaction, TransactionSigned, U256}; -use alloy_primitives::TxKind; +use crate::{Transaction, TransactionSigned, U256}; +use alloy_primitives::{Address, TxKind}; use revm_primitives::{AuthorizationList, TxEnv}; /// Implements behaviour to fill a [`TxEnv`] from another transaction. diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index fc055adb26b4..ec1ddaa87810 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -1,8 +1,8 @@ //! Transaction types. -use crate::{keccak256, Address, BlockHashOrNumber, Bytes, TxHash, B256, U256}; +use crate::{BlockHashOrNumber, Bytes, TxHash, B256, U256}; use alloy_eips::eip7702::SignedAuthorization; -use alloy_primitives::TxKind; +use alloy_primitives::{keccak256, Address, TxKind}; use alloy_consensus::{SignableTransaction, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy}; use alloy_eips::eip2930::AccessList; @@ -1693,10 +1693,10 @@ mod tests { use crate::{ hex, transaction::{signature::Signature, TxEip1559, TxKind, TxLegacy}, - Address, Bytes, Transaction, TransactionSigned, TransactionSignedEcRecovered, + Bytes, Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, B256, U256, }; - use alloy_primitives::{address, b256, bytes, Parity}; + use alloy_primitives::{address, b256, bytes, Address, Parity}; 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 78ad756923c0..3f19b29b36c1 100644 --- a/crates/primitives/src/transaction/pooled.rs +++ b/crates/primitives/src/transaction/pooled.rs @@ -7,14 +7,15 @@ use super::{ TxEip7702, }; use crate::{ - Address, BlobTransaction, BlobTransactionSidecar, Bytes, Signature, Transaction, - TransactionSigned, TransactionSignedEcRecovered, TxHash, B256, EIP4844_TX_TYPE_ID, + BlobTransaction, BlobTransactionSidecar, Bytes, Signature, Transaction, TransactionSigned, + TransactionSignedEcRecovered, TxHash, B256, EIP4844_TX_TYPE_ID, }; use alloc::vec::Vec; use alloy_consensus::{ transaction::{TxEip1559, TxEip2930, TxEip4844, TxLegacy}, SignableTransaction, TxEip4844WithSidecar, }; +use alloy_primitives::Address; 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/sidecar.rs b/crates/primitives/src/transaction/sidecar.rs index e486fa670b6d..94dfbe6da4b6 100644 --- a/crates/primitives/src/transaction/sidecar.rs +++ b/crates/primitives/src/transaction/sidecar.rs @@ -1,7 +1,8 @@ #![cfg_attr(docsrs, doc(cfg(feature = "c-kzg")))] -use crate::{keccak256, Signature, Transaction, TransactionSigned, TxHash, EIP4844_TX_TYPE_ID}; +use crate::{Signature, Transaction, TransactionSigned, TxHash, EIP4844_TX_TYPE_ID}; use alloy_consensus::{transaction::TxEip4844, TxEip4844WithSidecar}; +use alloy_primitives::keccak256; use alloy_rlp::{Decodable, Error as RlpError, Header}; use serde::{Deserialize, Serialize}; diff --git a/crates/primitives/src/transaction/signature.rs b/crates/primitives/src/transaction/signature.rs index 4b4b5bb4547e..07a2d6195795 100644 --- a/crates/primitives/src/transaction/signature.rs +++ b/crates/primitives/src/transaction/signature.rs @@ -1,6 +1,5 @@ -use crate::{transaction::util::secp256k1, Address, B256, U256}; - -use alloy_primitives::Parity; +use crate::{transaction::util::secp256k1, B256, U256}; +use alloy_primitives::{Address, Parity}; use alloy_rlp::{Decodable, Error as RlpError}; pub use alloy_primitives::Signature; @@ -120,9 +119,9 @@ mod tests { transaction::signature::{ legacy_parity, recover_signer, recover_signer_unchecked, SECP256K1N_HALF, }, - Address, Signature, B256, U256, + Signature, B256, U256, }; - use alloy_primitives::Parity; + use alloy_primitives::{Address, Parity}; use std::str::FromStr; #[test] diff --git a/crates/primitives/src/transaction/tx_type.rs b/crates/primitives/src/transaction/tx_type.rs index 7331ba1ed93f..4017d8d4b9c4 100644 --- a/crates/primitives/src/transaction/tx_type.rs +++ b/crates/primitives/src/transaction/tx_type.rs @@ -1,4 +1,5 @@ -use crate::{U64, U8}; +use crate::U64; +use alloy_primitives::U8; use alloy_rlp::{Decodable, Encodable}; use serde::{Deserialize, Serialize}; diff --git a/crates/primitives/src/transaction/util.rs b/crates/primitives/src/transaction/util.rs index f3f49cb316c1..6205ec886ca0 100644 --- a/crates/primitives/src/transaction/util.rs +++ b/crates/primitives/src/transaction/util.rs @@ -1,4 +1,5 @@ -use crate::{Address, Signature}; +use crate::Signature; +use alloy_primitives::Address; use revm_primitives::B256; #[cfg(feature = "secp256k1")] @@ -14,13 +15,12 @@ pub(crate) mod secp256k1 { #[cfg(feature = "secp256k1")] mod impl_secp256k1 { use super::*; - use crate::keccak256; pub(crate) use ::secp256k1::Error; use ::secp256k1::{ ecdsa::{RecoverableSignature, RecoveryId}, Message, PublicKey, SecretKey, SECP256K1, }; - use alloy_primitives::Parity; + use alloy_primitives::{keccak256, Parity}; use revm_primitives::U256; /// Recovers the address of the sender using secp256k1 pubkey recovery. @@ -65,8 +65,7 @@ mod impl_secp256k1 { #[cfg_attr(feature = "secp256k1", allow(unused, unreachable_pub))] mod impl_k256 { use super::*; - use crate::keccak256; - use alloy_primitives::Parity; + use alloy_primitives::{keccak256, Parity}; pub(crate) use k256::ecdsa::Error; use k256::ecdsa::{RecoveryId, SigningKey, VerifyingKey}; use revm_primitives::U256; diff --git a/crates/primitives/src/transaction/variant.rs b/crates/primitives/src/transaction/variant.rs index 3e96b6dda899..c558e7ccb9ba 100644 --- a/crates/primitives/src/transaction/variant.rs +++ b/crates/primitives/src/transaction/variant.rs @@ -2,9 +2,9 @@ //! `TransactionSignedEcRecovered` use crate::{ - Address, Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, - B256, + Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, B256, }; +use alloy_primitives::Address; use core::ops::Deref; /// Represents various different transaction formats used in reth. diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index b4f169249444..9e4501f62770 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -21,6 +21,7 @@ reth-consensus-common.workspace = true reth-prune-types.workspace = true reth-storage-api.workspace = true reth-trie = { workspace = true, optional = true } +alloy-primitives.workspace = true # revm revm.workspace = true @@ -28,6 +29,7 @@ revm.workspace = true [dev-dependencies] reth-trie.workspace = true reth-ethereum-forks.workspace = true +alloy-primitives.workspace = true [features] default = ["std", "c-kzg"] diff --git a/crates/revm/src/batch.rs b/crates/revm/src/batch.rs index 4502732a429d..7c8e0f29b5d7 100644 --- a/crates/revm/src/batch.rs +++ b/crates/revm/src/batch.rs @@ -182,7 +182,8 @@ impl BlockBatchRecord { mod tests { use super::*; use alloc::collections::BTreeMap; - use reth_primitives::{Address, Log, Receipt}; + use alloy_primitives::Address; + use reth_primitives::{Log, Receipt}; use reth_prune_types::{PruneMode, ReceiptsLogPruneConfig}; #[test] diff --git a/crates/revm/src/database.rs b/crates/revm/src/database.rs index fb5f71045ea1..e277d63e4bcc 100644 --- a/crates/revm/src/database.rs +++ b/crates/revm/src/database.rs @@ -1,6 +1,7 @@ use crate::primitives::alloy_primitives::{BlockNumber, StorageKey, StorageValue}; +use alloy_primitives::Address; use core::ops::{Deref, DerefMut}; -use reth_primitives::{Account, Address, B256, U256}; +use reth_primitives::{Account, B256, U256}; 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 6376957f3111..8799b8c70eb2 100644 --- a/crates/revm/src/state_change.rs +++ b/crates/revm/src/state_change.rs @@ -1,7 +1,8 @@ use crate::precompile::HashMap; +use alloy_primitives::Address; use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_consensus_common::calc; -use reth_primitives::{Address, Block, Withdrawal, Withdrawals, U256}; +use reth_primitives::{Block, Withdrawal, Withdrawals, U256}; /// 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 fe377bc5fc3d..bbdc196cd528 100644 --- a/crates/revm/src/test_utils.rs +++ b/crates/revm/src/test_utils.rs @@ -2,9 +2,8 @@ use std::collections::HashSet; use crate::precompile::HashMap; use alloc::vec::Vec; -use reth_primitives::{ - keccak256, Account, Address, BlockNumber, Bytecode, Bytes, StorageKey, B256, U256, -}; +use alloy_primitives::{keccak256, Address, BlockNumber, StorageKey}; +use reth_primitives::{Account, Bytecode, Bytes, B256, U256}; use reth_storage_api::{ AccountReader, BlockHashReader, StateProofProvider, StateProvider, StateRootProvider, StorageRootProvider, diff --git a/crates/rpc/rpc/src/eth/helpers/types.rs b/crates/rpc/rpc/src/eth/helpers/types.rs index 8cd659bb81d2..05da8bd91563 100644 --- a/crates/rpc/rpc/src/eth/helpers/types.rs +++ b/crates/rpc/rpc/src/eth/helpers/types.rs @@ -1,10 +1,10 @@ //! L1 `eth` API types. use alloy_network::{AnyNetwork, Network}; -use alloy_primitives::TxKind; +use alloy_primitives::{Address, TxKind}; use alloy_rpc_types::{Transaction, TransactionInfo}; use alloy_serde::WithOtherFields; -use reth_primitives::{Address, TransactionSignedEcRecovered}; +use reth_primitives::TransactionSignedEcRecovered; use reth_rpc_types_compat::{ transaction::{from_primitive_signature, GasPrice}, TransactionCompat, diff --git a/crates/stages/stages/Cargo.toml b/crates/stages/stages/Cargo.toml index 934e9b109053..9ed84160477f 100644 --- a/crates/stages/stages/Cargo.toml +++ b/crates/stages/stages/Cargo.toml @@ -37,6 +37,8 @@ reth-trie-db = { workspace = true, features = ["metrics"] } reth-testing-utils = { workspace = true, optional = true } +alloy-primitives.workspace = true + # async tokio = { workspace = true, features = ["sync"] } futures-util.workspace = true diff --git a/crates/stages/stages/benches/criterion.rs b/crates/stages/stages/benches/criterion.rs index 3957ceac4d70..7519d81a3622 100644 --- a/crates/stages/stages/benches/criterion.rs +++ b/crates/stages/stages/benches/criterion.rs @@ -6,7 +6,7 @@ use reth_chainspec::ChainSpec; use reth_config::config::{EtlConfig, TransactionLookupConfig}; use reth_db::{test_utils::TempDatabase, Database, DatabaseEnv}; -use reth_primitives::BlockNumber; +use alloy_primitives::BlockNumber; use reth_provider::{DatabaseProvider, DatabaseProviderFactory}; use reth_stages::{ stages::{MerkleStage, SenderRecoveryStage, TransactionLookupStage}, diff --git a/crates/stages/stages/benches/setup/account_hashing.rs b/crates/stages/stages/benches/setup/account_hashing.rs index 86831418e53f..9926c1f3d378 100644 --- a/crates/stages/stages/benches/setup/account_hashing.rs +++ b/crates/stages/stages/benches/setup/account_hashing.rs @@ -1,11 +1,11 @@ #![allow(unreachable_pub)] use super::constants; +use alloy_primitives::BlockNumber; use reth_db::tables; use reth_db_api::{ cursor::DbCursorRO, database::Database, transaction::DbTx, DatabaseError as DbError, }; -use reth_primitives::BlockNumber; use reth_stages::{ stages::{AccountHashingStage, SeedOpts}, test_utils::TestStageDB, diff --git a/crates/stages/stages/benches/setup/mod.rs b/crates/stages/stages/benches/setup/mod.rs index 41570c057f8e..85e4e3e5a318 100644 --- a/crates/stages/stages/benches/setup/mod.rs +++ b/crates/stages/stages/benches/setup/mod.rs @@ -1,4 +1,5 @@ #![allow(unreachable_pub)] +use alloy_primitives::Address; use itertools::concat; use reth_chainspec::ChainSpec; use reth_db::{tables, test_utils::TempDatabase, Database, DatabaseEnv}; @@ -6,9 +7,7 @@ use reth_db_api::{ cursor::DbCursorRO, transaction::{DbTx, DbTxMut}, }; -use reth_primitives::{ - alloy_primitives::Sealable, Account, Address, SealedBlock, SealedHeader, B256, U256, -}; +use reth_primitives::{alloy_primitives::Sealable, Account, SealedBlock, SealedHeader, B256, U256}; use reth_provider::{DatabaseProvider, DatabaseProviderFactory, TrieWriter}; use reth_stages::{ stages::{AccountHashingStage, StorageHashingStage}, diff --git a/crates/stages/stages/src/stages/bodies.rs b/crates/stages/stages/src/stages/bodies.rs index 7f6d2d6a066f..cc30fc90a11d 100644 --- a/crates/stages/stages/src/stages/bodies.rs +++ b/crates/stages/stages/src/stages/bodies.rs @@ -621,6 +621,7 @@ mod tests { UnwindStageTestRunner, }, }; + use alloy_primitives::{BlockHash, BlockNumber}; use futures_util::Stream; use reth_db::{static_file::HeaderMask, tables}; use reth_db_api::{ @@ -636,8 +637,7 @@ mod tests { error::DownloadResult, }; use reth_primitives::{ - BlockBody, BlockHash, BlockNumber, Header, SealedBlock, SealedHeader, - StaticFileSegment, TxNumber, B256, + BlockBody, Header, SealedBlock, SealedHeader, StaticFileSegment, TxNumber, B256, }; use reth_provider::{ providers::StaticFileWriter, test_utils::MockNodeTypesWithDB, HeaderProvider, diff --git a/crates/stages/stages/src/stages/execution.rs b/crates/stages/stages/src/stages/execution.rs index 57a9cdaab7ef..04cc1dd65923 100644 --- a/crates/stages/stages/src/stages/execution.rs +++ b/crates/stages/stages/src/stages/execution.rs @@ -1,4 +1,5 @@ use crate::stages::MERKLE_STAGE_DEFAULT_CLEAN_THRESHOLD; +use alloy_primitives::BlockNumber; use num_traits::Zero; use reth_config::config::ExecutionConfig; use reth_db::{static_file::HeaderMask, tables}; @@ -9,9 +10,7 @@ use reth_evm::{ }; use reth_execution_types::{Chain, ExecutionOutcome}; use reth_exex::{ExExManagerHandle, ExExNotification}; -use reth_primitives::{ - alloy_primitives::Sealable, BlockNumber, Header, SealedHeader, StaticFileSegment, -}; +use reth_primitives::{alloy_primitives::Sealable, Header, SealedHeader, StaticFileSegment}; use reth_primitives_traits::format_gas_throughput; use reth_provider::{ providers::{StaticFileProvider, StaticFileProviderRWRefMut, StaticFileWriter}, @@ -659,6 +658,7 @@ where mod tests { use super::*; use crate::test_utils::TestStageDB; + use alloy_primitives::{keccak256, Address}; use alloy_rlp::Decodable; use assert_matches::assert_matches; use reth_chainspec::ChainSpecBuilder; @@ -666,8 +666,7 @@ mod tests { use reth_evm_ethereum::execute::EthExecutorProvider; use reth_execution_errors::BlockValidationError; use reth_primitives::{ - address, hex_literal::hex, keccak256, Account, Address, Bytecode, SealedBlock, - StorageEntry, B256, U256, + address, hex_literal::hex, Account, Bytecode, SealedBlock, StorageEntry, B256, U256, }; use reth_provider::{ test_utils::create_test_provider_factory, AccountReader, DatabaseProviderFactory, diff --git a/crates/stages/stages/src/stages/hashing_account.rs b/crates/stages/stages/src/stages/hashing_account.rs index 2e109f7557f1..bbcb9b8da270 100644 --- a/crates/stages/stages/src/stages/hashing_account.rs +++ b/crates/stages/stages/src/stages/hashing_account.rs @@ -1,3 +1,4 @@ +use alloy_primitives::keccak256; use itertools::Itertools; use reth_config::config::{EtlConfig, HashingConfig}; use reth_db::{tables, RawKey, RawTable, RawValue}; @@ -6,7 +7,7 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, }; use reth_etl::Collector; -use reth_primitives::{keccak256, Account, B256}; +use reth_primitives::{Account, B256}; use reth_provider::{AccountExtReader, DBProvider, HashingWriter, StatsReader}; use reth_stages_api::{ AccountHashingCheckpoint, EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, @@ -63,7 +64,7 @@ impl AccountHashingStage { >( provider: &reth_provider::DatabaseProvider, opts: SeedOpts, - ) -> Result, StageError> { + ) -> Result, StageError> { use reth_db_api::models::AccountBeforeTx; use reth_primitives::U256; use reth_provider::{StaticFileProviderFactory, StaticFileWriter}; @@ -348,7 +349,7 @@ mod tests { mod test_utils { use super::*; use crate::test_utils::TestStageDB; - use reth_primitives::Address; + use alloy_primitives::Address; use reth_provider::DatabaseProviderFactory; pub(crate) struct AccountHashingTestRunner { diff --git a/crates/stages/stages/src/stages/hashing_storage.rs b/crates/stages/stages/src/stages/hashing_storage.rs index 54a9921dd521..ba1e03c1a296 100644 --- a/crates/stages/stages/src/stages/hashing_storage.rs +++ b/crates/stages/stages/src/stages/hashing_storage.rs @@ -1,3 +1,4 @@ +use alloy_primitives::keccak256; use itertools::Itertools; use reth_config::config::{EtlConfig, HashingConfig}; use reth_db::tables; @@ -8,7 +9,7 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, }; use reth_etl::Collector; -use reth_primitives::{keccak256, BufMut, StorageEntry, B256}; +use reth_primitives::{BufMut, StorageEntry, B256}; use reth_provider::{DBProvider, HashingWriter, StatsReader, StorageReader}; use reth_stages_api::{ EntitiesCheckpoint, ExecInput, ExecOutput, Stage, StageCheckpoint, StageError, StageId, @@ -211,13 +212,14 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; + use alloy_primitives::Address; use assert_matches::assert_matches; use rand::Rng; use reth_db_api::{ cursor::{DbCursorRW, DbDupCursorRO}, models::StoredBlockBodyIndices, }; - use reth_primitives::{Address, SealedBlock, U256}; + use reth_primitives::{SealedBlock, U256}; 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 f2ff1c666e26..25c7abaee48a 100644 --- a/crates/stages/stages/src/stages/headers.rs +++ b/crates/stages/stages/src/stages/headers.rs @@ -1,3 +1,4 @@ +use alloy_primitives::{BlockHash, BlockNumber}; use futures_util::StreamExt; use reth_codecs::Compact; use reth_config::config::EtlConfig; @@ -10,7 +11,7 @@ use reth_db_api::{ }; use reth_etl::Collector; use reth_network_p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError}; -use reth_primitives::{BlockHash, BlockNumber, SealedHeader, StaticFileSegment, B256}; +use reth_primitives::{SealedHeader, StaticFileSegment, B256}; use reth_provider::{ providers::{StaticFileProvider, StaticFileWriter}, BlockHashReader, DBProvider, HeaderProvider, HeaderSyncGap, HeaderSyncGapProvider, diff --git a/crates/stages/stages/src/stages/index_account_history.rs b/crates/stages/stages/src/stages/index_account_history.rs index 8ca8d173fd85..e0fcde2b194f 100644 --- a/crates/stages/stages/src/stages/index_account_history.rs +++ b/crates/stages/stages/src/stages/index_account_history.rs @@ -1,8 +1,8 @@ use super::{collect_history_indices, load_history_indices}; +use alloy_primitives::Address; use reth_config::config::{EtlConfig, IndexHistoryConfig}; use reth_db::tables; use reth_db_api::{models::ShardedKey, table::Decode, transaction::DbTxMut}; -use reth_primitives::Address; use reth_provider::{DBProvider, HistoryWriter, PruneCheckpointReader, PruneCheckpointWriter}; use reth_prune_types::{PruneCheckpoint, PruneMode, PrunePurpose, PruneSegment}; use reth_stages_api::{ @@ -148,6 +148,7 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; + use alloy_primitives::BlockNumber; use itertools::Itertools; use reth_db::BlockNumberList; use reth_db_api::{ @@ -158,7 +159,7 @@ mod tests { }, transaction::DbTx, }; - use reth_primitives::{address, BlockNumber, B256}; + 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 00646da2fd22..4af2cb3efea2 100644 --- a/crates/stages/stages/src/stages/index_storage_history.rs +++ b/crates/stages/stages/src/stages/index_storage_history.rs @@ -153,6 +153,7 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; + use alloy_primitives::{Address, BlockNumber}; use itertools::Itertools; use reth_db::BlockNumberList; use reth_db_api::{ @@ -163,7 +164,7 @@ mod tests { }, transaction::DbTx, }; - use reth_primitives::{address, b256, Address, BlockNumber, StorageEntry, B256, U256}; + use reth_primitives::{address, b256, StorageEntry, B256, U256}; 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 83c8c52ce561..7b94067e9926 100644 --- a/crates/stages/stages/src/stages/merkle.rs +++ b/crates/stages/stages/src/stages/merkle.rs @@ -1,8 +1,9 @@ +use alloy_primitives::BlockNumber; 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, BlockNumber, GotExpected, SealedHeader, B256}; +use reth_primitives::{alloy_primitives::Sealable, GotExpected, SealedHeader, B256}; use reth_provider::{ DBProvider, HeaderProvider, ProviderError, StageCheckpointReader, StageCheckpointWriter, StatsReader, TrieWriter, @@ -373,9 +374,10 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, StorageKind, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; + use alloy_primitives::keccak256; use assert_matches::assert_matches; use reth_db_api::cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}; - use reth_primitives::{keccak256, SealedBlock, StaticFileSegment, StorageEntry, U256}; + use reth_primitives::{SealedBlock, StaticFileSegment, StorageEntry, U256}; 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 4eb3c6f141d4..d3c5b7099d21 100644 --- a/crates/stages/stages/src/stages/mod.rs +++ b/crates/stages/stages/src/stages/mod.rs @@ -42,6 +42,7 @@ use utils::*; mod tests { use super::*; use crate::test_utils::{StorageKind, TestStageDB}; + use alloy_primitives::{keccak256, BlockNumber}; use alloy_rlp::Decodable; use reth_chainspec::ChainSpecBuilder; use reth_db::{ @@ -56,8 +57,7 @@ mod tests { use reth_evm_ethereum::execute::EthExecutorProvider; use reth_exex::ExExManagerHandle; use reth_primitives::{ - address, hex_literal::hex, keccak256, Account, BlockNumber, Bytecode, SealedBlock, - StaticFileSegment, B256, U256, + address, hex_literal::hex, Account, Bytecode, SealedBlock, StaticFileSegment, B256, U256, }; use reth_provider::{ providers::{StaticFileProvider, StaticFileWriter}, diff --git a/crates/stages/stages/src/stages/sender_recovery.rs b/crates/stages/stages/src/stages/sender_recovery.rs index bf7df6147ff8..344a8ea848ee 100644 --- a/crates/stages/stages/src/stages/sender_recovery.rs +++ b/crates/stages/stages/src/stages/sender_recovery.rs @@ -1,3 +1,4 @@ +use alloy_primitives::Address; use reth_config::config::SenderRecoveryConfig; use reth_consensus::ConsensusError; use reth_db::{static_file::TransactionMask, tables, RawValue}; @@ -6,7 +7,7 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, DbTxUnwindExt, }; -use reth_primitives::{Address, GotExpected, StaticFileSegment, TransactionSignedNoHash, TxNumber}; +use reth_primitives::{GotExpected, StaticFileSegment, TransactionSignedNoHash, TxNumber}; use reth_provider::{ BlockReader, DBProvider, HeaderProvider, ProviderError, PruneCheckpointReader, StaticFileProviderFactory, StatsReader, @@ -333,9 +334,10 @@ struct FailedSenderRecoveryError { #[cfg(test)] mod tests { + use alloy_primitives::BlockNumber; use assert_matches::assert_matches; use reth_db_api::cursor::DbCursorRO; - use reth_primitives::{BlockNumber, SealedBlock, TransactionSigned, B256}; + use reth_primitives::{SealedBlock, TransactionSigned, B256}; 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 e636c281829d..4e68cfe90b76 100644 --- a/crates/stages/stages/src/stages/tx_lookup.rs +++ b/crates/stages/stages/src/stages/tx_lookup.rs @@ -250,8 +250,9 @@ mod tests { stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, StorageKind, TestRunnerError, TestStageDB, UnwindStageTestRunner, }; + use alloy_primitives::BlockNumber; use assert_matches::assert_matches; - use reth_primitives::{BlockNumber, SealedBlock, B256}; + use reth_primitives::{SealedBlock, B256}; use reth_provider::{ providers::StaticFileWriter, DatabaseProviderFactory, StaticFileProviderFactory, }; diff --git a/crates/stages/stages/src/stages/utils.rs b/crates/stages/stages/src/stages/utils.rs index cb9c729aa234..c16886e0bdca 100644 --- a/crates/stages/stages/src/stages/utils.rs +++ b/crates/stages/stages/src/stages/utils.rs @@ -1,4 +1,5 @@ //! Utils for `stages`. +use alloy_primitives::BlockNumber; use reth_config::config::EtlConfig; use reth_db::BlockNumberList; use reth_db_api::{ @@ -9,7 +10,6 @@ use reth_db_api::{ DatabaseError, }; use reth_etl::Collector; -use reth_primitives::BlockNumber; use reth_provider::DBProvider; use reth_stages_api::StageError; use std::{collections::HashMap, hash::Hash, ops::RangeBounds}; diff --git a/crates/stages/stages/src/test_utils/test_db.rs b/crates/stages/stages/src/test_utils/test_db.rs index 5fef9d6a2be2..89d74d9d4092 100644 --- a/crates/stages/stages/src/test_utils/test_db.rs +++ b/crates/stages/stages/src/test_utils/test_db.rs @@ -1,3 +1,4 @@ +use alloy_primitives::{keccak256, Address, BlockNumber}; use reth_chainspec::MAINNET; use reth_db::{ tables, @@ -14,8 +15,8 @@ use reth_db_api::{ DatabaseError as DbError, }; use reth_primitives::{ - keccak256, Account, Address, BlockNumber, Receipt, SealedBlock, SealedHeader, - StaticFileSegment, StorageEntry, TxHash, TxNumber, B256, U256, + Account, Receipt, SealedBlock, SealedHeader, StaticFileSegment, StorageEntry, TxHash, TxNumber, + B256, U256, }; use reth_provider::{ providers::{StaticFileProvider, StaticFileProviderRWRefMut, StaticFileWriter}, diff --git a/crates/storage/provider/src/providers/static_file/mod.rs b/crates/storage/provider/src/providers/static_file/mod.rs index 25c5ec7ef6aa..04f032b0fef4 100644 --- a/crates/storage/provider/src/providers/static_file/mod.rs +++ b/crates/storage/provider/src/providers/static_file/mod.rs @@ -56,7 +56,7 @@ impl Deref for LoadedJar { mod tests { use super::*; use crate::{test_utils::create_test_provider_factory, HeaderProvider}; - use alloy_primitives::{B256, U256}; + use alloy_primitives::{BlockHash, B256, U256}; use rand::seq::SliceRandom; use reth_db::{ test_utils::create_test_static_files_dir, CanonicalHeaders, HeaderNumbers, @@ -65,7 +65,7 @@ mod tests { use reth_db_api::transaction::DbTxMut; use reth_primitives::{ static_file::{find_fixed_range, SegmentRangeInclusive, DEFAULT_BLOCKS_PER_STATIC_FILE}, - BlockHash, Header, Receipt, TransactionSignedNoHash, TxNumber, + Header, Receipt, TransactionSignedNoHash, TxNumber, }; use reth_storage_api::{ReceiptProvider, TransactionsProvider}; use reth_testing_utils::generators::{self, random_header_range}; diff --git a/crates/storage/provider/src/test_utils/blocks.rs b/crates/storage/provider/src/test_utils/blocks.rs index 352f5314af9f..6f6aae992446 100644 --- a/crates/storage/provider/src/test_utils/blocks.rs +++ b/crates/storage/provider/src/test_utils/blocks.rs @@ -1,14 +1,14 @@ //! Dummy blocks and data for tests use crate::{DatabaseProviderRW, ExecutionOutcome}; use alloy_consensus::TxLegacy; -use alloy_primitives::{Log, Parity, Sealable, TxKind}; +use alloy_primitives::{Address, BlockNumber, Log, Parity, Sealable, TxKind}; use once_cell::sync::Lazy; use reth_db::tables; use reth_db_api::{database::Database, models::StoredBlockBodyIndices}; use reth_primitives::{ - alloy_primitives, b256, hex_literal::hex, Account, Address, BlockBody, BlockNumber, Bytes, - Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, Signature, Transaction, - TransactionSigned, TxType, Withdrawal, Withdrawals, B256, U256, + alloy_primitives, b256, hex_literal::hex, Account, BlockBody, Bytes, Header, Receipt, + SealedBlock, SealedBlockWithSenders, SealedHeader, Signature, Transaction, TransactionSigned, + TxType, Withdrawal, Withdrawals, B256, U256, }; use reth_trie::root::{state_root_unhashed, storage_root_unhashed}; use revm::{ diff --git a/crates/storage/provider/src/writer/mod.rs b/crates/storage/provider/src/writer/mod.rs index 17bf9db81bd4..d96e722d7b40 100644 --- a/crates/storage/provider/src/writer/mod.rs +++ b/crates/storage/provider/src/writer/mod.rs @@ -544,14 +544,14 @@ mod tests { use crate::{ test_utils::create_test_provider_factory, AccountReader, StorageTrieWriter, TrieWriter, }; - use alloy_primitives::{keccak256, B256, U256}; + use alloy_primitives::{keccak256, Address, B256, U256}; use reth_db::tables; use reth_db_api::{ cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}, models::{AccountBeforeTx, BlockNumberAddress}, transaction::{DbTx, DbTxMut}, }; - use reth_primitives::{Account, Address, Receipt, Receipts, StorageEntry}; + use reth_primitives::{Account, Receipt, Receipts, StorageEntry}; use reth_storage_api::DatabaseProviderFactory; use reth_trie::{ test_utils::{state_root, storage_root_prehashed}, diff --git a/crates/trie/db/src/state.rs b/crates/trie/db/src/state.rs index 4f27679ddad9..9cefc6b9fa83 100644 --- a/crates/trie/db/src/state.rs +++ b/crates/trie/db/src/state.rs @@ -267,9 +267,10 @@ impl DatabaseHashedPostState for HashedPostState { #[cfg(test)] mod tests { use super::*; + use alloy_primitives::Address; use reth_db::test_utils::create_test_rw_db; use reth_db_api::database::Database; - use reth_primitives::{hex, revm_primitives::AccountInfo, Address, U256}; + use reth_primitives::{hex, revm_primitives::AccountInfo, U256}; use revm::db::BundleState; use std::collections::HashMap; diff --git a/examples/custom-engine-types/Cargo.toml b/examples/custom-engine-types/Cargo.toml index 9a949b8367fd..f826451d2038 100644 --- a/examples/custom-engine-types/Cargo.toml +++ b/examples/custom-engine-types/Cargo.toml @@ -18,6 +18,7 @@ reth-node-ethereum = { workspace = true, features = ["test-utils"] } reth-tracing.workspace = true alloy-genesis.workspace = true alloy-rpc-types = { workspace = true, features = ["engine"] } +alloy-primitives.workspace = true eyre.workspace = true tokio.workspace = true diff --git a/examples/custom-engine-types/src/main.rs b/examples/custom-engine-types/src/main.rs index 5e0503701ab9..c4f640e9b87f 100644 --- a/examples/custom-engine-types/src/main.rs +++ b/examples/custom-engine-types/src/main.rs @@ -23,6 +23,7 @@ use serde::{Deserialize, Serialize}; use thiserror::Error; use alloy_genesis::Genesis; +use alloy_primitives::Address; use alloy_rpc_types::{ engine::{ ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4, @@ -63,7 +64,7 @@ use reth_payload_builder::{ EthBuiltPayload, EthPayloadBuilderAttributes, PayloadBuilderError, PayloadBuilderHandle, PayloadBuilderService, }; -use reth_primitives::{Address, Withdrawals, B256}; +use reth_primitives::{Withdrawals, B256}; use reth_tracing::{RethTracer, Tracer}; /// A custom payload attributes type. diff --git a/examples/custom-evm/Cargo.toml b/examples/custom-evm/Cargo.toml index 7642dc80cf2f..53563ab9575b 100644 --- a/examples/custom-evm/Cargo.toml +++ b/examples/custom-evm/Cargo.toml @@ -15,6 +15,7 @@ reth-primitives.workspace = true reth-node-ethereum = { workspace = true, features = ["test-utils"] } reth-tracing.workspace = true alloy-genesis.workspace = true +alloy-primitives.workspace = true eyre.workspace = true tokio.workspace = true diff --git a/examples/custom-evm/src/main.rs b/examples/custom-evm/src/main.rs index 3a93d85ad6fb..4f1c0c7eb299 100644 --- a/examples/custom-evm/src/main.rs +++ b/examples/custom-evm/src/main.rs @@ -3,6 +3,7 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] use alloy_genesis::Genesis; +use alloy_primitives::Address; use reth::{ builder::{ components::{ExecutorBuilder, PayloadServiceBuilder}, @@ -38,7 +39,7 @@ use reth_node_ethereum::{ }; use reth_primitives::{ revm_primitives::{CfgEnvWithHandlerCfg, TxEnv}, - Address, Header, TransactionSigned, U256, + Header, TransactionSigned, U256, }; use reth_tracing::{RethTracer, Tracer}; use std::sync::Arc; diff --git a/examples/custom-inspector/Cargo.toml b/examples/custom-inspector/Cargo.toml index 101806276099..a94980951627 100644 --- a/examples/custom-inspector/Cargo.toml +++ b/examples/custom-inspector/Cargo.toml @@ -12,3 +12,4 @@ reth-rpc-types.workspace = true alloy-rpc-types.workspace = true clap = { workspace = true, features = ["derive"] } futures-util.workspace = true +alloy-primitives.workspace = true diff --git a/examples/custom-inspector/src/main.rs b/examples/custom-inspector/src/main.rs index ce159c75cdba..42271dcabe97 100644 --- a/examples/custom-inspector/src/main.rs +++ b/examples/custom-inspector/src/main.rs @@ -10,6 +10,7 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] +use alloy_primitives::Address; use alloy_rpc_types::state::EvmOverrides; use clap::Parser; use futures_util::StreamExt; @@ -17,7 +18,7 @@ use reth::{ args::utils::DefaultChainSpecParser, builder::NodeHandle, cli::Cli, - primitives::{Address, BlockNumberOrTag}, + primitives::BlockNumberOrTag, revm::{ inspector_handle_register, interpreter::{Interpreter, OpCode}, diff --git a/examples/db-access/Cargo.toml b/examples/db-access/Cargo.toml index c0fbe74e1874..0180f4f90922 100644 --- a/examples/db-access/Cargo.toml +++ b/examples/db-access/Cargo.toml @@ -16,6 +16,7 @@ reth-node-ethereum.workspace = true reth-node-types.workspace = true alloy-rpc-types.workspace = true +alloy-primitives.workspace = true eyre.workspace = true diff --git a/examples/db-access/src/main.rs b/examples/db-access/src/main.rs index 53b56b738c0a..5730e6753522 100644 --- a/examples/db-access/src/main.rs +++ b/examples/db-access/src/main.rs @@ -1,8 +1,9 @@ +use alloy_primitives::Address; 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, Address, SealedHeader, B256}; +use reth_primitives::{alloy_primitives::Sealable, SealedHeader, B256}; use reth_provider::{ providers::StaticFileProvider, AccountReader, BlockReader, BlockSource, HeaderProvider, ProviderFactory, ReceiptProvider, StateProvider, TransactionsProvider, diff --git a/examples/stateful-precompile/Cargo.toml b/examples/stateful-precompile/Cargo.toml index 2ae4656eee86..47a784c36e14 100644 --- a/examples/stateful-precompile/Cargo.toml +++ b/examples/stateful-precompile/Cargo.toml @@ -14,6 +14,7 @@ reth-primitives.workspace = true reth-node-ethereum = { workspace = true, features = ["test-utils"] } reth-tracing.workspace = true alloy-genesis.workspace = true +alloy-primitives.workspace = true eyre.workspace = true parking_lot.workspace = true diff --git a/examples/stateful-precompile/src/main.rs b/examples/stateful-precompile/src/main.rs index 88ca2ac1a7bb..effece640d26 100644 --- a/examples/stateful-precompile/src/main.rs +++ b/examples/stateful-precompile/src/main.rs @@ -3,13 +3,14 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] use alloy_genesis::Genesis; +use alloy_primitives::Address; use parking_lot::RwLock; use reth::{ api::NextBlockEnvAttributes, builder::{components::ExecutorBuilder, BuilderContext, NodeBuilder}, primitives::{ revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, Env, PrecompileResult, TxEnv}, - Address, Bytes, U256, + Bytes, U256, }, revm::{ handler::register::EvmHandler, diff --git a/examples/txpool-tracing/Cargo.toml b/examples/txpool-tracing/Cargo.toml index 219292ee0686..38d0ad9409b6 100644 --- a/examples/txpool-tracing/Cargo.toml +++ b/examples/txpool-tracing/Cargo.toml @@ -11,3 +11,4 @@ reth-node-ethereum.workspace = true alloy-rpc-types-trace.workspace = true clap = { workspace = true, features = ["derive"] } futures-util.workspace = true +alloy-primitives.workspace = true diff --git a/examples/txpool-tracing/src/main.rs b/examples/txpool-tracing/src/main.rs index cf721c51f0a5..6b916dcb5092 100644 --- a/examples/txpool-tracing/src/main.rs +++ b/examples/txpool-tracing/src/main.rs @@ -10,11 +10,12 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] +use alloy_primitives::Address; use alloy_rpc_types_trace::{parity::TraceType, tracerequest::TraceCallRequest}; use clap::Parser; use futures_util::StreamExt; use reth::{ - args::utils::DefaultChainSpecParser, builder::NodeHandle, cli::Cli, primitives::Address, + args::utils::DefaultChainSpecParser, builder::NodeHandle, cli::Cli, rpc::compat::transaction::transaction_to_call_request, transaction_pool::TransactionPool, }; use reth_node_ethereum::node::EthereumNode; diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 8c8c3189a5d3..47d0a388a3ef 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -1,7 +1,7 @@ //! Shared models for use crate::{assert::assert_equal, Error}; -use alloy_primitives::{Address, Bloom, Bytes, B256, B64, U256}; +use alloy_primitives::{keccak256, Address, Bloom, Bytes, B256, B64, U256}; use reth_chainspec::{ChainSpec, ChainSpecBuilder}; use reth_db::tables; use reth_db_api::{ @@ -9,8 +9,7 @@ use reth_db_api::{ transaction::{DbTx, DbTxMut}, }; use reth_primitives::{ - keccak256, Account as RethAccount, Bytecode, Header as RethHeader, SealedHeader, StorageEntry, - Withdrawals, + Account as RethAccount, Bytecode, Header as RethHeader, SealedHeader, StorageEntry, Withdrawals, }; use serde::Deserialize; use std::{collections::BTreeMap, ops::Deref}; diff --git a/testing/testing-utils/src/genesis_allocator.rs b/testing/testing-utils/src/genesis_allocator.rs index 8a5adb300240..d2da3bbabd28 100644 --- a/testing/testing-utils/src/genesis_allocator.rs +++ b/testing/testing-utils/src/genesis_allocator.rs @@ -18,7 +18,8 @@ use std::{ /// /// # Example /// ``` -/// # use reth_primitives::{Address, U256, hex, Bytes}; +/// # use alloy_primitives::Address; +/// # use reth_primitives::{U256, hex, Bytes}; /// # use reth_testing_utils::GenesisAllocator; /// # use std::str::FromStr; /// let mut allocator = GenesisAllocator::default();