reth/commands/debug_cmd/
mod.rs
1use 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_ethereum_primitives::EthPrimitives;
9use reth_node_ethereum::EthEngineTypes;
10
11mod build_block;
12mod execution;
13mod in_memory_merkle;
14mod merkle;
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}
35
36impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
37 pub async fn execute<
39 N: CliNodeTypes<Engine = EthEngineTypes, Primitives = EthPrimitives, ChainSpec = C::ChainSpec>,
40 >(
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 }
50 }
51}