anvil::eth::backend::validate

Trait TransactionValidator

Source
pub trait TransactionValidator {
    // Required methods
    fn validate_pool_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 PendingTransaction,
    ) -> Pin<Box<dyn Future<Output = Result<(), BlockchainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn validate_pool_transaction_for(
        &self,
        tx: &PendingTransaction,
        account: &AccountInfo,
        env: &EnvWithHandlerCfg,
    ) -> Result<(), InvalidTransactionError>;
    fn validate_for(
        &self,
        tx: &PendingTransaction,
        account: &AccountInfo,
        env: &EnvWithHandlerCfg,
    ) -> Result<(), InvalidTransactionError>;
}
Expand description

A trait for validating transactions

Required Methods§

Source

fn validate_pool_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 PendingTransaction, ) -> Pin<Box<dyn Future<Output = Result<(), BlockchainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validates the transaction’s validity when it comes to nonce, payment

This is intended to be checked before the transaction makes it into the pool and whether it should rather be outright rejected if the sender has insufficient funds.

Source

fn validate_pool_transaction_for( &self, tx: &PendingTransaction, account: &AccountInfo, env: &EnvWithHandlerCfg, ) -> Result<(), InvalidTransactionError>

Validates the transaction against a specific account before entering the pool

Source

fn validate_for( &self, tx: &PendingTransaction, account: &AccountInfo, env: &EnvWithHandlerCfg, ) -> Result<(), InvalidTransactionError>

Validates the transaction against a specific account

This should succeed if the transaction is ready to be executed

Implementors§