revm_wiring

Trait Transaction

pub trait Transaction {
    type TransactionError: TransactionError;
    type TransactionType: Into<TransactionType>;
    type AccessList: AccessListTrait;
    type Legacy: LegacyTx;
    type Eip2930: Eip2930Tx<AccessList = Self::AccessList>;
    type Eip1559: Eip1559Tx<AccessList = Self::AccessList>;
    type Eip4844: Eip4844Tx<AccessList = Self::AccessList>;
    type Eip7702: Eip7702Tx<AccessList = Self::AccessList>;

    // Required method
    fn tx_type(&self) -> Self::TransactionType;

    // Provided methods
    fn legacy(&self) -> &Self::Legacy { ... }
    fn eip2930(&self) -> &Self::Eip2930 { ... }
    fn eip1559(&self) -> &Self::Eip1559 { ... }
    fn eip4844(&self) -> &Self::Eip4844 { ... }
    fn eip7702(&self) -> &Self::Eip7702 { ... }
    fn common_fields(&self) -> &dyn CommonTxFields { ... }
    fn max_fee(&self) -> u128 { ... }
    fn effective_gas_price(&self, base_fee: Uint<256, 4>) -> Uint<256, 4> { ... }
    fn kind(&self) -> TxKind { ... }
    fn access_list(&self) -> Option<&Self::AccessList> { ... }
}
Expand description

Main Transaction trait that abstracts and specifies all transaction currently supported by Ethereum.

Access to any associated type is gaited behind tx_type function.

It can be extended to support new transaction types and only transaction types can be deprecated by not returning tx_type.

Required Associated Types§

type TransactionError: TransactionError

An error that occurs when validating a transaction.

type TransactionType: Into<TransactionType>

Transaction type.

type AccessList: AccessListTrait

Access list type.

type Legacy: LegacyTx

type Eip2930: Eip2930Tx<AccessList = Self::AccessList>

type Eip1559: Eip1559Tx<AccessList = Self::AccessList>

type Eip4844: Eip4844Tx<AccessList = Self::AccessList>

type Eip7702: Eip7702Tx<AccessList = Self::AccessList>

Required Methods§

fn tx_type(&self) -> Self::TransactionType

Transaction type. Depending on this field other functions should be called. If transaction is Legacy, then legacy() should be called.

Provided Methods§

fn legacy(&self) -> &Self::Legacy

Legacy transaction.

fn eip2930(&self) -> &Self::Eip2930

EIP-2930 transaction.

fn eip1559(&self) -> &Self::Eip1559

EIP-1559 transaction.

fn eip4844(&self) -> &Self::Eip4844

EIP-4844 transaction.

fn eip7702(&self) -> &Self::Eip7702

EIP-7702 transaction.

fn common_fields(&self) -> &dyn CommonTxFields

Common fields for all transactions.

fn max_fee(&self) -> u128

Maximum fee that can be paid for the transaction.

fn effective_gas_price(&self, base_fee: Uint<256, 4>) -> Uint<256, 4>

Effective gas price is gas price field for Legacy and Eip2930 transaction While for transactions after Eip1559 it is minimum of max_fee and base+max_priority_fee.

fn kind(&self) -> TxKind

Transaction kind.

fn access_list(&self) -> Option<&Self::AccessList>

Returns access list.

Implementors§