Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

primitives: rm more alloy_primitives reexports #11255

Merged
merged 8 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions bin/reth-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ alloy-pubsub.workspace = true
alloy-json-rpc.workspace = true
alloy-rpc-client.workspace = true
alloy-eips.workspace = true
alloy-primitives.workspace = true

# reqwest
reqwest = { workspace = true, default-features = false, features = [
Expand Down
3 changes: 2 additions & 1 deletion bin/reth-bench/src/bench/new_payload_fcu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ use crate::{
},
valid_payload::{call_forkchoice_updated, call_new_payload},
};
use alloy_primitives::B256;
use alloy_provider::Provider;
use alloy_rpc_types_engine::ForkchoiceState;
use clap::Parser;
use csv::Writer;
use reth_cli_runner::CliContext;
use reth_node_core::args::BenchmarkArgs;
use reth_primitives::{Block, B256};
use reth_primitives::Block;
use reth_rpc_types_compat::engine::payload::block_to_payload;
use std::time::Instant;
use tracing::{debug, info};
Expand Down
3 changes: 2 additions & 1 deletion bin/reth-bench/src/bench/new_payload_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ use crate::{
},
valid_payload::call_new_payload,
};
use alloy_primitives::B256;
use alloy_provider::Provider;
use clap::Parser;
use csv::Writer;
use reth_cli_runner::CliContext;
use reth_node_core::args::BenchmarkArgs;
use reth_primitives::{Block, B256};
use reth_primitives::Block;
use reth_rpc_types_compat::engine::payload::block_to_payload;
use std::time::Instant;
use tracing::{debug, info};
Expand Down
2 changes: 1 addition & 1 deletion bin/reth-bench/src/valid_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
//! response. This is useful for benchmarking, as it allows us to wait for a payload to be valid
//! before sending additional calls.

use alloy_primitives::B256;
use alloy_provider::{ext::EngineApi, Network};
use alloy_rpc_types_engine::{
ExecutionPayload, ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3,
ForkchoiceState, ForkchoiceUpdated, PayloadAttributes, PayloadStatus,
};
use alloy_transport::{Transport, TransportResult};
use reth_node_api::EngineApiMessageVersion;
use reth_primitives::B256;
use tracing::error;

/// An extension trait for providers that implement the engine API, to wait for a VALID response.
Expand Down
3 changes: 1 addition & 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;
use alloy_primitives::{Address, B256, U256};
use alloy_rlp::Decodable;
use alloy_rpc_types::engine::{BlobsBundleV1, PayloadAttributes};
use clap::Parser;
Expand All @@ -27,7 +27,6 @@ use reth_payload_builder::database::CachedReads;
use reth_primitives::{
revm_primitives::KzgSettings, BlobTransaction, BlobTransactionSidecar, Bytes,
PooledTransactionsElement, SealedBlock, SealedBlockWithSenders, Transaction, TransactionSigned,
B256, U256,
};
use reth_provider::{
providers::BlockchainProvider, BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider,
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/debug_cmd/execution.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Command for debugging execution.

use crate::{args::NetworkArgs, utils::get_single_header};
use alloy_primitives::BlockNumber;
use alloy_primitives::{BlockNumber, B256};
use clap::Parser;
use futures::{stream::select as stream_select, StreamExt};
use reth_beacon_consensus::EthBeaconConsensus;
Expand All @@ -23,7 +23,7 @@ use reth_network_api::NetworkInfo;
use reth_network_p2p::{headers::client::HeadersClient, BlockClient};
use reth_node_api::{NodeTypesWithDB, NodeTypesWithDBAdapter, NodeTypesWithEngine};
use reth_node_ethereum::EthExecutorProvider;
use reth_primitives::{BlockHashOrNumber, B256};
use reth_primitives::BlockHashOrNumber;
use reth_provider::{
BlockExecutionWriter, ChainSpecProvider, ProviderFactory, StageCheckpointReader,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/debug-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ workspace = true
[dependencies]
# reth
reth-node-api.workspace = true
reth-node-core.workspace = true
reth-rpc-api.workspace = true
reth-rpc-builder.workspace = true
reth-tracing.workspace = true
Expand All @@ -24,6 +23,7 @@ alloy-eips.workspace = true
alloy-provider = { workspace = true, features = ["ws"] }
alloy-rpc-types.workspace = true
alloy-rpc-types-engine.workspace = true
alloy-primitives.workspace = true

auto_impl.workspace = true
futures.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/debug-client/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use alloy_consensus::TxEnvelope;
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::B256;
use alloy_rpc_types::{Block, BlockTransactions};
use alloy_rpc_types_engine::{ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3};
use reth_node_api::EngineTypes;
use reth_node_core::primitives::B256;
use reth_rpc_builder::auth::AuthServerHandle;
use reth_tracing::tracing::warn;
use ringbuffer::{AllocRingBuffer, RingBuffer};
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/tree/src/tree/persistence_state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_eips::BlockNumHash;
use reth_primitives::B256;
use alloy_primitives::B256;
use std::{collections::VecDeque, time::Instant};
use tokio::sync::oneshot;
use tracing::{debug, trace};
Expand Down
2 changes: 1 addition & 1 deletion crates/exex/exex/src/wal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub use storage::Storage;
use std::{path::Path, sync::Arc};

use alloy_eips::BlockNumHash;
use alloy_primitives::B256;
use reth_exex_types::ExExNotification;
use reth_primitives::B256;
use reth_tracing::tracing::{debug, instrument};

/// WAL is a write-ahead log (WAL) that stores the notifications sent to ExExes.
Expand Down
4 changes: 2 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,9 @@ pub struct ReceiptWithBlockNumber {

#[cfg(test)]
mod test {
use alloy_primitives::{hex, Address, Bytes, Log, LogData, B256};
use alloy_primitives::{bytes::BytesMut, hex, Address, Bytes, Log, LogData, B256};
use alloy_rlp::{Decodable, RlpDecodable};
use reth_primitives::{Buf, BytesMut, Receipt, TxType};
use reth_primitives::{Buf, Receipt, TxType};
use reth_tracing::init_test_tracing;
use tokio_util::codec::Decoder;

Expand Down
2 changes: 1 addition & 1 deletion crates/net/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use std::{
pin::Pin,
};

use alloy_primitives::bytes::BytesMut;
use futures::Stream;
use reth_eth_wire::{
capability::SharedCapabilities, multiplex::ProtocolConnection, protocol::Protocol,
};
use reth_network_api::{Direction, PeerId};
use reth_primitives::BytesMut;

/// A trait that allows to offer additional RLPx-based application-level protocols when establishing
/// a peer-to-peer connection.
Expand Down
5 changes: 3 additions & 2 deletions crates/net/network/tests/it/multiplex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::{
task::{ready, Context, Poll},
};

use alloy_primitives::bytes::BytesMut;
use futures::{Stream, StreamExt};
use reth_eth_wire::{
capability::SharedCapabilities, multiplex::ProtocolConnection, protocol::Protocol,
Expand All @@ -16,7 +17,6 @@ use reth_network::{
test_utils::Testnet,
};
use reth_network_api::{Direction, PeerId};
use reth_primitives::BytesMut;
use reth_provider::test_utils::MockEthProvider;
use tokio::sync::{mpsc, oneshot};
use tokio_stream::wrappers::UnboundedReceiverStream;
Expand All @@ -26,8 +26,9 @@ use crate::multiplex::proto::{PingPongProtoMessage, PingPongProtoMessageKind};
/// A simple Rlpx subprotocol that sends pings and pongs
mod proto {
use super::*;
use alloy_primitives::bytes::BufMut;
use reth_eth_wire::Capability;
use reth_primitives::{Buf, BufMut};
use reth_primitives::Buf;

#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
Expand Down
3 changes: 1 addition & 2 deletions crates/node/builder/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::sync::Arc;

use alloy_primitives::BlockNumber;
use alloy_primitives::{BlockNumber, B256};
use reth_config::{config::StageConfig, PruneConfig};
use reth_consensus::Consensus;
use reth_downloaders::{
Expand All @@ -14,7 +14,6 @@ use reth_exex::ExExManagerHandle;
use reth_network_p2p::{
bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader, BlockClient,
};
use reth_node_core::primitives::B256;
use reth_provider::{providers::ProviderNodeTypes, ProviderFactory};
use reth_stages::{prelude::DefaultStages, stages::ExecutionStage, Pipeline, StageSet};
use reth_static_file::StaticFileProducer;
Expand Down
2 changes: 1 addition & 1 deletion crates/node/core/src/args/gas_price_oracle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::primitives::U256;
use alloy_primitives::U256;
use clap::Args;
use reth_rpc_eth_types::GasPriceOracleConfig;
use reth_rpc_server_types::constants::gas_oracle::{
Expand Down
4 changes: 2 additions & 2 deletions crates/optimism/cli/src/commands/init_state/bedrock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloy_primitives::{BlockNumber, B256};
use alloy_primitives::{BlockNumber, B256, U256};
use reth_optimism_primitives::bedrock::{BEDROCK_HEADER, BEDROCK_HEADER_HASH, BEDROCK_HEADER_TTD};
use reth_primitives::{
BlockBody, Header, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, U256,
BlockBody, Header, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment,
};
use reth_provider::{
providers::StaticFileProvider, BlockWriter, StageCheckpointWriter, StaticFileWriter,
Expand Down
4 changes: 2 additions & 2 deletions crates/optimism/primitives/src/bedrock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! OP mainnet bedrock related data.

use alloy_primitives::{b256, bloom, bytes, B256, B64, U256};
use reth_primitives::{address, Header};
use alloy_primitives::{address, b256, bloom, bytes, B256, B64, U256};
use reth_primitives::Header;
use reth_primitives_traits::constants::EMPTY_OMMER_ROOT_HASH;

/// Transaction 0x9ed8f713b2cc6439657db52dcd2fdb9cc944915428f3c6e2a7703e242b259cb9 in block 985,
Expand Down
3 changes: 2 additions & 1 deletion crates/payload/builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
//! use std::future::Future;
//! use std::pin::Pin;
//! use std::task::{Context, Poll};
//! use alloy_primitives::U256;
//! use reth_payload_builder::{EthBuiltPayload, PayloadBuilderError, KeepPayloadJobAlive, EthPayloadBuilderAttributes, PayloadJob, PayloadJobGenerator};
//! use reth_primitives::{Block, Header, U256};
//! use reth_primitives::{Block, Header};
//!
//! /// The generator type that creates new jobs that builds empty blocks.
//! pub struct EmptyBlockPayloadJobGenerator;
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::{
Bytes, GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered,
Withdrawals, B256,
Withdrawals,
};
use alloc::vec::Vec;
pub use alloy_eips::eip1898::{
BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash,
};
use alloy_primitives::{Address, Sealable};
use alloy_primitives::{Address, Sealable, B256};
use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable};
use derive_more::{Deref, DerefMut};
#[cfg(any(test, feature = "arbitrary"))]
Expand Down
6 changes: 1 addition & 5 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ pub use transaction::{
};

// Re-exports
pub use alloy_primitives::{
self, address, b256, bloom, bytes,
bytes::{Buf, BufMut, BytesMut},
hex, Bytes, TxHash, B256, U256, U64,
};
pub use alloy_primitives::{self, bloom, bytes, bytes::Buf, hex, Bytes, TxHash};
pub use reth_ethereum_forks::*;
pub use revm_primitives::{self, JumpTable};

Expand Down
8 changes: 4 additions & 4 deletions crates/primitives/src/proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

use crate::{
constants::EMPTY_OMMER_ROOT_HASH, Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef,
Request, TransactionSigned, Withdrawal, B256,
Request, TransactionSigned, Withdrawal,
};
use alloc::vec::Vec;
use alloy_eips::eip7685::Encodable7685;
use alloy_primitives::keccak256;
use alloy_primitives::{keccak256, B256};
use reth_trie_common::root::{ordered_trie_root, ordered_trie_root_with_encoder};

/// Calculate a transaction root.
Expand Down Expand Up @@ -65,9 +65,9 @@ pub fn calculate_ommers_root(ommers: &[Header]) -> B256 {
#[cfg(test)]
mod tests {
use super::*;
use crate::{constants::EMPTY_ROOT_HASH, Block, U256};
use crate::{constants::EMPTY_ROOT_HASH, Block};
use alloy_genesis::GenesisAccount;
use alloy_primitives::{b256, hex_literal::hex, Address};
use alloy_primitives::{b256, hex_literal::hex, Address, U256};
use alloy_rlp::Decodable;
use reth_chainspec::{HOLESKY, MAINNET, SEPOLIA};
use reth_trie_common::root::{state_root_ref_unhashed, state_root_unhashed};
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, B256, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID,
logs_bloom, Bytes, TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID,
EIP7702_TX_TYPE_ID,
};
use alloc::{vec, vec::Vec};
use alloy_primitives::{Bloom, Log};
use alloy_primitives::{Bloom, Log, B256};
use alloy_rlp::{length_of_length, Decodable, Encodable, RlpDecodable, RlpEncodable};
use bytes::{Buf, BufMut};
use core::{cmp::Ordering, ops::Deref};
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/transaction/access_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

#[cfg(test)]
mod tests {
use crate::B256;
use alloy_eips::eip2930::{AccessList, AccessListItem};
use alloy_primitives::Address;
use alloy_primitives::{Address, B256};
use alloy_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
use proptest::proptest;
use proptest_arbitrary_interop::arb;
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/transaction/compat.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{Transaction, TransactionSigned, U256};
use alloy_primitives::{Address, TxKind};
use crate::{Transaction, TransactionSigned};
use alloy_primitives::{Address, TxKind, U256};
use revm_primitives::{AuthorizationList, TxEnv};

/// Implements behaviour to fill a [`TxEnv`] from another transaction.
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/src/transaction/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{GotExpectedBoxed, U256};
use crate::GotExpectedBoxed;
use alloy_primitives::U256;

/// Represents error variants that can happen when trying to validate a
/// [Transaction](crate::Transaction)
Expand Down
Loading
Loading