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, doc_auto_cfg))]
13
14#[global_allocator]
15static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::new_allocator();
16
17pub mod authenticated_transport;
18pub mod bench;
19pub mod bench_mode;
20pub mod valid_payload;
21
22use bench::BenchmarkCommand;
23use clap::Parser;
24use reth_cli_runner::CliRunner;
25
26fn main() {
27    // Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
28    if std::env::var_os("RUST_BACKTRACE").is_none() {
29        std::env::set_var("RUST_BACKTRACE", "1");
30    }
31
32    // Run until either exit or sigint or sigterm
33    let runner = CliRunner::try_default_runtime().unwrap();
34    runner
35        .run_command_until_exit(|ctx| {
36            let command = BenchmarkCommand::parse();
37            command.execute(ctx)
38        })
39        .unwrap();
40}