primitives: use alloy *_TX_TYPE_ID constants (#11853)

This commit is contained in:
Thomas Coratger
2024-10-18 00:41:59 +02:00
committed by GitHub
parent f3c0dda0d3
commit 62e7625b16
11 changed files with 36 additions and 44 deletions

View File

@ -61,8 +61,6 @@ pub use transaction::{
util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
InvalidTransactionError, Signature, Transaction, TransactionMeta, 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

@ -1,10 +1,10 @@
#[cfg(feature = "reth-codec")]
use crate::compression::{RECEIPT_COMPRESSOR, RECEIPT_DECOMPRESSOR};
use crate::{
logs_bloom, TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID,
EIP7702_TX_TYPE_ID,
};
use crate::{logs_bloom, TxType};
use alloc::{vec, vec::Vec};
use alloy_consensus::constants::{
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
};
use alloy_primitives::{Bloom, Bytes, Log, B256};
use alloy_rlp::{length_of_length, Decodable, Encodable, RlpDecodable, RlpEncodable};
use bytes::{Buf, BufMut};

View File

@ -1,6 +1,8 @@
//! Transaction types.
use crate::BlockHashOrNumber;
#[cfg(any(test, feature = "reth-codec"))]
use alloy_consensus::constants::{EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID};
use alloy_consensus::{
SignableTransaction, Transaction as _, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy,
};
@ -37,10 +39,7 @@ pub use compat::FillTxEnv;
pub use signature::{
extract_chain_id, legacy_parity, recover_signer, recover_signer_unchecked, Signature,
};
pub use tx_type::{
TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
pub use tx_type::TxType;
pub use variant::TransactionSignedVariant;
pub(crate) mod access_list;

View File

@ -8,9 +8,10 @@ use super::{
};
use crate::{
BlobTransaction, BlobTransactionSidecar, Signature, Transaction, TransactionSigned,
TransactionSignedEcRecovered, EIP4844_TX_TYPE_ID,
TransactionSignedEcRecovered,
};
use alloy_consensus::{
constants::EIP4844_TX_TYPE_ID,
transaction::{TxEip1559, TxEip2930, TxEip4844, TxLegacy},
SignableTransaction, TxEip4844WithSidecar,
};

View File

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

View File

@ -1,3 +1,7 @@
use alloy_consensus::constants::{
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
use alloy_primitives::{U64, U8};
use alloy_rlp::{Decodable, Encodable};
use serde::{Deserialize, Serialize};
@ -23,22 +27,6 @@ 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`](alloy_consensus::TxLegacy) this is
/// technically not typed.
pub const LEGACY_TX_TYPE_ID: u8 = 0;
/// Identifier for [`TxEip2930`](alloy_consensus::TxEip2930) transaction.
pub const EIP2930_TX_TYPE_ID: u8 = 1;
/// Identifier for [`TxEip1559`](alloy_consensus::TxEip1559) transaction.
pub const EIP1559_TX_TYPE_ID: u8 = 2;
/// Identifier for [`TxEip4844`](alloy_consensus::TxEip4844) transaction.
pub const EIP4844_TX_TYPE_ID: u8 = 3;
/// Identifier for [`TxEip7702`](alloy_consensus::TxEip7702) transaction.
pub const EIP7702_TX_TYPE_ID: u8 = 4;
/// Identifier for [`TxDeposit`](op_alloy_consensus::TxDeposit) transaction.
#[cfg(feature = "optimism")]
pub const DEPOSIT_TX_TYPE_ID: u8 = 126;

View File

@ -2,11 +2,9 @@ use crate::{
pool::{NEW_TX_LISTENER_BUFFER_SIZE, PENDING_TX_LISTENER_BUFFER_SIZE},
PoolSize, TransactionOrigin,
};
use alloy_consensus::constants::EIP4844_TX_TYPE_ID;
use alloy_primitives::Address;
use reth_primitives::{
constants::{ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE},
EIP4844_TX_TYPE_ID,
};
use reth_primitives::constants::{ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE};
use std::{collections::HashSet, ops::Mul};
/// Guarantees max transactions for one sender, compatible with geth/erigon

View File

@ -18,14 +18,14 @@ use crate::{
PoolConfig, PoolResult, PoolTransaction, PriceBumpConfig, TransactionOrdering,
ValidPoolTransaction, U256,
};
use alloy_primitives::{Address, TxHash, B256};
use reth_primitives::{
constants::{
eip4844::BLOB_TX_MIN_BLOB_GASPRICE, ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE,
},
use alloy_consensus::constants::{
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
use alloy_primitives::{Address, TxHash, B256};
use reth_primitives::constants::{
eip4844::BLOB_TX_MIN_BLOB_GASPRICE, ETHEREUM_BLOCK_GAS_LIMIT, MIN_PROTOCOL_BASE_FEE,
};
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
use std::{

View File

@ -7,7 +7,10 @@ use crate::{
CoinbaseTipOrdering, EthBlobTransactionSidecar, EthPoolTransaction, PoolTransaction,
ValidPoolTransaction,
};
use alloy_consensus::{TxEip1559, TxEip2930, TxEip4844, TxLegacy};
use alloy_consensus::{
constants::{EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, LEGACY_TX_TYPE_ID},
TxEip1559, TxEip2930, TxEip4844, TxLegacy,
};
use alloy_eips::eip2930::AccessList;
use alloy_primitives::{Address, Bytes, ChainId, TxHash, TxKind, B256, U256};
use paste::paste;
@ -20,7 +23,6 @@ use reth_primitives::{
transaction::TryFromRecoveredTransactionError,
BlobTransactionSidecar, BlobTransactionValidationError, PooledTransactionsElementEcRecovered,
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

@ -7,7 +7,10 @@ use crate::{
validate::ValidPoolTransaction,
AllTransactionsEvents,
};
use alloy_consensus::Transaction as _;
use alloy_consensus::{
constants::{EIP1559_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID},
Transaction as _,
};
use alloy_eips::{eip2718::Encodable2718, eip2930::AccessList, eip4844::BlobAndProofV1};
use alloy_primitives::{Address, TxHash, TxKind, B256, U256};
use futures_util::{ready, Stream};
@ -17,7 +20,6 @@ use reth_primitives::{
kzg::KzgSettings, transaction::TryFromRecoveredTransactionError, BlobTransactionSidecar,
BlobTransactionValidationError, PooledTransactionsElement,
PooledTransactionsElementEcRecovered, SealedBlock, Transaction, TransactionSignedEcRecovered,
EIP1559_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

View File

@ -11,11 +11,13 @@ use crate::{
EthBlobTransactionSidecar, EthPoolTransaction, LocalTransactionConfig, PoolTransaction,
TransactionValidationOutcome, TransactionValidationTaskExecutor, TransactionValidator,
};
use alloy_consensus::constants::{
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_primitives::{
constants::eip4844::MAX_BLOBS_PER_BLOCK, GotExpected, InvalidTransactionError, SealedBlock,
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
use reth_storage_api::{AccountReader, StateProviderFactory};
use reth_tasks::TaskSpawner;