reth_bench/main.rs
1//! # reth-benchmark
2//!
3//! This is a tool that converts existing blocks into a stream of blocks for benchmarking purposes.
4//! These blocks are then fed into reth as a stream of execution payloads.
5
6#![doc(
7 html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
8 html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
9 issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
10)]
11#![cfg_attr(not(test), warn(unused_crate_dependencies))]
12#![cfg_attr(docsrs, feature(doc_cfg))]
13
14#[global_allocator]
15static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::new_allocator();
16
17#[cfg(all(feature = "jemalloc", unix))]
18use reth_cli_util::allocator::tikv_jemalloc_sys as _;
19
20pub mod authenticated_transport;
21pub mod bench;
22pub mod bench_mode;
23pub mod valid_payload;
24
25use bench::BenchmarkCommand;
26use clap::Parser;
27use reth_cli_runner::CliRunner;
28
29fn main() -> eyre::Result<()> {
30 // Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
31 if std::env::var_os("RUST_BACKTRACE").is_none() {
32 unsafe {
33 std::env::set_var("RUST_BACKTRACE", "1");
34 }
35 }
36
37 color_eyre::install()?;
38
39 // Run until either exit or sigint or sigterm
40 let runner = CliRunner::try_default_runtime()?;
41 runner.run_command_until_exit(|ctx| BenchmarkCommand::parse().execute(ctx))?;
42
43 Ok(())
44}