1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
//! Rust Ethereum (reth) binary executable.
//!
//! ## Feature Flags
//!
//! - `jemalloc`: Uses [jemallocator](https://github.com/tikv/jemallocator) as the global allocator.
//!   This is **not recommended on Windows**. See [here](https://rust-lang.github.io/rfcs/1974-global-allocators.html#jemalloc)
//!   for more info.
//! - `jemalloc-prof`: Enables [jemallocator's](https://github.com/tikv/jemallocator) heap profiling
//!   and leak detection functionality. See [jemalloc's opt.prof](https://jemalloc.net/jemalloc.3.html#opt.prof)
//!   documentation for usage details. This is **not recommended on Windows**. See [here](https://rust-lang.github.io/rfcs/1974-global-allocators.html#jemalloc)
//!   for more info.
//! - `asm-keccak`: replaces the default, pure-Rust implementation of Keccak256 with one implemented
//!   in assembly; see [the `keccak-asm` crate](https://github.com/DaniPopes/keccak-asm) for more
//!   details and supported targets
//! - `min-error-logs`: Disables all logs below `error` level.
//! - `min-warn-logs`: Disables all logs below `warn` level.
//! - `min-info-logs`: Disables all logs below `info` level. This can speed up the node, since fewer
//!   calls to the logging component is made.
//! - `min-debug-logs`: Disables all logs below `debug` level.
//! - `min-trace-logs`: Disables all logs below `trace` level.
//! - `optimism`: Enables [OP-Stack](https://stack.optimism.io/) support for the node. Note that
//!   this breaks compatibility with the Ethereum mainnet as a new deposit transaction type is
//!   introduced as well as gas cost changes.

#![doc(
    html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
    html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
    issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod cli;
pub mod commands;
mod macros;

/// Re-exported utils.
pub mod utils {
    pub use reth_db::open_db_read_only;

    /// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment
    /// on the `reth_node_core::args` re-export for more details.
    pub use reth_node_core::utils::*;
}

/// Re-exported payload related types
pub mod payload {
    pub use reth_payload_builder::*;
    pub use reth_payload_primitives::*;
    pub use reth_payload_validator::ExecutionPayloadValidator;
}

/// Re-exported from `reth_node_api`.
pub mod api {
    pub use reth_node_api::*;
}

/// Re-exported from `reth_node_core`.
pub mod core {
    pub use reth_node_core::*;
}

/// Re-exported from `reth_node_core`.
pub mod prometheus_exporter {
    pub use reth_node_core::prometheus_exporter::*;
}

/// Re-export of the `reth_node_core` types specifically in the `args` module.
///
/// This is re-exported because the types in `reth_node_core::args` originally existed in
/// `reth::args` but were moved to the `reth_node_core` crate. This re-export avoids a breaking
/// change.
pub mod args {
    pub use reth_node_core::args::*;
}

/// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment on
/// the `reth_node_core::args` re-export for more details.
pub mod version {
    pub use reth_node_core::version::*;
}

/// Re-exported from `reth_node_builder`
pub mod builder {
    pub use reth_node_builder::*;
}

/// Re-exported from `reth_node_core`, also to prevent a breaking change. See the comment on
/// the `reth_node_core::args` re-export for more details.
pub mod dirs {
    pub use reth_node_core::dirs::*;
}

/// Re-exported from `reth_provider`.
pub mod providers {
    pub use reth_provider::*;
}

/// Re-exported from `reth_primitives`.
pub mod primitives {
    pub use reth_primitives::*;
}

/// Re-exported from `reth_beacon_consensus`.
pub mod beacon_consensus {
    pub use reth_beacon_consensus::*;
}
/// Re-exported from `reth_blockchain_tree`.
pub mod blockchain_tree {
    pub use reth_blockchain_tree::*;
}

/// Re-exported from `reth_consensus_common`.
pub mod consensus_common {
    pub use reth_consensus_common::*;
}

/// Re-exported from `reth_revm`.
pub mod revm {
    pub use reth_revm::*;
}

/// Re-exported from `reth_tasks`.
pub mod tasks {
    pub use reth_tasks::*;
}

/// Re-exported from `reth_network`.
pub mod network {
    pub use reth_network::*;
    pub use reth_network_api::{noop, reputation, NetworkInfo, PeerKind, Peers, PeersInfo};
}

/// Re-exported from `reth_transaction_pool`.
pub mod transaction_pool {
    pub use reth_transaction_pool::*;
}

/// Re-export of `reth_rpc_*` crates.
pub mod rpc {

    /// Re-exported from `reth_rpc_builder`.
    pub mod builder {
        pub use reth_rpc_builder::*;
    }

    /// Re-exported from `reth_rpc_types`.
    pub mod types {
        pub use reth_rpc_types::*;
    }

    /// Re-exported from `reth_rpc_server_types`.
    pub mod server_types {
        pub use reth_rpc_server_types::*;
        /// Re-exported from `reth_rpc_eth_types`.
        pub mod eth {
            pub use reth_rpc_eth_types::*;
        }
    }

    /// Re-exported from `reth_rpc_api`.
    pub mod api {
        pub use reth_rpc_api::*;
    }
    /// Re-exported from `reth_rpc::eth`.
    pub mod eth {
        pub use reth_rpc::eth::*;
    }

    /// Re-exported from `reth_rpc::rpc`.
    pub mod result {
        pub use reth_rpc_server_types::result::*;
    }

    /// Re-exported from `reth_rpc_types_compat`.
    pub mod compat {
        pub use reth_rpc_types_compat::*;
    }
}

// re-export for convenience
#[doc(inline)]
pub use reth_cli_runner::{tokio_runtime, CliContext, CliRunner};

#[cfg(all(unix, any(target_env = "gnu", target_os = "macos")))]
pub mod sigsegv_handler;

/// Signal handler to extract a backtrace from stack overflow.
///
/// This is a no-op because this platform doesn't support our signal handler's requirements.
#[cfg(not(all(unix, any(target_env = "gnu", target_os = "macos"))))]
pub mod sigsegv_handler {
    /// No-op function.
    pub fn install() {}
}

#[cfg(all(feature = "jemalloc", unix))]
use tikv_jemallocator as _;

// for rendering diagrams
use aquamarine as _;