mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: rename transaction (#4252)
This commit is contained in:
@ -165,9 +165,9 @@ pub use crate::{
|
|||||||
},
|
},
|
||||||
traits::{
|
traits::{
|
||||||
AllPoolTransactions, BestTransactions, BlockInfo, CanonicalStateUpdate, ChangedAccount,
|
AllPoolTransactions, BestTransactions, BlockInfo, CanonicalStateUpdate, ChangedAccount,
|
||||||
NewTransactionEvent, PendingTransactionListenerKind, PoolSize, PoolTransaction,
|
EthPooledTransaction, NewTransactionEvent, PendingTransactionListenerKind, PoolSize,
|
||||||
PooledTransaction, PropagateKind, PropagatedTransactions, TransactionOrigin,
|
PoolTransaction, PropagateKind, PropagatedTransactions, TransactionOrigin, TransactionPool,
|
||||||
TransactionPool, TransactionPoolExt,
|
TransactionPoolExt,
|
||||||
},
|
},
|
||||||
validate::{
|
validate::{
|
||||||
EthTransactionValidator, TransactionValidationOutcome, TransactionValidator,
|
EthTransactionValidator, TransactionValidationOutcome, TransactionValidator,
|
||||||
@ -262,12 +262,15 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<Client>
|
impl<Client>
|
||||||
Pool<EthTransactionValidator<Client, PooledTransaction>, CoinbaseTipOrdering<PooledTransaction>>
|
Pool<
|
||||||
|
EthTransactionValidator<Client, EthPooledTransaction>,
|
||||||
|
CoinbaseTipOrdering<EthPooledTransaction>,
|
||||||
|
>
|
||||||
where
|
where
|
||||||
Client: StateProviderFactory + Clone + 'static,
|
Client: StateProviderFactory + Clone + 'static,
|
||||||
{
|
{
|
||||||
/// Returns a new [Pool] that uses the default [EthTransactionValidator] when validating
|
/// Returns a new [Pool] that uses the default [EthTransactionValidator] when validating
|
||||||
/// [PooledTransaction]s and ords via [CoinbaseTipOrdering]
|
/// [EthPooledTransaction]s and ords via [CoinbaseTipOrdering]
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
@ -284,7 +287,7 @@ where
|
|||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn eth_pool(
|
pub fn eth_pool(
|
||||||
validator: EthTransactionValidator<Client, PooledTransaction>,
|
validator: EthTransactionValidator<Client, EthPooledTransaction>,
|
||||||
config: PoolConfig,
|
config: PoolConfig,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self::new(validator, CoinbaseTipOrdering::default(), config)
|
Self::new(validator, CoinbaseTipOrdering::default(), config)
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error::PoolError, traits::PendingTransactionListenerKind, AllPoolTransactions,
|
error::PoolError, traits::PendingTransactionListenerKind, AllPoolTransactions,
|
||||||
AllTransactionsEvents, BestTransactions, BlockInfo, NewTransactionEvent, PoolResult, PoolSize,
|
AllTransactionsEvents, BestTransactions, BlockInfo, EthPooledTransaction, NewTransactionEvent,
|
||||||
PoolTransaction, PooledTransaction, PropagatedTransactions, TransactionEvents,
|
PoolResult, PoolSize, PoolTransaction, PropagatedTransactions, TransactionEvents,
|
||||||
TransactionOrigin, TransactionPool, TransactionValidationOutcome, TransactionValidator,
|
TransactionOrigin, TransactionPool, TransactionValidationOutcome, TransactionValidator,
|
||||||
ValidPoolTransaction,
|
ValidPoolTransaction,
|
||||||
};
|
};
|
||||||
@ -24,7 +24,7 @@ pub struct NoopTransactionPool;
|
|||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl TransactionPool for NoopTransactionPool {
|
impl TransactionPool for NoopTransactionPool {
|
||||||
type Transaction = PooledTransaction;
|
type Transaction = EthPooledTransaction;
|
||||||
|
|
||||||
fn pool_size(&self) -> PoolSize {
|
fn pool_size(&self) -> PoolSize {
|
||||||
Default::default()
|
Default::default()
|
||||||
@ -212,16 +212,16 @@ impl<T> Default for MockTransactionValidator<T> {
|
|||||||
#[derive(Debug, Clone, thiserror::Error)]
|
#[derive(Debug, Clone, thiserror::Error)]
|
||||||
#[error("Can't insert transaction into the noop pool that does nothing.")]
|
#[error("Can't insert transaction into the noop pool that does nothing.")]
|
||||||
pub struct NoopInsertError {
|
pub struct NoopInsertError {
|
||||||
tx: PooledTransaction,
|
tx: EthPooledTransaction,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NoopInsertError {
|
impl NoopInsertError {
|
||||||
fn new(tx: PooledTransaction) -> Self {
|
fn new(tx: EthPooledTransaction) -> Self {
|
||||||
Self { tx }
|
Self { tx }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the transaction that failed to be inserted.
|
/// Returns the transaction that failed to be inserted.
|
||||||
pub fn into_inner(self) -> PooledTransaction {
|
pub fn into_inner(self) -> EthPooledTransaction {
|
||||||
self.tx
|
self.tx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -565,12 +565,12 @@ pub trait PoolTransaction:
|
|||||||
fn chain_id(&self) -> Option<u64>;
|
fn chain_id(&self) -> Option<u64>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The default [PoolTransaction] for the [Pool](crate::Pool).
|
/// The default [PoolTransaction] for the [Pool](crate::Pool) for Ethereum.
|
||||||
///
|
///
|
||||||
/// This type is essentially a wrapper around [TransactionSignedEcRecovered] with additional fields
|
/// This type is essentially a wrapper around [TransactionSignedEcRecovered] with additional fields
|
||||||
/// derived from the transaction that are frequently used by the pools for ordering.
|
/// derived from the transaction that are frequently used by the pools for ordering.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct PooledTransaction {
|
pub struct EthPooledTransaction {
|
||||||
/// EcRecovered transaction info
|
/// EcRecovered transaction info
|
||||||
pub(crate) transaction: TransactionSignedEcRecovered,
|
pub(crate) transaction: TransactionSignedEcRecovered,
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ pub struct PooledTransaction {
|
|||||||
// TODO optional sidecar
|
// TODO optional sidecar
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PooledTransaction {
|
impl EthPooledTransaction {
|
||||||
/// Create new instance of [Self].
|
/// Create new instance of [Self].
|
||||||
pub fn new(transaction: TransactionSignedEcRecovered) -> Self {
|
pub fn new(transaction: TransactionSignedEcRecovered) -> Self {
|
||||||
let gas_cost = match &transaction.transaction {
|
let gas_cost = match &transaction.transaction {
|
||||||
@ -600,7 +600,7 @@ impl PooledTransaction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PoolTransaction for PooledTransaction {
|
impl PoolTransaction for EthPooledTransaction {
|
||||||
/// Returns hash of the transaction.
|
/// Returns hash of the transaction.
|
||||||
fn hash(&self) -> &TxHash {
|
fn hash(&self) -> &TxHash {
|
||||||
self.transaction.hash_ref()
|
self.transaction.hash_ref()
|
||||||
@ -696,13 +696,13 @@ impl PoolTransaction for PooledTransaction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromRecoveredTransaction for PooledTransaction {
|
impl FromRecoveredTransaction for EthPooledTransaction {
|
||||||
fn from_recovered_transaction(tx: TransactionSignedEcRecovered) -> Self {
|
fn from_recovered_transaction(tx: TransactionSignedEcRecovered) -> Self {
|
||||||
PooledTransaction::new(tx)
|
EthPooledTransaction::new(tx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IntoRecoveredTransaction for PooledTransaction {
|
impl IntoRecoveredTransaction for EthPooledTransaction {
|
||||||
fn to_recovered_transaction(&self) -> TransactionSignedEcRecovered {
|
fn to_recovered_transaction(&self) -> TransactionSignedEcRecovered {
|
||||||
self.transaction.clone()
|
self.transaction.clone()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
use reth_network::{config::rng_secret_key, NetworkConfig, NetworkManager};
|
use reth_network::{config::rng_secret_key, NetworkConfig, NetworkManager};
|
||||||
use reth_provider::test_utils::NoopProvider;
|
use reth_provider::test_utils::NoopProvider;
|
||||||
use reth_transaction_pool::{
|
use reth_transaction_pool::{
|
||||||
CoinbaseTipOrdering, PoolTransaction, PooledTransaction, TransactionOrigin, TransactionPool,
|
CoinbaseTipOrdering, EthPooledTransaction, PoolTransaction, TransactionOrigin, TransactionPool,
|
||||||
TransactionValidationOutcome, TransactionValidator,
|
TransactionValidationOutcome, TransactionValidator,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ struct OkValidator;
|
|||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl TransactionValidator for OkValidator {
|
impl TransactionValidator for OkValidator {
|
||||||
type Transaction = PooledTransaction;
|
type Transaction = EthPooledTransaction;
|
||||||
|
|
||||||
async fn validate_transaction(
|
async fn validate_transaction(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
Reference in New Issue
Block a user