reth_primitives_traits/transaction/mod.rs
1//! Transaction abstraction
2//!
3//! This module provides traits for working with blockchain transactions:
4//! - [`Transaction`] - Basic transaction interface
5//! - [`signed::SignedTransaction`] - Transaction with signature and recovery methods
6//! - [`FullTransaction`] - Transaction with database encoding support
7//!
8//! # Transaction Recovery
9//!
10//! Transaction senders are not stored directly but recovered from signatures.
11//! Use `recover_signer` for post-EIP-2 transactions or `recover_signer_unchecked`
12//! for historical transactions.
13
14pub mod execute;
15pub mod signature;
16pub mod signed;
17
18pub mod error;
19pub mod recover;
20
21pub use alloy_consensus::transaction::{SignerRecoverable, TransactionInfo, TransactionMeta};
22
23use crate::{InMemorySize, MaybeCompact, MaybeSerde};
24use core::{fmt, hash::Hash};
25
26#[cfg(test)]
27mod access_list;
28
29/// Helper trait that unifies all behaviour required by transaction to support full node operations.
30pub trait FullTransaction: Transaction + MaybeCompact {}
31
32impl<T> FullTransaction for T where T: Transaction + MaybeCompact {}
33
34/// Abstraction of a transaction.
35pub trait Transaction:
36 Send
37 + Sync
38 + Unpin
39 + Clone
40 + fmt::Debug
41 + Eq
42 + PartialEq
43 + Hash
44 + alloy_consensus::Transaction
45 + InMemorySize
46 + MaybeSerde
47{
48}
49
50impl<T> Transaction for T where
51 T: Send
52 + Sync
53 + Unpin
54 + Clone
55 + fmt::Debug
56 + Eq
57 + PartialEq
58 + Hash
59 + alloy_consensus::Transaction
60 + InMemorySize
61 + MaybeSerde
62{
63}