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 #11222

Merged
merged 12 commits into from
Sep 26, 2024
11 changes: 10 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/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
};
Expand Down
3 changes: 2 additions & 1 deletion bin/reth/src/commands/debug_cmd/execution.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion crates/config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
1 change: 0 additions & 1 deletion crates/evm/execution-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion crates/node/builder/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions crates/optimism/cli/src/commands/init_state/bedrock.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/optimism/cli/src/receipt_file_codec.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
6 changes: 3 additions & 3 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
@@ -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"))]
Expand Down
5 changes: 2 additions & 3 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
5 changes: 3 additions & 2 deletions crates/primitives/src/proofs.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 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, 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};
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/src/transaction/access_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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::{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.
Expand Down
8 changes: 4 additions & 4 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions crates/primitives/src/transaction/pooled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/src/transaction/sidecar.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
9 changes: 4 additions & 5 deletions crates/primitives/src/transaction/signature.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/src/transaction/tx_type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{U64, U8};
use crate::U64;
use alloy_primitives::U8;
use alloy_rlp::{Decodable, Encodable};
use serde::{Deserialize, Serialize};

Expand Down
9 changes: 4 additions & 5 deletions crates/primitives/src/transaction/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{Address, Signature};
use crate::Signature;
use alloy_primitives::Address;
use revm_primitives::B256;

#[cfg(feature = "secp256k1")]
Expand All @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/transaction/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading
Loading