reth/commands/debug_cmd/
mod.rs1use clap::{Parser, Subcommand};
4use reth_chainspec::ChainSpec;
5use reth_cli::chainspec::ChainSpecParser;
6use reth_cli_commands::common::CliNodeTypes;
7use reth_cli_runner::CliContext;
8use reth_node_ethereum::EthEngineTypes;
9
10mod build_block;
11mod execution;
12mod in_memory_merkle;
13mod merkle;
14mod replay_engine;
15
16#[derive(Debug, Parser)]
18pub struct Command<C: ChainSpecParser> {
19 #[command(subcommand)]
20 command: Subcommands<C>,
21}
22
23#[derive(Subcommand, Debug)]
25pub enum Subcommands<C: ChainSpecParser> {
26 Execution(execution::Command<C>),
28 Merkle(merkle::Command<C>),
30 InMemoryMerkle(in_memory_merkle::Command<C>),
32 BuildBlock(build_block::Command<C>),
34 ReplayEngine(replay_engine::Command<C>),
36}
37
38impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
39 pub async fn execute<N: CliNodeTypes<Engine = EthEngineTypes, ChainSpec = C::ChainSpec>>(
41 self,
42 ctx: CliContext,
43 ) -> eyre::Result<()> {
44 match self.command {
45 Subcommands::Execution(command) => command.execute::<N>(ctx).await,
46 Subcommands::Merkle(command) => command.execute::<N>(ctx).await,
47 Subcommands::InMemoryMerkle(command) => command.execute::<N>(ctx).await,
48 Subcommands::BuildBlock(command) => command.execute::<N>(ctx).await,
49 Subcommands::ReplayEngine(command) => command.execute::<N>(ctx).await,
50 }
51 }
52}