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//! - `jemalloc-unprefixed`: Uses unprefixed jemalloc symbols.
26//! - `tracy-allocator`: Enables [Tracy](https://github.com/wolfpld/tracy) profiler allocator
27//!   integration for memory profiling.
28//! - `snmalloc`: Uses [snmalloc](https://github.com/microsoft/snmalloc) as the global allocator.
29//!   Use `--no-default-features` when enabling this, as jemalloc takes precedence.
30//! - `snmalloc-native`: Uses snmalloc with native CPU optimizations. Use `--no-default-features`
31//!   when enabling this.
32//!
33//! ### Log Level Features
34//!
35//! - `min-error-logs`: Disables all logs below `error` level.
36//! - `min-warn-logs`: Disables all logs below `warn` level.
37//! - `min-info-logs`: Disables all logs below `info` level. This can speed up the node, since fewer
38//!   calls to the logging component are made.
39//! - `min-debug-logs`: Disables all logs below `debug` level.
40//! - `min-trace-logs`: Disables all logs below `trace` level.
41//!
42//! ### Development Features
43//!
44//! - `dev`: Enables development mode features, including test vector generation commands.
45
46#![doc(
47    html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
48    html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
49    issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
50)]
51#![cfg_attr(not(test), warn(unused_crate_dependencies))]
52#![cfg_attr(docsrs, feature(doc_cfg))]
53
54// Used in feature flags only (`asm-keccak`, `keccak-cache-global`)
55use alloy_primitives as _;
56
57pub mod cli;
58
59/// Re-exported utils.
60pub mod utils {
61    pub use reth_db::open_db_read_only;
62
63    /// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment
64    /// on the `reth_node_core::args` re-export for more details.
65    pub use reth_node_core::utils::*;
66}
67
68/// Re-exported payload related types
69pub mod payload {
70    pub use reth_ethereum_payload_builder::EthereumExecutionPayloadValidator;
71    pub use reth_payload_builder::*;
72    pub use reth_payload_primitives::*;
73}
74
75/// Re-exported from `reth_node_api`.
76pub mod api {
77    pub use reth_node_api::*;
78}
79
80/// Re-exported from `reth_node_core`.
81pub mod core {
82    pub use reth_node_core::*;
83}
84
85/// Re-exported from `reth_node_metrics`.
86pub mod prometheus_exporter {
87    pub use reth_node_metrics::recorder::*;
88}
89
90/// Re-export of the `reth_node_core` types specifically in the `args` module.
91///
92/// This is re-exported because the types in `reth_node_core::args` originally existed in
93/// `reth::args` but were moved to the `reth_node_core` crate. This re-export avoids a breaking
94/// change.
95pub mod args {
96    pub use reth_node_core::args::*;
97}
98
99/// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment on
100/// the `reth_node_core::args` re-export for more details.
101pub mod version {
102    pub use reth_node_core::version::*;
103}
104
105/// Re-exported from `reth_node_builder`
106pub mod builder {
107    pub use reth_node_builder::*;
108}
109
110/// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment on
111/// the `reth_node_core::args` re-export for more details.
112pub mod dirs {
113    pub use reth_node_core::dirs::*;
114}
115
116/// Re-exported from `reth_chainspec`
117pub mod chainspec {
118    pub use reth_chainspec::*;
119    pub use reth_ethereum_cli::chainspec::*;
120}
121
122/// Re-exported from `reth_provider`.
123pub mod providers {
124    pub use reth_provider::*;
125}
126
127/// Re-exported from `reth_primitives`.
128pub mod primitives {
129    pub use reth_primitives::*;
130}
131
132/// Re-exported from `reth_ethereum_consensus`.
133pub mod beacon_consensus {
134    pub use reth_node_ethereum::consensus::*;
135}
136
137/// Re-exported from `reth_consensus`.
138pub mod consensus {
139    pub use reth_consensus::*;
140}
141
142/// Re-exported from `reth_consensus_common`.
143pub mod consensus_common {
144    pub use reth_consensus_common::*;
145}
146
147/// Re-exported from `reth_revm`.
148pub mod revm {
149    pub use reth_revm::*;
150}
151
152/// Re-exported from `reth_tasks`.
153pub mod tasks {
154    pub use reth_tasks::*;
155}
156
157/// Re-exported from `reth_network`.
158pub mod network {
159    pub use reth_network::*;
160    pub use reth_network_api::{
161        noop, test_utils::PeersHandleProvider, NetworkInfo, Peers, PeersInfo,
162    };
163}
164
165/// Re-exported from `reth_transaction_pool`.
166pub mod transaction_pool {
167    pub use reth_transaction_pool::*;
168}
169
170/// Re-export of `reth_rpc_*` crates.
171pub mod rpc {
172    /// Re-exported from `reth_rpc_builder`.
173    pub mod builder {
174        pub use reth_rpc_builder::*;
175    }
176
177    /// Re-exported from `alloy_rpc_types`.
178    pub mod types {
179        pub use alloy_rpc_types::*;
180    }
181
182    /// Re-exported from `reth_rpc_server_types`.
183    pub mod server_types {
184        pub use reth_rpc_server_types::*;
185        /// Re-exported from `reth_rpc_eth_types`.
186        pub mod eth {
187            pub use reth_rpc_eth_types::*;
188        }
189    }
190
191    /// Re-exported from `reth_rpc_api`.
192    pub mod api {
193        pub use reth_rpc_api::*;
194    }
195    /// Re-exported from `reth_rpc::eth`.
196    pub mod eth {
197        pub use reth_rpc::eth::*;
198    }
199
200    /// Re-exported from `reth_rpc_server_types::result`.
201    pub mod result {
202        pub use reth_rpc_server_types::result::*;
203    }
204
205    /// Re-exported from `reth_rpc_convert`.
206    pub mod compat {
207        pub use reth_rpc_convert::*;
208    }
209}
210
211// re-export for convenience
212#[doc(inline)]
213pub use reth_cli_runner::{CliContext, CliRunner};
214
215// for rendering diagrams
216use aquamarine as _;
217
218// used in main
219use clap as _;
220use reth_cli_util as _;
221use tracing as _;