From 99fd621d415de226f836aa650c4da726a62a2390 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Sun, 29 Sep 2024 23:26:53 +0200 Subject: [PATCH 1/2] primitives: rm more alloy_primitives reexports --- Cargo.lock | 1 + bin/reth/src/commands/debug_cmd/build_block.rs | 4 ++-- crates/chain-state/src/test_utils.rs | 3 +-- crates/engine/tree/src/backfill.rs | 4 ++-- crates/engine/tree/src/download.rs | 3 ++- crates/engine/tree/src/test_utils.rs | 4 ++-- crates/engine/tree/src/tree/mod.rs | 3 +-- crates/ethereum/consensus/src/validation.rs | 2 +- crates/evm/src/system_calls/eip7002.rs | 4 ++-- crates/evm/src/system_calls/eip7251.rs | 4 ++-- crates/net/downloaders/src/file_client.rs | 4 ++-- crates/net/downloaders/src/headers/reverse_headers.rs | 4 ++-- crates/net/downloaders/src/headers/test_utils.rs | 3 ++- crates/net/downloaders/src/receipt_file_client.rs | 7 +++++-- crates/net/eth-wire-types/src/blocks.rs | 7 ++----- crates/net/eth-wire-types/src/transactions.rs | 7 ++----- crates/net/network/tests/it/multiplex.rs | 3 +-- crates/net/network/tests/it/requests.rs | 6 ++---- crates/net/p2p/src/full_block.rs | 6 ++---- crates/net/p2p/src/test_utils/headers.rs | 3 ++- crates/optimism/cli/src/receipt_file_codec.rs | 11 +++++------ crates/primitives/src/block.rs | 5 ++--- crates/primitives/src/lib.rs | 1 - crates/primitives/src/receipt.rs | 4 ++-- crates/primitives/src/transaction/mod.rs | 10 ++++------ crates/primitives/src/transaction/pooled.rs | 6 +++--- crates/primitives/src/transaction/sidecar.rs | 7 ++++--- crates/primitives/src/transaction/signature.rs | 3 +-- crates/primitives/src/transaction/tx_type.rs | 2 +- crates/revm/src/test_utils.rs | 4 ++-- crates/rpc/rpc-engine-api/tests/it/payload.rs | 7 ++----- crates/stages/stages/benches/setup/mod.rs | 4 ++-- crates/stages/stages/src/stages/execution.rs | 4 ++-- crates/stages/stages/src/stages/headers.rs | 6 ++---- crates/stages/stages/src/stages/merkle.rs | 4 ++-- crates/stages/stages/src/test_utils/test_db.rs | 4 ++-- crates/storage/db-models/src/accounts.rs | 4 ++-- .../provider/src/providers/blockchain_provider.rs | 6 +++--- crates/storage/provider/src/providers/mod.rs | 8 ++++---- crates/storage/provider/src/test_utils/blocks.rs | 9 ++++----- crates/storage/provider/src/test_utils/mock.rs | 7 ++++--- crates/storage/storage-api/src/block.rs | 5 ++--- crates/transaction-pool/src/maintain.rs | 5 ++--- crates/transaction-pool/src/test_utils/gen.rs | 4 ++-- crates/trie/db/src/state.rs | 4 ++-- crates/trie/trie/src/updates.rs | 4 ++-- examples/custom-evm/src/main.rs | 7 ++----- examples/custom-payload-builder/Cargo.toml | 2 ++ examples/custom-payload-builder/src/generator.rs | 3 ++- examples/db-access/src/main.rs | 4 ++-- examples/stateful-precompile/src/main.rs | 7 ++----- testing/testing-utils/src/generators.rs | 4 ++-- 52 files changed, 113 insertions(+), 134 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b7cc7f2ca8b..5682674034c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2765,6 +2765,7 @@ dependencies = [ name = "example-custom-payload-builder" version = "0.0.0" dependencies = [ + "alloy-primitives", "eyre", "futures-util", "reth", diff --git a/bin/reth/src/commands/debug_cmd/build_block.rs b/bin/reth/src/commands/debug_cmd/build_block.rs index 3d2dfa62e873..6f97276839b1 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, B256, U256}; +use alloy_primitives::{Address, Bytes, B256, U256}; use alloy_rlp::Decodable; use alloy_rpc_types::engine::{BlobsBundleV1, PayloadAttributes}; use clap::Parser; @@ -25,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, BlobTransaction, BlobTransactionSidecar, Bytes, + revm_primitives::KzgSettings, BlobTransaction, BlobTransactionSidecar, PooledTransactionsElement, SealedBlock, SealedBlockWithSenders, Transaction, TransactionSigned, }; use reth_provider::{ diff --git a/crates/chain-state/src/test_utils.rs b/crates/chain-state/src/test_utils.rs index f2446eb151fc..9d5b14cf725f 100644 --- a/crates/chain-state/src/test_utils.rs +++ b/crates/chain-state/src/test_utils.rs @@ -3,14 +3,13 @@ use crate::{ CanonStateSubscriptions, }; use alloy_consensus::TxEip1559; -use alloy_primitives::{Address, BlockNumber, B256, U256}; +use alloy_primitives::{Address, BlockNumber, Sealable, B256, U256}; use alloy_signer::SignerSync; use alloy_signer_local::PrivateKeySigner; use rand::{thread_rng, Rng}; use reth_chainspec::{ChainSpec, EthereumHardfork, MIN_TRANSACTION_GAS}; use reth_execution_types::{Chain, ExecutionOutcome}; use reth_primitives::{ - alloy_primitives::Sealable, constants::{EIP1559_INITIAL_BASE_FEE, EMPTY_ROOT_HASH}, proofs::{calculate_receipt_root, calculate_transaction_root, calculate_withdrawals_root}, BlockBody, Header, Receipt, Receipts, Requests, SealedBlock, SealedBlockWithSenders, diff --git a/crates/engine/tree/src/backfill.rs b/crates/engine/tree/src/backfill.rs index 440e86693c77..f3ac904e83a3 100644 --- a/crates/engine/tree/src/backfill.rs +++ b/crates/engine/tree/src/backfill.rs @@ -230,12 +230,12 @@ impl PipelineState { mod tests { use super::*; use crate::test_utils::{insert_headers_into_client, TestPipelineBuilder}; - use alloy_primitives::{BlockNumber, B256}; + use alloy_primitives::{BlockNumber, Sealable, B256}; use assert_matches::assert_matches; use futures::poll; use reth_chainspec::{ChainSpecBuilder, MAINNET}; use reth_network_p2p::test_utils::TestFullBlockClient; - use reth_primitives::{alloy_primitives::Sealable, Header, SealedHeader}; + use reth_primitives::{Header, SealedHeader}; use reth_provider::test_utils::MockNodeTypesWithDB; use reth_stages::ExecOutput; use reth_stages_api::StageCheckpoint; diff --git a/crates/engine/tree/src/download.rs b/crates/engine/tree/src/download.rs index aff99c884065..173de8b4b467 100644 --- a/crates/engine/tree/src/download.rs +++ b/crates/engine/tree/src/download.rs @@ -305,11 +305,12 @@ impl BlockDownloader for NoopBlockDownloader { mod tests { use super::*; use crate::test_utils::insert_headers_into_client; + use alloy_primitives::Sealable; use assert_matches::assert_matches; use reth_beacon_consensus::EthBeaconConsensus; use reth_chainspec::{ChainSpecBuilder, MAINNET}; use reth_network_p2p::test_utils::TestFullBlockClient; - use reth_primitives::{alloy_primitives::Sealable, Header, SealedHeader}; + use reth_primitives::{Header, SealedHeader}; use std::{future::poll_fn, sync::Arc}; struct TestHarness { diff --git a/crates/engine/tree/src/test_utils.rs b/crates/engine/tree/src/test_utils.rs index 3d04e2db765f..f17766a43ed7 100644 --- a/crates/engine/tree/src/test_utils.rs +++ b/crates/engine/tree/src/test_utils.rs @@ -1,7 +1,7 @@ -use alloy_primitives::B256; +use alloy_primitives::{Sealable, B256}; use reth_chainspec::ChainSpec; use reth_network_p2p::test_utils::TestFullBlockClient; -use reth_primitives::{alloy_primitives::Sealable, BlockBody, SealedHeader}; +use reth_primitives::{BlockBody, SealedHeader}; use reth_provider::{ test_utils::{create_test_provider_factory_with_chain_spec, MockNodeTypesWithDB}, ExecutionOutcome, diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index c6b6d6e1287f..2ee7085dc667 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -2558,14 +2558,13 @@ pub enum AdvancePersistenceError { mod tests { use super::*; use crate::persistence::PersistenceAction; - use alloy_primitives::Bytes; + use alloy_primitives::{Bytes, Sealable}; use alloy_rlp::Decodable; use reth_beacon_consensus::{EthBeaconConsensus, ForkchoiceStatus}; use reth_chain_state::{test_utils::TestBlockBuilder, BlockState}; use reth_chainspec::{ChainSpec, HOLESKY, MAINNET}; use reth_ethereum_engine_primitives::EthEngineTypes; use reth_evm::test_utils::MockExecutorProvider; - use reth_primitives::alloy_primitives::Sealable; use reth_provider::test_utils::MockEthProvider; use reth_rpc_types_compat::engine::{block_to_payload_v1, payload::block_to_payload_v3}; use reth_trie::updates::TrieUpdates; diff --git a/crates/ethereum/consensus/src/validation.rs b/crates/ethereum/consensus/src/validation.rs index 1da648cb3ca6..98bc22b5bdff 100644 --- a/crates/ethereum/consensus/src/validation.rs +++ b/crates/ethereum/consensus/src/validation.rs @@ -101,7 +101,7 @@ fn compare_receipts_root_and_logs_bloom( #[cfg(test)] mod tests { - use reth_primitives::hex; + use alloy_primitives::hex; use super::*; diff --git a/crates/evm/src/system_calls/eip7002.rs b/crates/evm/src/system_calls/eip7002.rs index f0149943e495..aa64b8af0c1d 100644 --- a/crates/evm/src/system_calls/eip7002.rs +++ b/crates/evm/src/system_calls/eip7002.rs @@ -4,9 +4,9 @@ use core::fmt::Display; use crate::ConfigureEvm; use alloy_eips::eip7002::{WithdrawalRequest, WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS}; -use alloy_primitives::{Address, Bytes, FixedBytes}; +use alloy_primitives::{bytes::Buf, Address, Bytes, FixedBytes}; use reth_execution_errors::{BlockExecutionError, BlockValidationError}; -use reth_primitives::{Buf, Header, Request}; +use reth_primitives::{Header, Request}; use revm::{interpreter::Host, Database, DatabaseCommit, Evm}; use revm_primitives::{ BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, ResultAndState, diff --git a/crates/evm/src/system_calls/eip7251.rs b/crates/evm/src/system_calls/eip7251.rs index f5a7dca14bf9..a3d3aff2e2f6 100644 --- a/crates/evm/src/system_calls/eip7251.rs +++ b/crates/evm/src/system_calls/eip7251.rs @@ -4,9 +4,9 @@ use core::fmt::Display; use crate::ConfigureEvm; use alloy_eips::eip7251::{ConsolidationRequest, CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS}; -use alloy_primitives::{Address, Bytes, FixedBytes}; +use alloy_primitives::{bytes::Buf, Address, Bytes, FixedBytes}; use reth_execution_errors::{BlockExecutionError, BlockValidationError}; -use reth_primitives::{Buf, Header, Request}; +use reth_primitives::{Header, Request}; use revm::{interpreter::Host, Database, DatabaseCommit, Evm}; use revm_primitives::{ BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, ResultAndState, diff --git a/crates/net/downloaders/src/file_client.rs b/crates/net/downloaders/src/file_client.rs index 6ac2058e4ec4..5b21c82fb3f8 100644 --- a/crates/net/downloaders/src/file_client.rs +++ b/crates/net/downloaders/src/file_client.rs @@ -1,7 +1,7 @@ use std::{collections::HashMap, io, path::Path}; use alloy_eips::BlockHashOrNumber; -use alloy_primitives::{BlockHash, BlockNumber, B256}; +use alloy_primitives::{BlockHash, BlockNumber, Sealable, B256}; use futures::Future; use itertools::Either; use reth_network_p2p::{ @@ -12,7 +12,7 @@ use reth_network_p2p::{ priority::Priority, }; use reth_network_peers::PeerId; -use reth_primitives::{alloy_primitives::Sealable, BlockBody, Header, SealedHeader}; +use reth_primitives::{BlockBody, Header, SealedHeader}; use thiserror::Error; use tokio::{fs::File, io::AsyncReadExt}; use tokio_stream::StreamExt; diff --git a/crates/net/downloaders/src/headers/reverse_headers.rs b/crates/net/downloaders/src/headers/reverse_headers.rs index f0bbe82952ab..3cca3dcd1b21 100644 --- a/crates/net/downloaders/src/headers/reverse_headers.rs +++ b/crates/net/downloaders/src/headers/reverse_headers.rs @@ -3,7 +3,7 @@ use super::task::TaskDownloader; use crate::metrics::HeaderDownloaderMetrics; use alloy_eips::BlockHashOrNumber; -use alloy_primitives::{BlockNumber, B256}; +use alloy_primitives::{BlockNumber, Sealable, B256}; use futures::{stream::Stream, FutureExt}; use futures_util::{stream::FuturesUnordered, StreamExt}; use rayon::prelude::*; @@ -19,7 +19,7 @@ use reth_network_p2p::{ priority::Priority, }; use reth_network_peers::PeerId; -use reth_primitives::{alloy_primitives::Sealable, GotExpected, Header, SealedHeader}; +use reth_primitives::{GotExpected, Header, SealedHeader}; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use std::{ cmp::{Ordering, Reverse}, diff --git a/crates/net/downloaders/src/headers/test_utils.rs b/crates/net/downloaders/src/headers/test_utils.rs index 321b0a335e57..923ad9969373 100644 --- a/crates/net/downloaders/src/headers/test_utils.rs +++ b/crates/net/downloaders/src/headers/test_utils.rs @@ -2,7 +2,8 @@ #![allow(dead_code)] -use reth_primitives::{alloy_primitives::Sealable, SealedHeader}; +use alloy_primitives::Sealable; +use reth_primitives::SealedHeader; /// Returns a new [`SealedHeader`] that's the child header of the given `parent`. pub(crate) fn child_header(parent: &SealedHeader) -> SealedHeader { diff --git a/crates/net/downloaders/src/receipt_file_client.rs b/crates/net/downloaders/src/receipt_file_client.rs index 980a72025407..41d46be94104 100644 --- a/crates/net/downloaders/src/receipt_file_client.rs +++ b/crates/net/downloaders/src/receipt_file_client.rs @@ -213,9 +213,12 @@ pub struct ReceiptWithBlockNumber { #[cfg(test)] mod test { - use alloy_primitives::{bytes::BytesMut, hex, Address, Bytes, Log, LogData, B256}; + use alloy_primitives::{ + bytes::{Buf, BytesMut}, + hex, Address, Bytes, Log, LogData, B256, + }; use alloy_rlp::{Decodable, RlpDecodable}; - use reth_primitives::{Buf, Receipt, TxType}; + use reth_primitives::{Receipt, TxType}; use reth_tracing::init_test_tracing; use tokio_util::codec::Decoder; diff --git a/crates/net/eth-wire-types/src/blocks.rs b/crates/net/eth-wire-types/src/blocks.rs index 7cea39a276d2..bccb3a96733e 100644 --- a/crates/net/eth-wire-types/src/blocks.rs +++ b/crates/net/eth-wire-types/src/blocks.rs @@ -113,12 +113,9 @@ mod tests { HeadersDirection, }; use alloy_consensus::TxLegacy; - use alloy_primitives::{hex, TxKind, U256}; + use alloy_primitives::{hex, Parity, TxKind, U256}; use alloy_rlp::{Decodable, Encodable}; - use reth_primitives::{ - alloy_primitives::Parity, BlockHashOrNumber, Header, Signature, Transaction, - TransactionSigned, - }; + use reth_primitives::{BlockHashOrNumber, Header, Signature, Transaction, TransactionSigned}; use std::str::FromStr; use super::BlockBody; diff --git a/crates/net/eth-wire-types/src/transactions.rs b/crates/net/eth-wire-types/src/transactions.rs index ae3975d1b799..77072a31869e 100644 --- a/crates/net/eth-wire-types/src/transactions.rs +++ b/crates/net/eth-wire-types/src/transactions.rs @@ -78,13 +78,10 @@ impl FromIterator for PooledTransactions { mod tests { use crate::{message::RequestPair, GetPooledTransactions, PooledTransactions}; use alloy_consensus::{TxEip1559, TxLegacy}; - use alloy_primitives::{hex, TxKind, U256}; + use alloy_primitives::{hex, Parity, TxKind, U256}; use alloy_rlp::{Decodable, Encodable}; use reth_chainspec::MIN_TRANSACTION_GAS; - use reth_primitives::{ - alloy_primitives::Parity, PooledTransactionsElement, Signature, Transaction, - TransactionSigned, - }; + use reth_primitives::{PooledTransactionsElement, Signature, Transaction, TransactionSigned}; use std::str::FromStr; #[test] diff --git a/crates/net/network/tests/it/multiplex.rs b/crates/net/network/tests/it/multiplex.rs index 3eaf0a5eb422..ca35f24fa6f2 100644 --- a/crates/net/network/tests/it/multiplex.rs +++ b/crates/net/network/tests/it/multiplex.rs @@ -26,9 +26,8 @@ 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 alloy_primitives::bytes::{Buf, BufMut}; use reth_eth_wire::Capability; - use reth_primitives::Buf; #[repr(u8)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] diff --git a/crates/net/network/tests/it/requests.rs b/crates/net/network/tests/it/requests.rs index 42802046daa4..61241f02d2de 100644 --- a/crates/net/network/tests/it/requests.rs +++ b/crates/net/network/tests/it/requests.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use alloy_consensus::TxEip2930; -use alloy_primitives::{Bytes, TxKind, U256}; +use alloy_primitives::{Bytes, Parity, TxKind, U256}; use rand::Rng; use reth_eth_wire::HeadersDirection; use reth_network::{ @@ -16,9 +16,7 @@ use reth_network_p2p::{ bodies::client::BodiesClient, headers::client::{HeadersClient, HeadersRequest}, }; -use reth_primitives::{ - alloy_primitives::Parity, Block, Header, Signature, Transaction, TransactionSigned, -}; +use reth_primitives::{Block, Header, Signature, Transaction, TransactionSigned}; use reth_provider::test_utils::MockEthProvider; /// Returns a new [`TransactionSigned`] with some random parameters diff --git a/crates/net/p2p/src/full_block.rs b/crates/net/p2p/src/full_block.rs index ce6f58fcd98b..91b786e410ca 100644 --- a/crates/net/p2p/src/full_block.rs +++ b/crates/net/p2p/src/full_block.rs @@ -5,13 +5,11 @@ use crate::{ headers::client::{HeadersClient, SingleHeaderRequest}, BlockClient, }; -use alloy_primitives::B256; +use alloy_primitives::{Sealable, B256}; use reth_consensus::{Consensus, ConsensusError}; use reth_eth_wire_types::HeadersDirection; use reth_network_peers::WithPeerId; -use reth_primitives::{ - alloy_primitives::Sealable, BlockBody, GotExpected, Header, SealedBlock, SealedHeader, -}; +use reth_primitives::{BlockBody, GotExpected, Header, SealedBlock, SealedHeader}; use std::{ cmp::Reverse, collections::{HashMap, VecDeque}, diff --git a/crates/net/p2p/src/test_utils/headers.rs b/crates/net/p2p/src/test_utils/headers.rs index 14a2e3fca554..e61183d22e4b 100644 --- a/crates/net/p2p/src/test_utils/headers.rs +++ b/crates/net/p2p/src/test_utils/headers.rs @@ -10,11 +10,12 @@ use crate::{ }, priority::Priority, }; +use alloy_primitives::Sealable; use futures::{Future, FutureExt, Stream, StreamExt}; use reth_consensus::{test_utils::TestConsensus, Consensus}; use reth_eth_wire_types::HeadersDirection; use reth_network_peers::{PeerId, WithPeerId}; -use reth_primitives::{alloy_primitives::Sealable, Header, SealedHeader}; +use reth_primitives::{Header, SealedHeader}; use std::{ fmt, pin::Pin, diff --git a/crates/optimism/cli/src/receipt_file_codec.rs b/crates/optimism/cli/src/receipt_file_codec.rs index c0416fa5f072..05760a49aa0b 100644 --- a/crates/optimism/cli/src/receipt_file_codec.rs +++ b/crates/optimism/cli/src/receipt_file_codec.rs @@ -1,11 +1,11 @@ //! Codec for reading raw receipts from a file. -use alloy_primitives::{Address, Bloom, B256}; -use alloy_rlp::{Decodable, RlpDecodable}; -use reth_primitives::{ +use alloy_primitives::{ bytes::{Buf, BytesMut}, - Bytes, Log, Receipt, TxType, + Address, Bloom, Bytes, B256, }; +use alloy_rlp::{Decodable, RlpDecodable}; +use reth_primitives::{Log, Receipt, TxType}; use tokio_util::codec::Decoder; use reth_downloaders::{file_client::FileClientError, receipt_file_client::ReceiptWithBlockNumber}; @@ -95,8 +95,7 @@ impl TryFrom for ReceiptWithBlockNumber { #[cfg(test)] pub(crate) mod test { - use alloy_primitives::hex; - use reth_primitives::alloy_primitives::LogData; + use alloy_primitives::{hex, LogData}; use super::*; diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index 8c923dab7dd9..fdec44030234 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -1,12 +1,11 @@ use crate::{ - Bytes, GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, - Withdrawals, + GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, Withdrawals, }; use alloc::vec::Vec; pub use alloy_eips::eip1898::{ BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash, }; -use alloy_primitives::{Address, Sealable, B256}; +use alloy_primitives::{Address, Bytes, 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 390777422b01..bf45ce3ba088 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -69,7 +69,6 @@ pub use transaction::{ }; // Re-exports -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/receipt.rs b/crates/primitives/src/receipt.rs index 59c819da9116..60ea42e94a43 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, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, + logs_bloom, 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, B256}; +use alloy_primitives::{Bloom, Bytes, 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/mod.rs b/crates/primitives/src/transaction/mod.rs index 425926254405..7889ff641edf 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -1,12 +1,12 @@ //! Transaction types. -use crate::{BlockHashOrNumber, Bytes, TxHash}; +use crate::BlockHashOrNumber; use alloy_eips::eip7702::SignedAuthorization; use alloy_primitives::{keccak256, Address, TxKind, B256, U256}; use alloy_consensus::{SignableTransaction, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy}; use alloy_eips::eip2930::AccessList; -use alloy_primitives::Parity; +use alloy_primitives::{Bytes, Parity, TxHash}; use alloy_rlp::{ Decodable, Encodable, Error as RlpError, Header, EMPTY_LIST_CODE, EMPTY_STRING_CODE, }; @@ -1705,12 +1705,10 @@ impl WithEncoded> { #[cfg(test)] mod tests { use crate::{ - hex, transaction::{signature::Signature, TxEip1559, TxKind, TxLegacy}, - Bytes, Transaction, TransactionSigned, TransactionSignedEcRecovered, - TransactionSignedNoHash, + Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, }; - use alloy_primitives::{address, b256, bytes, Address, Parity, B256, U256}; + use alloy_primitives::{address, b256, bytes, hex, Address, Bytes, 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 69ca8f88188d..04026839538d 100644 --- a/crates/primitives/src/transaction/pooled.rs +++ b/crates/primitives/src/transaction/pooled.rs @@ -7,15 +7,15 @@ use super::{ TxEip7702, }; use crate::{ - BlobTransaction, BlobTransactionSidecar, Bytes, Signature, Transaction, TransactionSigned, - TransactionSignedEcRecovered, TxHash, EIP4844_TX_TYPE_ID, + BlobTransaction, BlobTransactionSidecar, Signature, Transaction, TransactionSigned, + TransactionSignedEcRecovered, EIP4844_TX_TYPE_ID, }; use alloc::vec::Vec; use alloy_consensus::{ transaction::{TxEip1559, TxEip2930, TxEip4844, TxLegacy}, SignableTransaction, TxEip4844WithSidecar, }; -use alloy_primitives::{Address, B256}; +use alloy_primitives::{Address, Bytes, TxHash, 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/sidecar.rs b/crates/primitives/src/transaction/sidecar.rs index 94dfbe6da4b6..52c3c68ef9db 100644 --- a/crates/primitives/src/transaction/sidecar.rs +++ b/crates/primitives/src/transaction/sidecar.rs @@ -1,8 +1,8 @@ #![cfg_attr(docsrs, doc(cfg(feature = "c-kzg")))] -use crate::{Signature, Transaction, TransactionSigned, TxHash, EIP4844_TX_TYPE_ID}; +use crate::{Signature, Transaction, TransactionSigned, EIP4844_TX_TYPE_ID}; use alloy_consensus::{transaction::TxEip4844, TxEip4844WithSidecar}; -use alloy_primitives::keccak256; +use alloy_primitives::{keccak256, TxHash}; use alloy_rlp::{Decodable, Error as RlpError, Header}; use serde::{Deserialize, Serialize}; @@ -282,8 +282,9 @@ pub fn generate_blob_sidecar(blobs: Vec) -> BlobTransactionSidecar #[cfg(all(test, feature = "c-kzg"))] mod tests { use super::*; - use crate::{hex, kzg::Blob, PooledTransactionsElement}; + use crate::{kzg::Blob, PooledTransactionsElement}; use alloy_eips::eip4844::Bytes48; + use alloy_primitives::hex; use alloy_rlp::Encodable; use std::{fs, path::PathBuf, str::FromStr}; diff --git a/crates/primitives/src/transaction/signature.rs b/crates/primitives/src/transaction/signature.rs index 829ce2409377..e99fc92324ff 100644 --- a/crates/primitives/src/transaction/signature.rs +++ b/crates/primitives/src/transaction/signature.rs @@ -115,13 +115,12 @@ pub const fn extract_chain_id(v: u64) -> alloy_rlp::Result<(bool, Option)> #[cfg(test)] mod tests { use crate::{ - hex, transaction::signature::{ legacy_parity, recover_signer, recover_signer_unchecked, SECP256K1N_HALF, }, Signature, }; - use alloy_primitives::{Address, Parity, B256, U256}; + use alloy_primitives::{hex, Address, Parity, B256, U256}; use std::str::FromStr; #[test] diff --git a/crates/primitives/src/transaction/tx_type.rs b/crates/primitives/src/transaction/tx_type.rs index 14ac420e0a90..c55e0d3c6193 100644 --- a/crates/primitives/src/transaction/tx_type.rs +++ b/crates/primitives/src/transaction/tx_type.rs @@ -246,7 +246,7 @@ impl From for TxType { #[cfg(test)] mod tests { - use crate::hex; + use alloy_primitives::hex; use rand::Rng; use reth_codecs::Compact; diff --git a/crates/revm/src/test_utils.rs b/crates/revm/src/test_utils.rs index f1d1ce600e3b..d42ec4959907 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, B256, U256, + Address, BlockNumber, Bytes, StorageKey, B256, U256, }; -use reth_primitives::{Account, Bytecode, Bytes}; +use reth_primitives::{Account, Bytecode}; use reth_storage_api::{ AccountReader, BlockHashReader, StateProofProvider, StateProvider, StateRootProvider, StorageRootProvider, diff --git a/crates/rpc/rpc-engine-api/tests/it/payload.rs b/crates/rpc/rpc-engine-api/tests/it/payload.rs index e98f585c002d..c08c30c1de09 100644 --- a/crates/rpc/rpc-engine-api/tests/it/payload.rs +++ b/crates/rpc/rpc-engine-api/tests/it/payload.rs @@ -1,15 +1,12 @@ //! Some payload tests -use alloy_primitives::{Bytes, U256}; +use alloy_primitives::{Bytes, Sealable, U256}; use alloy_rlp::{Decodable, Error as RlpError}; use alloy_rpc_types_engine::{ ExecutionPayload, ExecutionPayloadBodyV1, ExecutionPayloadV1, PayloadError, }; use assert_matches::assert_matches; -use reth_primitives::{ - alloy_primitives::Sealable, proofs, Block, SealedBlock, SealedHeader, TransactionSigned, - Withdrawals, -}; +use reth_primitives::{proofs, Block, SealedBlock, SealedHeader, TransactionSigned, Withdrawals}; use reth_rpc_types_compat::engine::payload::{ block_to_payload, block_to_payload_v1, convert_to_payload_body_v1, try_into_sealed_block, try_payload_v1_to_block, diff --git a/crates/stages/stages/benches/setup/mod.rs b/crates/stages/stages/benches/setup/mod.rs index 84d96aac848f..4812fb13c39a 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, B256, U256}; +use alloy_primitives::{Address, Sealable, 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}; +use reth_primitives::{Account, SealedBlock, SealedHeader}; use reth_provider::{DatabaseProvider, DatabaseProviderFactory, TrieWriter}; use reth_stages::{ stages::{AccountHashingStage, StorageHashingStage}, diff --git a/crates/stages/stages/src/stages/execution.rs b/crates/stages/stages/src/stages/execution.rs index 24dff3422857..ea2849fb230f 100644 --- a/crates/stages/stages/src/stages/execution.rs +++ b/crates/stages/stages/src/stages/execution.rs @@ -1,5 +1,5 @@ use crate::stages::MERKLE_STAGE_DEFAULT_CLEAN_THRESHOLD; -use alloy_primitives::BlockNumber; +use alloy_primitives::{BlockNumber, Sealable}; use num_traits::Zero; use reth_config::config::ExecutionConfig; use reth_db::{static_file::HeaderMask, tables}; @@ -10,7 +10,7 @@ use reth_evm::{ }; use reth_execution_types::{Chain, ExecutionOutcome}; use reth_exex::{ExExManagerHandle, ExExNotification}; -use reth_primitives::{alloy_primitives::Sealable, Header, SealedHeader, StaticFileSegment}; +use reth_primitives::{Header, SealedHeader, StaticFileSegment}; use reth_primitives_traits::format_gas_throughput; use reth_provider::{ providers::{StaticFileProvider, StaticFileProviderRWRefMut, StaticFileWriter}, diff --git a/crates/stages/stages/src/stages/headers.rs b/crates/stages/stages/src/stages/headers.rs index 02a360b65eee..83771c4969d9 100644 --- a/crates/stages/stages/src/stages/headers.rs +++ b/crates/stages/stages/src/stages/headers.rs @@ -378,12 +378,10 @@ mod tests { use crate::test_utils::{ stage_test_suite, ExecuteStageTestRunner, StageTestRunner, UnwindStageTestRunner, }; - use alloy_primitives::B256; + use alloy_primitives::{Sealable, B256}; use assert_matches::assert_matches; use reth_execution_types::ExecutionOutcome; - use reth_primitives::{ - alloy_primitives::Sealable, BlockBody, SealedBlock, SealedBlockWithSenders, - }; + use reth_primitives::{BlockBody, SealedBlock, SealedBlockWithSenders}; use reth_provider::{BlockWriter, ProviderFactory, StaticFileProviderFactory}; use reth_stages_api::StageUnitCheckpoint; use reth_testing_utils::generators::{self, random_header, random_header_range}; diff --git a/crates/stages/stages/src/stages/merkle.rs b/crates/stages/stages/src/stages/merkle.rs index 15f6e9702be3..d1d3496d917a 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, B256}; +use alloy_primitives::{BlockNumber, Sealable, 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}; +use reth_primitives::{GotExpected, SealedHeader}; use reth_provider::{ DBProvider, HeaderProvider, ProviderError, StageCheckpointReader, StageCheckpointWriter, StatsReader, TrieWriter, diff --git a/crates/stages/stages/src/test_utils/test_db.rs b/crates/stages/stages/src/test_utils/test_db.rs index f062f15914fb..4c43d4cdcd1d 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, B256, U256}; +use alloy_primitives::{keccak256, Address, BlockNumber, TxHash, TxNumber, B256, U256}; use reth_chainspec::MAINNET; use reth_db::{ tables, @@ -15,7 +15,7 @@ use reth_db_api::{ DatabaseError as DbError, }; use reth_primitives::{ - Account, Receipt, SealedBlock, SealedHeader, StaticFileSegment, StorageEntry, TxHash, + Account, Receipt, SealedBlock, SealedHeader, StaticFileSegment, StorageEntry, }; use reth_provider::{ providers::{StaticFileProvider, StaticFileProviderRWRefMut, StaticFileWriter}, diff --git a/crates/storage/db-models/src/accounts.rs b/crates/storage/db-models/src/accounts.rs index 74736247a6fb..e1f4773960fa 100644 --- a/crates/storage/db-models/src/accounts.rs +++ b/crates/storage/db-models/src/accounts.rs @@ -1,8 +1,8 @@ use reth_codecs::{add_arbitrary_tests, Compact}; use serde::Serialize; -use alloy_primitives::Address; -use reth_primitives::{Account, Buf}; +use alloy_primitives::{bytes::Buf, Address}; +use reth_primitives::Account; /// Account as it is saved in the database. /// diff --git a/crates/storage/provider/src/providers/blockchain_provider.rs b/crates/storage/provider/src/providers/blockchain_provider.rs index cb90cc08a61c..32829748361f 100644 --- a/crates/storage/provider/src/providers/blockchain_provider.rs +++ b/crates/storage/provider/src/providers/blockchain_provider.rs @@ -8,7 +8,7 @@ use crate::{ StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider, }; use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag}; -use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256}; +use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256}; use alloy_rpc_types_engine::ForkchoiceState; use reth_chain_state::{ BlockState, CanonicalInMemoryState, ForkChoiceNotifications, ForkChoiceSubscriptions, @@ -20,8 +20,8 @@ use reth_evm::ConfigureEvmEnv; use reth_execution_types::ExecutionOutcome; use reth_node_types::NodeTypesWithDB; use reth_primitives::{ - alloy_primitives::Sealable, Account, Block, BlockWithSenders, EthereumHardforks, Header, - Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, + Account, Block, BlockWithSenders, EthereumHardforks, Header, Receipt, SealedBlock, + SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; diff --git a/crates/storage/provider/src/providers/mod.rs b/crates/storage/provider/src/providers/mod.rs index 1a43b611bc31..50b914778db3 100644 --- a/crates/storage/provider/src/providers/mod.rs +++ b/crates/storage/provider/src/providers/mod.rs @@ -8,7 +8,7 @@ use crate::{ TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider, }; use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag}; -use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256}; +use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable, TxHash, TxNumber, B256, U256}; use reth_blockchain_tree_api::{ error::{CanonicalError, InsertBlockError}, BlockValidationKind, BlockchainTreeEngine, BlockchainTreeViewer, CanonicalOutcome, @@ -20,9 +20,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices}; use reth_evm::ConfigureEvmEnv; use reth_node_types::NodeTypesWithDB; use reth_primitives::{ - alloy_primitives::Sealable, Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, - SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, - TransactionSignedNoHash, Withdrawal, Withdrawals, + Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, + SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, + Withdrawals, }; use reth_prune_types::{PruneCheckpoint, PruneSegment}; use reth_stages_types::{StageCheckpoint, StageId}; diff --git a/crates/storage/provider/src/test_utils/blocks.rs b/crates/storage/provider/src/test_utils/blocks.rs index 0ad933fc7aee..daed906646d3 100644 --- a/crates/storage/provider/src/test_utils/blocks.rs +++ b/crates/storage/provider/src/test_utils/blocks.rs @@ -2,16 +2,15 @@ use crate::{DatabaseProviderRW, ExecutionOutcome}; use alloy_consensus::TxLegacy; use alloy_primitives::{ - b256, hex_literal::hex, map::HashMap, Address, BlockNumber, Log, Parity, Sealable, TxKind, - B256, U256, + b256, hex_literal::hex, map::HashMap, Address, BlockNumber, Bytes, 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, Account, BlockBody, Bytes, Header, Receipt, SealedBlock, - SealedBlockWithSenders, SealedHeader, Signature, Transaction, TransactionSigned, TxType, - Withdrawal, Withdrawals, + Account, BlockBody, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, + Signature, Transaction, TransactionSigned, TxType, Withdrawal, Withdrawals, }; use reth_trie::root::{state_root_unhashed, storage_root_unhashed}; use revm::{db::BundleState, primitives::AccountInfo}; diff --git a/crates/storage/provider/src/test_utils/mock.rs b/crates/storage/provider/src/test_utils/mock.rs index b06ae6ec1ad2..0be8f7708d3c 100644 --- a/crates/storage/provider/src/test_utils/mock.rs +++ b/crates/storage/provider/src/test_utils/mock.rs @@ -10,7 +10,8 @@ use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag}; use alloy_primitives::{ keccak256, map::{HashMap, HashSet}, - Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, TxNumber, B256, U256, + Address, BlockHash, BlockNumber, Bytes, Sealable, StorageKey, StorageValue, TxHash, TxNumber, + B256, U256, }; use parking_lot::Mutex; use reth_chainspec::{ChainInfo, ChainSpec}; @@ -19,8 +20,8 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices}; use reth_evm::ConfigureEvmEnv; use reth_execution_types::{Chain, ExecutionOutcome}; use reth_primitives::{ - alloy_primitives::Sealable, Account, Block, BlockWithSenders, Bytecode, GotExpected, Header, - Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, + Account, Block, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, SealedBlock, + SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals, }; use reth_stages_types::{StageCheckpoint, StageId}; diff --git a/crates/storage/storage-api/src/block.rs b/crates/storage/storage-api/src/block.rs index 6590b47b4524..a3b0cc7438f3 100644 --- a/crates/storage/storage-api/src/block.rs +++ b/crates/storage/storage-api/src/block.rs @@ -3,11 +3,10 @@ use crate::{ TransactionVariant, TransactionsProvider, WithdrawalsProvider, }; use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag}; -use alloy_primitives::{BlockNumber, B256}; +use alloy_primitives::{BlockNumber, Sealable, B256}; use reth_db_models::StoredBlockBodyIndices; use reth_primitives::{ - alloy_primitives::Sealable, Block, BlockWithSenders, Header, Receipt, SealedBlock, - SealedBlockWithSenders, SealedHeader, + Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, }; use reth_storage_errors::provider::ProviderResult; use std::ops::RangeInclusive; diff --git a/crates/transaction-pool/src/maintain.rs b/crates/transaction-pool/src/maintain.rs index ce37cb2e7a8d..8a6ce5d04a3a 100644 --- a/crates/transaction-pool/src/maintain.rs +++ b/crates/transaction-pool/src/maintain.rs @@ -7,7 +7,7 @@ use crate::{ traits::{CanonicalStateUpdate, TransactionPool, TransactionPoolExt}, BlockInfo, PoolTransaction, }; -use alloy_primitives::{Address, BlockHash, BlockNumber}; +use alloy_primitives::{Address, BlockHash, BlockNumber, Sealable}; use futures_util::{ future::{BoxFuture, Fuse, FusedFuture}, FutureExt, Stream, StreamExt, @@ -17,8 +17,7 @@ use reth_chainspec::{ChainSpecProvider, EthChainSpec}; use reth_execution_types::ChangedAccount; use reth_fs_util::FsPathError; use reth_primitives::{ - alloy_primitives::Sealable, BlockNumberOrTag, PooledTransactionsElementEcRecovered, - SealedHeader, TransactionSigned, + BlockNumberOrTag, PooledTransactionsElementEcRecovered, SealedHeader, TransactionSigned, }; use reth_storage_api::{errors::provider::ProviderError, BlockReaderIdExt, StateProviderFactory}; use reth_tasks::TaskSpawner; diff --git a/crates/transaction-pool/src/test_utils/gen.rs b/crates/transaction-pool/src/test_utils/gen.rs index e5fceb9150ed..6123260b1d9d 100644 --- a/crates/transaction-pool/src/test_utils/gen.rs +++ b/crates/transaction-pool/src/test_utils/gen.rs @@ -1,11 +1,11 @@ use crate::EthPooledTransaction; use alloy_consensus::{TxEip1559, TxEip4844, TxLegacy}; use alloy_eips::eip2930::AccessList; -use alloy_primitives::{Address, TxKind, B256, U256}; +use alloy_primitives::{Address, Bytes, TxKind, B256, U256}; use rand::Rng; use reth_chainspec::MAINNET; use reth_primitives::{ - constants::MIN_PROTOCOL_BASE_FEE, sign_message, Bytes, Transaction, TransactionSigned, + constants::MIN_PROTOCOL_BASE_FEE, sign_message, Transaction, TransactionSigned, }; /// A generator for transactions for testing purposes. diff --git a/crates/trie/db/src/state.rs b/crates/trie/db/src/state.rs index 35ed064e5231..5acb9e0d1b49 100644 --- a/crates/trie/db/src/state.rs +++ b/crates/trie/db/src/state.rs @@ -268,10 +268,10 @@ impl DatabaseHashedPostState for HashedPostState { #[cfg(test)] mod tests { use super::*; - use alloy_primitives::{map::HashMap, Address, U256}; + use alloy_primitives::{hex, 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}; + use reth_primitives::revm_primitives::AccountInfo; use revm::db::BundleState; #[test] diff --git a/crates/trie/trie/src/updates.rs b/crates/trie/trie/src/updates.rs index c499d7eefae5..f299a893d6c9 100644 --- a/crates/trie/trie/src/updates.rs +++ b/crates/trie/trie/src/updates.rs @@ -232,7 +232,7 @@ where S: Serializer, { let mut storage_nodes = - Vec::from_iter(map.iter().map(|elem| reth_primitives::hex::encode(elem.pack()))); + Vec::from_iter(map.iter().map(|elem| alloy_primitives::hex::encode(elem.pack()))); storage_nodes.sort_unstable(); storage_nodes.serialize(serializer) } @@ -252,7 +252,7 @@ where storage_nodes.sort_unstable_by(|a, b| a.0.cmp(b.0)); for (k, v) in storage_nodes { // pack, then hex encode the Nibbles - let packed = reth_primitives::hex::encode(k.pack()); + let packed = alloy_primitives::hex::encode(k.pack()); map_serializer.serialize_entry(&packed, &v)?; } map_serializer.end() diff --git a/examples/custom-evm/src/main.rs b/examples/custom-evm/src/main.rs index b3bf36ce6d5d..d931c3b275bf 100644 --- a/examples/custom-evm/src/main.rs +++ b/examples/custom-evm/src/main.rs @@ -3,17 +3,14 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] use alloy_genesis::Genesis; -use alloy_primitives::{address, Address, U256}; +use alloy_primitives::{address, Address, Bytes, U256}; use reth::{ builder::{ components::{ExecutorBuilder, PayloadServiceBuilder}, BuilderContext, NodeBuilder, }, payload::{EthBuiltPayload, EthPayloadBuilderAttributes}, - primitives::{ - revm_primitives::{Env, PrecompileResult}, - Bytes, - }, + primitives::revm_primitives::{Env, PrecompileResult}, revm::{ handler::register::EvmHandler, inspector_handle_register, diff --git a/examples/custom-payload-builder/Cargo.toml b/examples/custom-payload-builder/Cargo.toml index f10bd8058b64..1c160fe5ec87 100644 --- a/examples/custom-payload-builder/Cargo.toml +++ b/examples/custom-payload-builder/Cargo.toml @@ -15,6 +15,8 @@ reth-payload-builder.workspace = true reth-node-ethereum.workspace = true reth-ethereum-payload-builder.workspace = true +alloy-primitives.workspace = true + tracing.workspace = true futures-util.workspace = true eyre.workspace = true diff --git a/examples/custom-payload-builder/src/generator.rs b/examples/custom-payload-builder/src/generator.rs index 807cbf6a53bb..f5d64e41cd09 100644 --- a/examples/custom-payload-builder/src/generator.rs +++ b/examples/custom-payload-builder/src/generator.rs @@ -1,4 +1,5 @@ use crate::job::EmptyBlockPayloadJob; +use alloy_primitives::Bytes; use reth::{ providers::{BlockReaderIdExt, BlockSource, StateProviderFactory}, tasks::TaskSpawner, @@ -7,7 +8,7 @@ use reth::{ use reth_basic_payload_builder::{BasicPayloadJobGeneratorConfig, PayloadBuilder, PayloadConfig}; use reth_node_api::PayloadBuilderAttributes; use reth_payload_builder::{PayloadBuilderError, PayloadJobGenerator}; -use reth_primitives::{BlockNumberOrTag, Bytes}; +use reth_primitives::BlockNumberOrTag; use std::sync::Arc; /// The generator type that creates new jobs that builds empty blocks. diff --git a/examples/db-access/src/main.rs b/examples/db-access/src/main.rs index 7878ba3c8a89..ab018a0b07a6 100644 --- a/examples/db-access/src/main.rs +++ b/examples/db-access/src/main.rs @@ -1,9 +1,9 @@ -use alloy_primitives::{Address, B256}; +use alloy_primitives::{Address, Sealable, 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}; +use reth_primitives::SealedHeader; use reth_provider::{ providers::StaticFileProvider, AccountReader, BlockReader, BlockSource, HeaderProvider, ProviderFactory, ReceiptProvider, StateProvider, TransactionsProvider, diff --git a/examples/stateful-precompile/src/main.rs b/examples/stateful-precompile/src/main.rs index f58c7a557b8a..05a6fd86c935 100644 --- a/examples/stateful-precompile/src/main.rs +++ b/examples/stateful-precompile/src/main.rs @@ -3,15 +3,12 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] use alloy_genesis::Genesis; -use alloy_primitives::{Address, U256}; +use alloy_primitives::{Address, Bytes, U256}; use parking_lot::RwLock; use reth::{ api::NextBlockEnvAttributes, builder::{components::ExecutorBuilder, BuilderContext, NodeBuilder}, - primitives::{ - revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, Env, PrecompileResult, TxEnv}, - Bytes, - }, + primitives::revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, Env, PrecompileResult, TxEnv}, revm::{ handler::register::EvmHandler, inspector_handle_register, diff --git a/testing/testing-utils/src/generators.rs b/testing/testing-utils/src/generators.rs index c1c23c998670..85506f9d3a63 100644 --- a/testing/testing-utils/src/generators.rs +++ b/testing/testing-utils/src/generators.rs @@ -500,8 +500,8 @@ mod tests { use super::*; use alloy_consensus::TxEip1559; use alloy_eips::eip2930::AccessList; - use alloy_primitives::Parity; - use reth_primitives::{hex, public_key_to_address, Signature}; + use alloy_primitives::{hex, Parity}; + use reth_primitives::{public_key_to_address, Signature}; use std::str::FromStr; #[test] From 68f89b7df164df1b41f1d0e1a85734adfba47ffd Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Sun, 29 Sep 2024 23:34:14 +0200 Subject: [PATCH 2/2] fix doc --- testing/testing-utils/src/genesis_allocator.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testing/testing-utils/src/genesis_allocator.rs b/testing/testing-utils/src/genesis_allocator.rs index ebdef9eb1932..acf5e091cba3 100644 --- a/testing/testing-utils/src/genesis_allocator.rs +++ b/testing/testing-utils/src/genesis_allocator.rs @@ -18,8 +18,7 @@ use std::{ /// /// # Example /// ``` -/// # use alloy_primitives::{Address, U256}; -/// # use reth_primitives::{hex, Bytes}; +/// # use alloy_primitives::{Address, U256, hex, Bytes}; /// # use reth_testing_utils::GenesisAllocator; /// # use std::str::FromStr; /// let mut allocator = GenesisAllocator::default();