Skip to main content

reth/
lib.rs

1//! Rust Ethereum (reth) binary executable.
2//!
3//! ## Feature Flags
4//!
5//! ### Default Features
6//!
7//! - `jemalloc`: Uses [jemallocator](https://github.com/tikv/jemallocator) as the global allocator.
8//!   This is **not recommended on Windows**. See [here](https://rust-lang.github.io/rfcs/1974-global-allocators.html#jemalloc)
9//!   for more info.
10//! - `otlp`: Enables [OpenTelemetry](https://opentelemetry.io/) metrics export to a configured OTLP
11//!   collector endpoint.
12//! - `js-tracer`: Enables the `JavaScript` tracer for the `debug_trace` endpoints, allowing custom
13//!   `JavaScript`-based transaction tracing.
14//! - `keccak-cache-global`: Enables global caching for Keccak256 hashes to improve performance.
15//! - `asm-keccak`: Replaces the default, pure-Rust implementation of Keccak256 with one implemented
16//!   in assembly; see [the `keccak-asm` crate](https://github.com/DaniPopes/keccak-asm) for more
17//!   details and supported targets.
18//!
19//! ### Allocator Features
20//!
21//! - `jemalloc-prof`: Enables [jemallocator's](https://github.com/tikv/jemallocator) heap profiling
22//!   and leak detection functionality. See [jemalloc's opt.prof](https://jemalloc.net/jemalloc.3.html#opt.prof)
23//!   documentation for usage details. This is **not recommended on Windows**.
24//! - `jemalloc-symbols`: Enables jemalloc symbols for profiling. Includes `jemalloc-prof`.
25//! - `tracy-allocator`: Enables [Tracy](https://github.com/wolfpld/tracy) profiler allocator
26//!   integration for memory profiling.
27//! - `snmalloc`: Uses [snmalloc](https://github.com/microsoft/snmalloc) as the global allocator.
28//!   Use `--no-default-features` when enabling this, as jemalloc takes precedence.
29//! - `snmalloc-native`: Uses snmalloc with native CPU optimizations. Use `--no-default-features`
30//!   when enabling this.
31//!
32//! ### Log Level Features
33//!
34//! - `min-error-logs`: Disables all logs below `error` level.
35//! - `min-warn-logs`: Disables all logs below `warn` level.
36//! - `min-info-logs`: Disables all logs below `info` level. This can speed up the node, since fewer
37//!   calls to the logging component are made.
38//! - `min-debug-logs`: Disables all logs below `debug` level.
39//! - `min-trace-logs`: Disables all logs below `trace` level.
40//!
41//! ### Development Features
42//!
43//! - `dev`: Enables development mode features, including test vector generation commands.
44
45#![doc(
46    html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
47    html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
48    issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
49)]
50#![cfg_attr(not(test), warn(unused_crate_dependencies))]
51#![cfg_attr(docsrs, feature(doc_cfg))]
52
53// Used in feature flags only (`asm-keccak`, `keccak-cache-global`)
54use alloy_primitives as _;
55
56pub mod cli;
57
58/// Re-exported utils.
59pub mod utils {
60    pub use reth_db::open_db_read_only;
61
62    /// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment
63    /// on the `reth_node_core::args` re-export for more details.
64    pub use reth_node_core::utils::*;
65}
66
67/// Re-exported payload related types
68pub mod payload {
69    pub use reth_ethereum_payload_builder::EthereumExecutionPayloadValidator;
70    pub use reth_payload_builder::*;
71    pub use reth_payload_primitives::*;
72}
73
74/// Re-exported from `reth_node_api`.
75pub mod api {
76    pub use reth_node_api::*;
77}
78
79/// Re-exported from `reth_node_core`.
80pub mod core {
81    pub use reth_node_core::*;
82}
83
84/// Re-exported from `reth_node_metrics`.
85pub mod prometheus_exporter {
86    pub use reth_node_metrics::recorder::*;
87}
88
89/// Re-export of the `reth_node_core` types specifically in the `args` module.
90///
91/// This is re-exported because the types in `reth_node_core::args` originally existed in
92/// `reth::args` but were moved to the `reth_node_core` crate. This re-export avoids a breaking
93/// change.
94pub mod args {
95    pub use reth_node_core::args::*;
96}
97
98/// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment on
99/// the `reth_node_core::args` re-export for more details.
100pub mod version {
101    pub use reth_node_core::version::*;
102}
103
104/// Re-exported from `reth_node_builder`
105pub mod builder {
106    pub use reth_node_builder::*;
107}
108
109/// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment on
110/// the `reth_node_core::args` re-export for more details.
111pub mod dirs {
112    pub use reth_node_core::dirs::*;
113}
114
115/// Re-exported from `reth_chainspec`
116pub mod chainspec {
117    pub use reth_chainspec::*;
118    pub use reth_ethereum_cli::chainspec::*;
119}
120
121/// Re-exported from `reth_provider`.
122pub mod providers {
123    pub use reth_provider::*;
124}
125
126/// Re-exported primitives.
127#[allow(ambiguous_glob_reexports)]
128pub mod primitives {
129    pub use reth_ethereum_primitives::*;
130    pub use reth_primitives_traits::*;
131}
132
133/// Re-exported from `reth_ethereum_consensus`.
134pub mod beacon_consensus {
135    pub use reth_node_ethereum::consensus::*;
136}
137
138/// Re-exported from `reth_consensus`.
139pub mod consensus {
140    pub use reth_consensus::*;
141}
142
143/// Re-exported from `reth_consensus_common`.
144pub mod consensus_common {
145    pub use reth_consensus_common::*;
146}
147
148/// Re-exported from `reth_tasks`.
149pub mod tasks {
150    pub use reth_tasks::*;
151}
152
153/// Re-exported from `reth_network`.
154pub mod network {
155    pub use reth_network::*;
156    pub use reth_network_api::{
157        noop, test_utils::PeersHandleProvider, NetworkInfo, Peers, PeersInfo,
158    };
159}
160
161/// Re-exported from `reth_transaction_pool`.
162pub mod transaction_pool {
163    pub use reth_transaction_pool::*;
164}
165
166/// Re-export of `reth_rpc_*` crates.
167pub mod rpc {
168    /// Re-exported from `reth_rpc_builder`.
169    pub mod builder {
170        pub use reth_rpc_builder::*;
171    }
172
173    /// Re-exported from `alloy_rpc_types`.
174    pub mod types {
175        pub use alloy_rpc_types::*;
176    }
177
178    /// Re-exported from `reth_rpc_server_types`.
179    pub mod server_types {
180        pub use reth_rpc_server_types::*;
181        /// Re-exported from `reth_rpc_eth_types`.
182        pub mod eth {
183            pub use reth_rpc_eth_types::*;
184        }
185    }
186
187    /// Re-exported from `reth_rpc_api`.
188    pub mod api {
189        pub use reth_rpc_api::*;
190    }
191    /// Re-exported from `reth_rpc::eth`.
192    pub mod eth {
193        pub use reth_rpc::eth::*;
194    }
195
196    /// Re-exported from `reth_rpc_server_types::result`.
197    pub mod result {
198        pub use reth_rpc_server_types::result::*;
199    }
200
201    /// Re-exported from `reth_rpc_convert`.
202    pub mod compat {
203        pub use reth_rpc_convert::*;
204    }
205}
206
207// re-export for convenience
208#[doc(inline)]
209pub use reth_cli_runner::{CliContext, CliRunner};
210
211// for rendering diagrams
212use aquamarine as _;
213
214// used in main
215use clap as _;
216use reth_cli_util as _;
217use tracing as _;