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

fix(cli): Allow custom dev genesis file #13862

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
16 changes: 13 additions & 3 deletions crates/cli/commands/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Main node command for launching a node

use clap::{value_parser, Args, Parser};
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_chainspec::{Chain, EthChainSpec, EthereumHardforks};
use reth_cli::chainspec::ChainSpecParser;
use reth_cli_runner::CliContext;
use reth_cli_util::parse_socket_address;
Expand All @@ -17,6 +17,7 @@ use reth_node_core::{
version,
};
use std::{ffi::OsString, fmt, future::Future, net::SocketAddr, path::PathBuf, sync::Arc};
use tracing::warn;

/// Start the node
#[derive(Debug, Parser)]
Expand All @@ -36,7 +37,6 @@ pub struct NodeCommand<
value_name = "CHAIN_OR_PATH",
long_help = C::help_message(),
default_value = C::SUPPORTED_CHAINS[0],
default_value_if("dev", "true", "dev"),
value_parser = C::parser(),
required = false,
)]
Expand Down Expand Up @@ -151,7 +151,7 @@ impl<
let Self {
datadir,
config,
chain,
mut chain,
metrics,
instance,
with_unused_ports,
Expand All @@ -167,6 +167,16 @@ impl<
engine,
} = self;

if dev.dev && chain.chain() != Chain::dev() {
warn!(target: "reth::cli",
chain_id=%chain.chain().id(),
dev_chain_id=%Chain::dev().id(),
"Custom dev genesis file must still use dev chain id",
);

chain = C::parse("dev").expect("should parse standard dev config");
}

// set up node config
let mut node_config = NodeConfig {
datadir,
Expand Down
Loading