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 subscriptions;
30pub mod trace;
31pub mod transaction;
32
33pub use bal::GetBlockAccessList;
34pub use block::{EthBlocks, LoadBlock};
35pub use blocking_task::SpawnBlocking;
36pub use call::{Call, EthCall};
37pub use fee::{EthFees, LoadFee};
38pub use pending_block::LoadPendingBlock;
39pub use receipt::LoadReceipt;
40pub use signer::EthSigner;
41pub use spec::EthApiSpec;
42pub use state::{EthState, LoadState};
43pub use subscriptions::EthSubscriptions;
44pub use trace::Trace;
45pub use transaction::{EthTransactions, LoadTransaction};
46
47/// Extension trait that bundles traits needed for tracing transactions.
48pub trait TraceExt: LoadTransaction + GetBlockAccessList {}
49
50impl<T> TraceExt for T where T: LoadTransaction + GetBlockAccessList {}
51
52/// Helper trait to unify all `eth` rpc server building block traits, for simplicity.
53///
54/// This trait is automatically implemented for any type that implements all the `Eth` traits.
55pub trait FullEthApi:
56 EthApiSpec
57 + EthTransactions
58 + EthBlocks
59 + EthState
60 + EthCall
61 + EthFees
62 + EthSubscriptions
63 + LoadReceipt
64 + GetBlockAccessList
65{
66}
67
68impl<T> FullEthApi for T where
69 T: EthApiSpec
70 + EthTransactions
71 + EthBlocks
72 + EthState
73 + EthCall
74 + EthFees
75 + EthSubscriptions
76 + LoadReceipt
77 + GetBlockAccessList
78{
79}