Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): enable witness invalid block hook by default #10839

Merged
merged 5 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ Debug:

Example: `witness,prestate`

[default: witness]
[possible values: witness, pre-state, opcode]

Database:
Expand Down
33 changes: 31 additions & 2 deletions crates/node/core/src/args/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{collections::HashSet, ffi::OsStr, fmt, path::PathBuf, str::FromStr};
use strum::{AsRefStr, EnumIter, IntoStaticStr, ParseError, VariantArray, VariantNames};

/// Parameters for debugging purposes
#[derive(Debug, Clone, Args, PartialEq, Eq, Default)]
#[derive(Debug, Clone, Args, PartialEq, Eq)]
#[command(next_help_heading = "Debug")]
pub struct DebugArgs {
/// Flag indicating whether the node should be terminated after the pipeline sync.
Expand Down Expand Up @@ -71,10 +71,33 @@ pub struct DebugArgs {
/// Determines which type of bad block hook to install
///
/// Example: `witness,prestate`
#[arg(long = "debug.invalid-block-hook", help_heading = "Debug", value_parser = InvalidBlockSelectionValueParser::default())]
#[arg(
long = "debug.invalid-block-hook",
help_heading = "Debug",
value_parser = InvalidBlockSelectionValueParser::default(),
default_value = "witness"
)]
pub invalid_block_hook: Option<InvalidBlockSelection>,
}

impl Default for DebugArgs {
fn default() -> Self {
Self {
terminate: false,
tip: None,
max_block: None,
etherscan: None,
rpc_consensus_ws: None,
skip_fcu: None,
skip_new_payload: None,
reorg_frequency: None,
reorg_depth: None,
engine_api_store: None,
invalid_block_hook: Some(InvalidBlockSelection::default()),
}
}
}

/// Describes the invalid block hooks that should be installed.
///
/// # Example
Expand All @@ -88,6 +111,12 @@ pub struct DebugArgs {
#[derive(Debug, Clone, PartialEq, Eq, derive_more::Deref)]
pub struct InvalidBlockSelection(HashSet<InvalidBlockHook>);

impl Default for InvalidBlockSelection {
fn default() -> Self {
Self([InvalidBlockHook::Witness].into())
}
}

impl InvalidBlockSelection {
/// Creates a new _unique_ [`InvalidBlockSelection`] from the given items.
///
Expand Down
Loading