diff --git a/bin/reth/src/commands/stage/unwind.rs b/bin/reth/src/commands/stage/unwind.rs index a1fe7d8a0..2682683d4 100644 --- a/bin/reth/src/commands/stage/unwind.rs +++ b/bin/reth/src/commands/stage/unwind.rs @@ -236,10 +236,12 @@ impl Command { /// `reth stage unwind` subcommand #[derive(Subcommand, Debug, Eq, PartialEq)] enum Subcommands { - /// Unwinds the database until the given block number (range is inclusive). + /// Unwinds the database from the latest block, until the given block number or hash has been + /// reached, that block is not included. #[command(name = "to-block")] ToBlock { target: BlockHashOrNumber }, - /// Unwinds the given number of blocks from the database. + /// Unwinds the database from the latest block, until the given number of blocks have been + /// reached. #[command(name = "num-blocks")] NumBlocks { amount: u64 }, } @@ -263,6 +265,9 @@ impl Subcommands { }, Subcommands::NumBlocks { amount } => last.saturating_sub(*amount), } + 1; + if target > last { + eyre::bail!("Target block number is higher than the latest block number") + } Ok(target..=last) } } diff --git a/crates/node-core/src/args/stage_args.rs b/crates/node-core/src/args/stage_args.rs index d90eabcfc..337f5a4a6 100644 --- a/crates/node-core/src/args/stage_args.rs +++ b/crates/node-core/src/args/stage_args.rs @@ -30,11 +30,11 @@ pub enum StageEnum { /// /// Manages operations related to hashing storage data. StorageHashing, - /// The hashing stage within the pipeline. + /// The account and storage hashing stages within the pipeline. /// /// Covers general data hashing operations. Hashing, - /// The Merkle stage within the pipeline. + /// The merkle stage within the pipeline. /// /// Handles Merkle tree-related computations and data processing. Merkle,