reth_rpc_eth_api/helpers/mod.rs
1//! Behaviour needed to serve `eth_` RPC requests, divided into general database reads and
2//! specific database access.
3//!
4//! Traits with `Load` prefix, read atomic data from database, e.g. a block or transaction. Any
5//! database read done in more than one default `Eth` trait implementation, is defined in a `Load`
6//! trait.
7//!
8//! Traits with `Eth` prefix, compose specific data needed to serve RPC requests in the `eth`
9//! namespace. They use `Load` traits as building blocks. [`EthTransactions`] also writes data
10//! (submits transactions). Based on the `eth_` request method semantics, request methods are
11//! divided into: [`EthTransactions`], [`EthBlocks`], [`EthFees`], [`EthState`] and [`EthCall`].
12//! Default implementation of the `Eth` traits, is done w.r.t. L1.
13//!
14//! [`EthApiServer`](crate::EthApiServer), is implemented for any type that implements
15//! all the `Eth` traits, e.g. `reth_rpc::EthApi`.
16
17pub mod bal;
18pub mod block;
19pub mod blocking_task;
20pub mod call;
21pub mod config;
22pub mod estimate;
23pub mod fee;
24pub mod pending_block;
25pub mod receipt;
26pub mod signer;
27pub mod spec;
28pub mod state;
29pub mod trace;
30pub mod transaction;
31
32pub use bal::GetBlockAccessList;
33pub use block::{EthBlocks, LoadBlock};
34pub use blocking_task::SpawnBlocking;
35pub use call::{Call, EthCall};
36pub use fee::{EthFees, LoadFee};
37pub use pending_block::LoadPendingBlock;
38pub use receipt::LoadReceipt;
39pub use signer::EthSigner;
40pub use spec::EthApiSpec;
41pub use state::{EthState, LoadState};
42pub use trace::Trace;
43pub use transaction::{EthTransactions, LoadTransaction};
44
45use crate::FullEthApiTypes;
46
47/// Extension trait that bundles traits needed for tracing transactions.
48pub trait TraceExt:
49 LoadTransaction + LoadBlock + SpawnBlocking + Trace + Call + GetBlockAccessList
50{
51}
52
53impl<T> TraceExt for T where T: LoadTransaction + LoadBlock + Trace + Call + GetBlockAccessList {}
54
55/// Helper trait to unify all `eth` rpc server building block traits, for simplicity.
56///
57/// This trait is automatically implemented for any type that implements all the `Eth` traits.
58pub trait FullEthApi:
59 FullEthApiTypes
60 + EthApiSpec
61 + EthTransactions
62 + EthBlocks
63 + EthState
64 + EthCall
65 + EthFees
66 + Trace
67 + LoadReceipt
68 + GetBlockAccessList
69{
70}
71
72impl<T> FullEthApi for T where
73 T: FullEthApiTypes
74 + EthApiSpec
75 + EthTransactions
76 + EthBlocks
77 + EthState
78 + EthCall
79 + EthFees
80 + Trace
81 + LoadReceipt
82 + GetBlockAccessList
83{
84}