Skip to content

Commit

Permalink
primitives: rm more alloy_primitives reexports
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Sep 29, 2024
1 parent ea1d04a commit 99fd621
Show file tree
Hide file tree
Showing 52 changed files with 113 additions and 134 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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::{
Expand Down
3 changes: 1 addition & 2 deletions crates/chain-state/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/engine/tree/src/backfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,12 @@ impl<N: ProviderNodeTypes> PipelineState<N> {
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;
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/tree/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions crates/engine/tree/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 1 addition & 2 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/consensus/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/system_calls/eip7002.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/system_calls/eip7251.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/net/downloaders/src/file_client.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions crates/net/downloaders/src/headers/reverse_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand All @@ -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},
Expand Down
3 changes: 2 additions & 1 deletion crates/net/downloaders/src/headers/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions crates/net/downloaders/src/receipt_file_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 2 additions & 5 deletions crates/net/eth-wire-types/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 2 additions & 5 deletions crates/net/eth-wire-types/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,10 @@ impl FromIterator<PooledTransactionsElement> 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]
Expand Down
3 changes: 1 addition & 2 deletions crates/net/network/tests/it/multiplex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 2 additions & 4 deletions crates/net/network/tests/it/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions crates/net/p2p/src/full_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
3 changes: 2 additions & 1 deletion crates/net/p2p/src/test_utils/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 5 additions & 6 deletions crates/optimism/cli/src/receipt_file_codec.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -95,8 +95,7 @@ impl TryFrom<HackReceipt> 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::*;

Expand Down
5 changes: 2 additions & 3 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
@@ -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"))]
Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/receipt.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
10 changes: 4 additions & 6 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down Expand Up @@ -1705,12 +1705,10 @@ impl<T> WithEncoded<Option<T>> {
#[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;
Expand Down
6 changes: 3 additions & 3 deletions crates/primitives/src/transaction/pooled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
Loading

0 comments on commit 99fd621

Please sign in to comment.