Skip to content

Commit

Permalink
primitives: rm alloy_consensus::transaction reexports (#11191)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Sep 25, 2024
1 parent 2224e6c commit 2022dd3
Show file tree
Hide file tree
Showing 42 changed files with 98 additions and 55 deletions.
12 changes: 12 additions & 0 deletions 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 @@ -68,6 +68,7 @@ reth-prune.workspace = true
# crypto
alloy-rlp.workspace = true
alloy-rpc-types = { workspace = true, features = ["engine"] }
alloy-consensus.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,4 +1,5 @@
//! Command for debugging block building.
use alloy_consensus::TxEip4844;
use alloy_rlp::Decodable;
use alloy_rpc_types::engine::{BlobsBundleV1, PayloadAttributes};
use clap::Parser;
Expand All @@ -25,7 +26,7 @@ use reth_payload_builder::database::CachedReads;
use reth_primitives::{
revm_primitives::KzgSettings, Address, BlobTransaction, BlobTransactionSidecar, Bytes,
PooledTransactionsElement, SealedBlock, SealedBlockWithSenders, Transaction, TransactionSigned,
TxEip4844, B256, U256,
B256, U256,
};
use reth_provider::{
providers::BlockchainProvider, BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider,
Expand Down
1 change: 1 addition & 0 deletions crates/blockchain-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ reth-evm-ethereum.workspace = true
parking_lot.workspace = true
assert_matches.workspace = true
alloy-genesis.workspace = true
alloy-consensus.workspace = true

[features]
test-utils = []
Expand Down
3 changes: 2 additions & 1 deletion crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::TxEip1559;
use alloy_genesis::{Genesis, GenesisAccount};
use alloy_primitives::{keccak256, Address, Sealable, B256};
use assert_matches::assert_matches;
Expand All @@ -1390,7 +1391,7 @@ mod tests {
proofs::{calculate_receipt_root, calculate_transaction_root},
revm_primitives::AccountInfo,
Account, BlockBody, Header, Signature, Transaction, TransactionSigned,
TransactionSignedEcRecovered, TxEip1559, Withdrawals,
TransactionSignedEcRecovered, Withdrawals,
};
use reth_provider::{
test_utils::{
Expand Down
3 changes: 3 additions & 0 deletions crates/chain-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,22 @@ pin-project.workspace = true
# optional deps for test-utils
alloy-signer = { workspace = true, optional = true }
alloy-signer-local = { workspace = true, optional = true }
alloy-consensus = { workspace = true, optional = true }
rand = { workspace = true, optional = true }
revm = { workspace = true, optional = true }

[dev-dependencies]
alloy-signer.workspace = true
alloy-signer-local.workspace = true
alloy-consensus.workspace = true
rand.workspace = true
revm.workspace = true

[features]
test-utils = [
"alloy-signer",
"alloy-signer-local",
"alloy-consensus",
"rand",
"revm"
]
3 changes: 2 additions & 1 deletion crates/chain-state/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{
in_memory::ExecutedBlock, CanonStateNotification, CanonStateNotifications,
CanonStateSubscriptions,
};
use alloy_consensus::TxEip1559;
use alloy_primitives::{Address, BlockNumber, B256, U256};
use alloy_signer::SignerSync;
use alloy_signer_local::PrivateKeySigner;
Expand All @@ -13,7 +14,7 @@ use reth_primitives::{
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,
SealedHeader, Transaction, TransactionSigned, TransactionSignedEcRecovered, TxEip1559,
SealedHeader, Transaction, TransactionSigned, TransactionSignedEcRecovered,
};
use reth_trie::{root::state_root_unhashed, updates::TrieUpdates, HashedPostState};
use revm::{db::BundleState, primitives::AccountInfo};
Expand Down
2 changes: 2 additions & 0 deletions crates/consensus/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ revm-primitives.workspace = true
reth-storage-api.workspace = true
rand.workspace = true
mockall = "0.12"

alloy-consensus.workspace = true
3 changes: 2 additions & 1 deletion crates/consensus/common/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ pub fn validate_against_parent_4844(
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::TxEip4844;
use alloy_primitives::{
hex_literal::hex, Address, BlockHash, BlockNumber, Bytes, Parity, Sealable, U256,
};
Expand All @@ -310,7 +311,7 @@ mod tests {
use reth_chainspec::ChainSpecBuilder;
use reth_primitives::{
proofs, Account, BlockBody, BlockHashOrNumber, Signature, Transaction, TransactionSigned,
TxEip4844, Withdrawal, Withdrawals,
Withdrawal, Withdrawals,
};
use reth_storage_api::{
errors::provider::ProviderResult, AccountReader, HeaderProvider, WithdrawalsProvider,
Expand Down
1 change: 1 addition & 0 deletions crates/ethereum/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ reth-primitives = { workspace = true, features = ["secp256k1"] }
secp256k1.workspace = true
serde_json.workspace = true
alloy-genesis.workspace = true
alloy-consensus.workspace = true

[features]
default = ["std"]
Expand Down
3 changes: 2 additions & 1 deletion crates/ethereum/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::TxLegacy;
use alloy_eips::{
eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE},
eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE, SYSTEM_ADDRESS},
Expand All @@ -481,7 +482,7 @@ mod tests {
use reth_chainspec::{ChainSpecBuilder, ForkCondition};
use reth_primitives::{
constants::{EMPTY_ROOT_HASH, ETH_TO_WEI},
public_key_to_address, Account, Block, BlockBody, Transaction, TxLegacy,
public_key_to_address, Account, Block, BlockBody, Transaction,
};
use reth_revm::{
database::StateProviderDatabase, test_utils::StateProviderTest, TransitionState,
Expand Down
1 change: 1 addition & 0 deletions crates/exex/exex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ reth-provider = { workspace = true, features = ["test-utils"] }
reth-testing-utils.workspace = true

alloy-genesis.workspace = true
alloy-consensus.workspace = true

secp256k1.workspace = true
tempfile.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/exex/exex/src/backfill/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::sync::Arc;

use alloy_consensus::TxEip2930;
use alloy_genesis::{Genesis, GenesisAccount};
use alloy_primitives::{b256, Address, TxKind, U256};
use eyre::OptionExt;
Expand All @@ -10,7 +11,7 @@ use reth_evm::execute::{
use reth_evm_ethereum::execute::EthExecutorProvider;
use reth_primitives::{
constants::ETH_TO_WEI, Block, BlockBody, BlockWithSenders, Header, Receipt, Requests,
SealedBlockWithSenders, Transaction, TxEip2930,
SealedBlockWithSenders, Transaction,
};
use reth_provider::{
providers::ProviderNodeTypes, BlockWriter as _, ExecutionOutcome, LatestStateProviderRef,
Expand Down
1 change: 1 addition & 0 deletions crates/net/eth-wire-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ arbitrary = { workspace = true, features = ["derive"] }
proptest.workspace = true
proptest-arbitrary-interop.workspace = true
rand.workspace = true
alloy-consensus.workspace = true

[features]
arbitrary = [
Expand Down
3 changes: 2 additions & 1 deletion crates/net/eth-wire-types/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ mod tests {
message::RequestPair, BlockBodies, BlockHeaders, GetBlockBodies, GetBlockHeaders,
HeadersDirection,
};
use alloy_consensus::TxLegacy;
use alloy_primitives::{hex, TxKind, U256};
use alloy_rlp::{Decodable, Encodable};
use reth_primitives::{
alloy_primitives::Parity, BlockHashOrNumber, Header, Signature, Transaction,
TransactionSigned, TxLegacy,
TransactionSigned,
};
use std::str::FromStr;

Expand Down
3 changes: 2 additions & 1 deletion crates/net/eth-wire-types/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ impl FromIterator<PooledTransactionsElement> for PooledTransactions {
#[cfg(test)]
mod tests {
use crate::{message::RequestPair, GetPooledTransactions, PooledTransactions};
use alloy_consensus::{TxEip1559, TxLegacy};
use alloy_primitives::{hex, TxKind, U256};
use alloy_rlp::{Decodable, Encodable};
use reth_chainspec::MIN_TRANSACTION_GAS;
use reth_primitives::{
alloy_primitives::Parity, PooledTransactionsElement, Signature, Transaction,
TransactionSigned, TxEip1559, TxLegacy,
TransactionSigned,
};
use std::str::FromStr;

Expand Down
1 change: 1 addition & 0 deletions crates/net/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ reth-transaction-pool = { workspace = true, features = ["test-utils"] }
# alloy deps for testing against nodes
alloy-node-bindings.workspace = true
alloy-provider= { workspace = true, features = ["admin-api"] }
alloy-consensus.workspace = true

# misc
serial_test.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/net/network/tests/it/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use std::sync::Arc;

use alloy_consensus::TxEip2930;
use alloy_primitives::{Bytes, TxKind, U256};
use rand::Rng;
use reth_eth_wire::HeadersDirection;
Expand All @@ -16,7 +17,7 @@ use reth_network_p2p::{
headers::client::{HeadersClient, HeadersRequest},
};
use reth_primitives::{
alloy_primitives::Parity, Block, Header, Signature, Transaction, TransactionSigned, TxEip2930,
alloy_primitives::Parity, Block, Header, Signature, Transaction, TransactionSigned,
};
use reth_provider::test_utils::MockEthProvider;

Expand Down
3 changes: 2 additions & 1 deletion crates/net/network/tests/it/txgossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

use std::sync::Arc;

use alloy_consensus::TxLegacy;
use alloy_primitives::U256;
use futures::StreamExt;
use rand::thread_rng;
use reth_network::{test_utils::Testnet, NetworkEvent, NetworkEventListenerProvider};
use reth_network_api::PeersInfo;
use reth_primitives::{Signature, TransactionSigned, TxLegacy};
use reth_primitives::{Signature, TransactionSigned};
use reth_provider::test_utils::{ExtendedAccount, MockEthProvider};
use reth_transaction_pool::{test_utils::TransactionGenerator, PoolTransaction, TransactionPool};

Expand Down
1 change: 1 addition & 0 deletions crates/optimism/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ tracing.workspace = true
reth-revm = { workspace = true, features = ["test-utils"] }
reth-optimism-chainspec.workspace = true
alloy-genesis.workspace = true
alloy-consensus.workspace = true

[features]
optimism = [
Expand Down
4 changes: 2 additions & 2 deletions crates/optimism/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,12 @@ where
mod tests {
use super::*;
use crate::OpChainSpec;
use alloy_consensus::TxEip1559;
use alloy_primitives::{b256, Address, StorageKey, StorageValue};
use reth_chainspec::{ChainSpecBuilder, MIN_TRANSACTION_GAS};
use reth_optimism_chainspec::optimism_deposit_tx_signature;
use reth_primitives::{
Account, Block, BlockBody, Signature, Transaction, TransactionSigned, TxEip1559,
BASE_MAINNET,
Account, Block, BlockBody, Signature, Transaction, TransactionSigned, BASE_MAINNET,
};
use reth_revm::{
database::StateProviderDatabase, test_utils::StateProviderTest, L1_BLOCK_CONTRACT,
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/benches/validate_blob_tx.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![allow(missing_docs)]

use alloy_consensus::TxEip4844;
use alloy_eips::eip4844::env_settings::EnvKzgSettings;
use alloy_primitives::hex;
use criterion::{
Expand All @@ -11,7 +12,7 @@ use proptest::{
test_runner::{RngAlgorithm, TestRng, TestRunner},
};
use proptest_arbitrary_interop::arb;
use reth_primitives::{BlobTransactionSidecar, TxEip4844};
use reth_primitives::BlobTransactionSidecar;
use revm_primitives::MAX_BLOB_NUMBER_PER_BLOCK;

// constant seed to use for the rng
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/alloy_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use crate::{
constants::EMPTY_TRANSACTIONS, transaction::extract_chain_id, Block, BlockBody, Signature,
Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
TxEip1559, TxEip2930, TxEip4844, TxLegacy, TxType,
Transaction, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, TxType,
};
use alloc::{string::ToString, vec::Vec};
use alloy_consensus::{TxEip1559, TxEip2930, TxEip4844, TxLegacy};
use alloy_primitives::{Parity, TxKind};
use alloy_rlp::Error as RlpError;
use alloy_serde::WithOtherFields;
Expand Down
6 changes: 3 additions & 3 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ pub use transaction::BlobTransactionValidationError;
pub use transaction::{
util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
IntoRecoveredTransaction, InvalidTransactionError, Signature, Transaction, TransactionMeta,
TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, TxEip1559, TxEip2930,
TxEip4844, TxEip7702, TxHashOrNumber, TxLegacy, TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID,
EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID, LEGACY_TX_TYPE_ID,
TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, TxHashOrNumber,
TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};

// Re-exports
Expand Down
Loading

0 comments on commit 2022dd3

Please sign in to comment.