1//! clap [Args](clap::Args) for benchmark configuration
23use clap::Args;
4use std::path::PathBuf;
56/// Parameters for benchmark configuration
7#[derive(Debug, Args, PartialEq, Eq, Default, Clone)]
8#[command(next_help_heading = "Benchmark")]
9pub struct BenchmarkArgs {
10/// Run the benchmark from a specific block.
11#[arg(long, verbatim_doc_comment)]
12pub from: Option<u64>,
1314/// Run the benchmark to a specific block.
15#[arg(long, verbatim_doc_comment)]
16pub to: Option<u64>,
1718/// Path to a JWT secret to use for the authenticated engine-API RPC server.
19 ///
20 /// This will perform JWT authentication for all requests to the given engine RPC url.
21 ///
22 /// If no path is provided, a secret will be generated and stored in the datadir under
23 /// `<DIR>/<CHAIN_ID>/jwt.hex`. For mainnet this would be `~/.reth/mainnet/jwt.hex` by default.
24#[arg(long = "jwtsecret", value_name = "PATH", global = true, required = false)]
25pub auth_jwtsecret: Option<PathBuf>,
2627/// The RPC url to use for sending engine requests.
28#[arg(
29 long,
30 value_name = "ENGINE_RPC_URL",
31 verbatim_doc_comment,
32 default_value = "http://localhost:8551"
33)]
34pub engine_rpc_url: String,
3536/// The path to the output directory for granular benchmark results.
37#[arg(long, short, value_name = "BENCHMARK_OUTPUT", verbatim_doc_comment)]
38pub output: Option<PathBuf>,
39}
4041#[cfg(test)]
42mod tests {
43use super::*;
44use clap::Parser;
4546/// A helper type to parse Args more easily
47#[derive(Parser)]
48struct CommandParser<T: Args> {
49#[command(flatten)]
50args: T,
51 }
5253#[test]
54fn test_parse_benchmark_args() {
55let default_args = BenchmarkArgs {
56 engine_rpc_url: "http://localhost:8551".to_string(),
57 ..Default::default()
58 };
59let args = CommandParser::<BenchmarkArgs>::parse_from(["reth-bench"]).args;
60assert_eq!(args, default_args);
61 }
62}