primitives: rm alloy_consensus::transaction reexports (#11191)

This commit is contained in:
Thomas Coratger
2024-09-25 14:13:48 +02:00
committed by GitHub
parent 2224e6c48b
commit 2022dd3de5
42 changed files with 98 additions and 55 deletions

12
Cargo.lock generated
View File

@ -6173,6 +6173,7 @@ dependencies = [
name = "reth"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-rlp",
"alloy-rpc-types",
"aquamarine",
@ -6379,6 +6380,7 @@ dependencies = [
name = "reth-blockchain-tree"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-genesis",
"alloy-primitives",
"aquamarine",
@ -6427,6 +6429,7 @@ dependencies = [
name = "reth-chain-state"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-primitives",
"alloy-signer",
@ -6632,6 +6635,7 @@ dependencies = [
name = "reth-consensus-common"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-primitives",
"mockall",
"rand 0.8.5",
@ -7157,6 +7161,7 @@ name = "reth-eth-wire-types"
version = "1.0.7"
dependencies = [
"alloy-chains",
"alloy-consensus",
"alloy-eips",
"alloy-genesis",
"alloy-primitives",
@ -7297,6 +7302,7 @@ dependencies = [
name = "reth-evm-ethereum"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-genesis",
"alloy-primitives",
@ -7319,6 +7325,7 @@ dependencies = [
name = "reth-evm-optimism"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-genesis",
"alloy-primitives",
"reth-chainspec",
@ -7371,6 +7378,7 @@ dependencies = [
name = "reth-exex"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-genesis",
"alloy-primitives",
"eyre",
@ -7580,6 +7588,7 @@ dependencies = [
name = "reth-network"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-node-bindings",
"alloy-primitives",
@ -8291,6 +8300,7 @@ dependencies = [
name = "reth-provider"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-primitives",
"alloy-rpc-types-engine",
@ -8918,6 +8928,7 @@ dependencies = [
name = "reth-testing-utils"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-genesis",
"alloy-primitives",
@ -8953,6 +8964,7 @@ dependencies = [
name = "reth-transaction-pool"
version = "1.0.7"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-primitives",
"alloy-rlp",

View File

@ -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

View File

@ -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;
@ -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,

View File

@ -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 = []

View File

@ -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;
@ -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::{

View File

@ -42,12 +42,14 @@ 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
@ -55,6 +57,7 @@ revm.workspace = true
test-utils = [
"alloy-signer",
"alloy-signer-local",
"alloy-consensus",
"rand",
"revm"
]

View File

@ -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;
@ -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};

View File

@ -24,3 +24,5 @@ revm-primitives.workspace = true
reth-storage-api.workspace = true
rand.workspace = true
mockall = "0.12"
alloy-consensus.workspace = true

View File

@ -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,
};
@ -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,

View File

@ -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"]

View File

@ -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},
@ -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,

View File

@ -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

View File

@ -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;
@ -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,

View File

@ -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 = [

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;
@ -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;

View File

@ -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};

View File

@ -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 = [

View File

@ -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,

View File

@ -1,5 +1,6 @@
#![allow(missing_docs)]
use alloy_consensus::TxEip4844;
use alloy_eips::eip4844::env_settings::EnvKzgSettings;
use alloy_primitives::hex;
use criterion::{
@ -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

View File

@ -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;

View File

@ -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

View File

@ -4,7 +4,7 @@ use crate::{keccak256, Address, BlockHashOrNumber, Bytes, TxHash, B256, U256};
use alloy_eips::eip7702::SignedAuthorization;
use alloy_primitives::TxKind;
use alloy_consensus::SignableTransaction;
use alloy_consensus::{SignableTransaction, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy};
use alloy_eips::eip2930::AccessList;
use alloy_primitives::Parity;
use alloy_rlp::{
@ -18,8 +18,6 @@ use rayon::prelude::{IntoParallelIterator, ParallelIterator};
use serde::{Deserialize, Serialize};
use signature::{decode_with_eip155_chain_id, with_eip155_parity};
pub use alloy_consensus::{TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy};
pub use error::{
InvalidTransactionError, TransactionConversionError, TryFromRecoveredTransactionError,
};

View File

@ -8,11 +8,13 @@ use super::{
};
use crate::{
Address, BlobTransaction, BlobTransactionSidecar, Bytes, Signature, Transaction,
TransactionSigned, TransactionSignedEcRecovered, TxEip1559, TxEip2930, TxEip4844, TxHash,
TxLegacy, B256, EIP4844_TX_TYPE_ID,
TransactionSigned, TransactionSignedEcRecovered, TxHash, B256, EIP4844_TX_TYPE_ID,
};
use alloc::vec::Vec;
use alloy_consensus::{SignableTransaction, TxEip4844WithSidecar};
use alloy_consensus::{
transaction::{TxEip1559, TxEip2930, TxEip4844, TxLegacy},
SignableTransaction, TxEip4844WithSidecar,
};
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header, EMPTY_LIST_CODE};
use bytes::Buf;
use derive_more::{AsRef, Deref};

View File

@ -1,9 +1,7 @@
#![cfg_attr(docsrs, doc(cfg(feature = "c-kzg")))]
use crate::{
keccak256, Signature, Transaction, TransactionSigned, TxEip4844, TxHash, EIP4844_TX_TYPE_ID,
};
use alloy_consensus::TxEip4844WithSidecar;
use crate::{keccak256, Signature, Transaction, TransactionSigned, TxHash, EIP4844_TX_TYPE_ID};
use alloy_consensus::{transaction::TxEip4844, TxEip4844WithSidecar};
use alloy_rlp::{Decodable, Error as RlpError, Header};
use serde::{Deserialize, Serialize};

View File

@ -23,23 +23,23 @@ pub(crate) const COMPACT_IDENTIFIER_EIP1559: usize = 2;
#[cfg(any(test, feature = "reth-codec"))]
pub(crate) const COMPACT_EXTENDED_IDENTIFIER_FLAG: usize = 3;
/// Identifier for legacy transaction, however [`TxLegacy`](crate::TxLegacy) this is technically not
/// typed.
/// Identifier for legacy transaction, however [`TxLegacy`](alloy_consensus::TxLegacy) this is
/// technically not typed.
pub const LEGACY_TX_TYPE_ID: u8 = 0;
/// Identifier for [`TxEip2930`](crate::TxEip2930) transaction.
/// Identifier for [`TxEip2930`](alloy_consensus::TxEip2930) transaction.
pub const EIP2930_TX_TYPE_ID: u8 = 1;
/// Identifier for [`TxEip1559`](crate::TxEip1559) transaction.
/// Identifier for [`TxEip1559`](alloy_consensus::TxEip1559) transaction.
pub const EIP1559_TX_TYPE_ID: u8 = 2;
/// Identifier for [`TxEip4844`](crate::TxEip4844) transaction.
/// Identifier for [`TxEip4844`](alloy_consensus::TxEip4844) transaction.
pub const EIP4844_TX_TYPE_ID: u8 = 3;
/// Identifier for [`TxEip7702`](crate::TxEip7702) transaction.
/// Identifier for [`TxEip7702`](alloy_consensus::TxEip7702) transaction.
pub const EIP7702_TX_TYPE_ID: u8 = 4;
/// Identifier for [`TxDeposit`](crate::TxDeposit) transaction.
/// Identifier for [`TxDeposit`](op_alloy_consensus::TxDeposit) transaction.
#[cfg(feature = "optimism")]
pub const DEPOSIT_TX_TYPE_ID: u8 = 126;

View File

@ -90,6 +90,8 @@ reth-testing-utils.workspace = true
reth-transaction-pool = { workspace = true, features = ["test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] }
alloy-consensus.workspace = true
jsonrpsee-types.workspace = true
jsonrpsee = { workspace = true, features = ["client"] }

View File

@ -471,7 +471,7 @@ mod tests {
if let Some(base_fee_per_gas) = header.base_fee_per_gas {
let transaction = TransactionSigned {
transaction: reth_primitives::Transaction::Eip1559(
reth_primitives::TxEip1559 {
alloy_consensus::TxEip1559 {
max_priority_fee_per_gas: random_fee,
max_fee_per_gas: random_fee + base_fee_per_gas,
..Default::default()

View File

@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
/// By deriving `Compact` here, any future changes or enhancements to the `Compact` derive
/// will automatically apply to this type.
///
/// Notice: Make sure this struct is 1:1 with [`alloy_consensus::transaction::TxEip1559`]
/// Notice: Make sure this struct is 1:1 with [`alloy_consensus::TxEip1559`]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Compact, Default, Serialize, Deserialize)]
#[cfg_attr(test, derive(arbitrary::Arbitrary))]
#[cfg_attr(test, crate::add_arbitrary_tests(compact))]

View File

@ -1,5 +1,5 @@
use crate::Compact;
use alloy_consensus::transaction::TxEip2930 as AlloyTxEip2930;
use alloy_consensus::TxEip2930 as AlloyTxEip2930;
use alloy_eips::eip2930::AccessList;
use alloy_primitives::{Bytes, ChainId, TxKind, U256};
use reth_codecs_derive::add_arbitrary_tests;
@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
/// By deriving `Compact` here, any future changes or enhancements to the `Compact` derive
/// will automatically apply to this type.
///
/// Notice: Make sure this struct is 1:1 with [`alloy_consensus::transaction::TxEip2930`]
/// Notice: Make sure this struct is 1:1 with [`alloy_consensus::TxEip2930`]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize, Compact)]
#[cfg_attr(test, derive(arbitrary::Arbitrary))]
#[add_arbitrary_tests(compact)]

View File

@ -1,6 +1,6 @@
use crate::{Compact, CompactPlaceholder};
use alloc::vec::Vec;
use alloy_consensus::transaction::TxEip4844 as AlloyTxEip4844;
use alloy_consensus::TxEip4844 as AlloyTxEip4844;
use alloy_eips::eip2930::AccessList;
use alloy_primitives::{Address, Bytes, ChainId, B256, U256};
use reth_codecs_derive::add_arbitrary_tests;
@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
/// By deriving `Compact` here, any future changes or enhancements to the `Compact` derive
/// will automatically apply to this type.
///
/// Notice: Make sure this struct is 1:1 with [`alloy_consensus::transaction::TxEip4844`]
/// Notice: Make sure this struct is 1:1 with [`alloy_consensus::TxEip4844`]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize, Compact)]
#[cfg_attr(test, derive(arbitrary::Arbitrary))]
#[add_arbitrary_tests(compact)]

View File

@ -1,6 +1,6 @@
use crate::Compact;
use alloc::vec::Vec;
use alloy_consensus::transaction::TxEip7702 as AlloyTxEip7702;
use alloy_consensus::TxEip7702 as AlloyTxEip7702;
use alloy_eips::{eip2930::AccessList, eip7702::SignedAuthorization};
use alloy_primitives::{Address, Bytes, ChainId, U256};
use reth_codecs_derive::add_arbitrary_tests;
@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
/// By deriving `Compact` here, any future changes or enhancements to the `Compact` derive
/// will automatically apply to this type.
///
/// Notice: Make sure this struct is 1:1 with [`alloy_consensus::transaction::TxEip7702`]
/// Notice: Make sure this struct is 1:1 with [`alloy_consensus::TxEip7702`]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Serialize, Deserialize, Compact)]
#[cfg_attr(test, derive(arbitrary::Arbitrary))]
#[add_arbitrary_tests(compact)]

View File

@ -64,6 +64,7 @@ strum.workspace = true
# test-utils
once_cell = { workspace = true, optional = true }
reth-ethereum-engine-primitives = { workspace = true, optional = true }
alloy-consensus = { workspace = true, optional = true }
# parallel utils
rayon.workspace = true
@ -81,6 +82,8 @@ rand.workspace = true
once_cell.workspace = true
eyre.workspace = true
alloy-consensus.workspace = true
[features]
optimism = ["reth-primitives/optimism", "reth-execution-types/optimism", "reth-optimism-primitives"]
serde = ["reth-execution-types/serde"]
@ -91,4 +94,5 @@ test-utils = [
"reth-chain-state/test-utils",
"once_cell",
"reth-ethereum-engine-primitives",
"alloy-consensus",
]

View File

@ -1,5 +1,6 @@
//! Dummy blocks and data for tests
use crate::{DatabaseProviderRW, ExecutionOutcome};
use alloy_consensus::TxLegacy;
use alloy_primitives::{Log, Parity, Sealable, TxKind};
use once_cell::sync::Lazy;
use reth_db::tables;
@ -7,7 +8,7 @@ use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
use reth_primitives::{
alloy_primitives, b256, hex_literal::hex, Account, Address, BlockBody, BlockNumber, Bytes,
Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, Signature, Transaction,
TransactionSigned, TxLegacy, TxType, Withdrawal, Withdrawals, B256, U256,
TransactionSigned, TxType, Withdrawal, Withdrawals, B256, U256,
};
use reth_trie::root::{state_root_unhashed, storage_root_unhashed};
use revm::{

View File

@ -54,6 +54,7 @@ rand = { workspace = true, optional = true }
paste = { workspace = true, optional = true }
proptest = { workspace = true, optional = true }
proptest-arbitrary-interop = { workspace = true, optional = true }
alloy-consensus = { workspace = true, optional = true }
[dev-dependencies]
reth-primitives = { workspace = true, features = ["arbitrary"] }
@ -68,11 +69,12 @@ pprof = { workspace = true, features = ["criterion", "flamegraph"] }
assert_matches.workspace = true
tempfile.workspace = true
serde_json.workspace = true
alloy-consensus.workspace = true
[features]
default = ["serde"]
serde = ["dep:serde"]
test-utils = ["rand", "paste", "serde"]
test-utils = ["rand", "paste", "serde", "alloy-consensus"]
arbitrary = ["proptest", "reth-primitives/arbitrary", "proptest-arbitrary-interop"]
[[bench]]

View File

@ -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 rand::Rng;
use reth_chainspec::MAINNET;
use reth_primitives::{
constants::MIN_PROTOCOL_BASE_FEE, sign_message, Bytes, Transaction, TransactionSigned,
TxEip1559, TxEip4844, TxLegacy,
};
/// A generator for transactions for testing purposes.

View File

@ -7,6 +7,7 @@ use crate::{
CoinbaseTipOrdering, EthBlobTransactionSidecar, EthPoolTransaction, PoolTransaction,
ValidPoolTransaction,
};
use alloy_consensus::{TxEip1559, TxEip2930, TxEip4844, TxLegacy};
use alloy_eips::eip2930::AccessList;
use alloy_primitives::{Address, Bytes, ChainId, TxHash, TxKind, B256, U256};
use paste::paste;
@ -18,9 +19,8 @@ use reth_primitives::{
constants::{eip4844::DATA_GAS_PER_BLOB, MIN_PROTOCOL_BASE_FEE},
transaction::TryFromRecoveredTransactionError,
BlobTransactionSidecar, BlobTransactionValidationError, PooledTransactionsElementEcRecovered,
Signature, Transaction, TransactionSigned, TransactionSignedEcRecovered, TxEip1559, TxEip2930,
TxEip4844, TxLegacy, TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
Signature, Transaction, TransactionSigned, TransactionSignedEcRecovered, TxType,
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, LEGACY_TX_TYPE_ID,
};
use std::{ops::Range, sync::Arc, time::Instant, vec::IntoIter};

View File

@ -1392,10 +1392,8 @@ impl<Tx: PoolTransaction> Stream for NewSubpoolTransactionStream<Tx> {
#[cfg(test)]
mod tests {
use super::*;
use reth_primitives::{
constants::eip4844::DATA_GAS_PER_BLOB, Signature, TransactionSigned, TxEip1559, TxEip2930,
TxEip4844, TxEip7702, TxLegacy,
};
use alloy_consensus::{TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy};
use reth_primitives::{constants::eip4844::DATA_GAS_PER_BLOB, Signature, TransactionSigned};
#[test]
fn test_pool_size_invariants() {

View File

@ -17,6 +17,7 @@ reth-primitives = { workspace = true, features = ["secp256k1"] }
alloy-eips.workspace = true
alloy-genesis.workspace = true
alloy-primitives.workspace = true
alloy-consensus.workspace = true
rand.workspace = true
secp256k1 = { workspace = true, features = ["rand"] }

View File

@ -1,5 +1,6 @@
//! Generators for different data structures like block headers, block bodies and ranges of those.
use alloy_consensus::TxLegacy;
use alloy_eips::{
eip6110::DepositRequest, eip7002::WithdrawalRequest, eip7251::ConsolidationRequest,
};
@ -10,7 +11,7 @@ use rand::{
};
use reth_primitives::{
proofs, sign_message, Account, BlockBody, Header, Log, Receipt, Request, Requests, SealedBlock,
SealedHeader, StorageEntry, Transaction, TransactionSigned, TxLegacy, Withdrawal, Withdrawals,
SealedHeader, StorageEntry, Transaction, TransactionSigned, Withdrawal, Withdrawals,
};
use secp256k1::{Keypair, Secp256k1};
use std::{
@ -497,9 +498,10 @@ pub fn random_request<R: Rng>(rng: &mut R) -> Request {
#[cfg(test)]
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, TxEip1559};
use reth_primitives::{hex, public_key_to_address, Signature};
use std::str::FromStr;
#[test]