diff --git a/account_manager/src/wallet/create.rs b/account_manager/src/wallet/create.rs index deab21b96f7..e90bb61fcdb 100644 --- a/account_manager/src/wallet/create.rs +++ b/account_manager/src/wallet/create.rs @@ -92,17 +92,29 @@ pub fn cli_app() -> Command { .value_name("MNEMONIC_LENGTH") .help("The number of words to use for the mnemonic phrase.") .action(ArgAction::Set) - // TODO - // .value_parser(|len: &str| { - // match len.parse::().ok().and_then(|words| MnemonicType::for_word_count(words).ok()) { - // Some(_) => Ok(()), - // None => Err(format!("Mnemonic length must be one of {}", MNEMONIC_TYPES.iter().map(|t| t.word_count().to_string()).collect::>().join(", "))), - // } - // }) + .value_parser(check_mnemonic_length) .default_value("24"), ) } +fn check_mnemonic_length(len: &str) -> Result { + match len + .parse::() + .ok() + .and_then(|words| MnemonicType::for_word_count(words).ok()) + { + Some(_) => Ok(len.to_string()), + None => Err(format!( + "Mnemonic length must be one of {}", + MNEMONIC_TYPES + .iter() + .map(|t| t.word_count().to_string()) + .collect::>() + .join(", ") + )), + } +} + pub fn cli_run(matches: &ArgMatches, wallet_base_dir: PathBuf) -> Result<(), String> { let mnemonic_output_path: Option = clap_utils::parse_optional(matches, MNEMONIC_FLAG)?; diff --git a/beacon_node/src/config.rs b/beacon_node/src/config.rs index fd94d54c3fa..6711a780cb9 100644 --- a/beacon_node/src/config.rs +++ b/beacon_node/src/config.rs @@ -797,8 +797,7 @@ pub fn get_config( client_config.chain.fork_choice_before_proposal_timeout_ms = timeout; } - client_config.chain.always_reset_payload_statuses = - cli_args.get_flag("reset-payload-statuses"); + client_config.chain.always_reset_payload_statuses = cli_args.get_flag("reset-payload-statuses"); client_config.chain.paranoid_block_proposal = cli_args.get_flag("paranoid-block-proposal"); @@ -959,7 +958,6 @@ pub fn parse_listening_addresses( format!("Failed to parse --quic6-port as an integer: {parse_error}") })?; - // Now put everything together let listening_addresses = match (maybe_ipv4, maybe_ipv6) { (None, None) => { @@ -1057,7 +1055,6 @@ pub fn parse_listening_addresses( ipv4_tcp_port + 1 }); - // Defaults to 9090 when required let ipv6_tcp_port = use_zero_ports .then(unused_port::unused_tcp6_port) @@ -1428,7 +1425,7 @@ pub fn set_network_config( if config_str.as_str() == "disabled" { None } else { - Some(config_str.parse()?) + Some(config_str.parse()?) } // Enabled with a custom configuration // Some(config_str.parse()?) diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index 1ddb233b216..3e1bb1c9da0 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -28,7 +28,7 @@ lazy_static! { Allocator: {}\n\ Profile: {}\n\ Specs: mainnet (true), minimal ({}), gnosis ({})", - SHORT_VERSION.as_str(), + SHORT_VERSION.as_str(), bls_library_name(), have_sha_extensions(), allocator_name(), diff --git a/testing/simulator/src/eth1_sim.rs b/testing/simulator/src/eth1_sim.rs index 3db3e39d944..1c2df14ef2d 100644 --- a/testing/simulator/src/eth1_sim.rs +++ b/testing/simulator/src/eth1_sim.rs @@ -32,9 +32,7 @@ pub fn run_eth1_sim(matches: &ArgMatches) -> Result<(), String> { let node_count = *matches .get_one::("nodes") .expect("missing nodes default"); - let proposer_nodes = *matches - .get_one::("proposer-nodes") - .unwrap_or(&0); + let proposer_nodes = *matches.get_one::("proposer-nodes").unwrap_or(&0); println!("PROPOSER-NODES: {}", proposer_nodes); let validators_per_node = *matches .get_one::("validators_per_node") diff --git a/validator_client/src/config.rs b/validator_client/src/config.rs index 66399371dd5..3c602da9030 100644 --- a/validator_client/src/config.rs +++ b/validator_client/src/config.rs @@ -408,7 +408,8 @@ impl Config { config.builder_boost_factor = parse_optional(cli_args, "builder-boost-factor")?; - config.enable_latency_measurement_service = cli_args.get_flag("latency-measurement-service"); + config.enable_latency_measurement_service = + cli_args.get_flag("latency-measurement-service"); config.validator_registration_batch_size = parse_required(cli_args, "validator-registration-batch-size")?; diff --git a/validator_manager/src/create_validators.rs b/validator_manager/src/create_validators.rs index b11099e8133..5ef9646aa45 100644 --- a/validator_manager/src/create_validators.rs +++ b/validator_manager/src/create_validators.rs @@ -106,7 +106,7 @@ pub fn cli_app() -> Command { Using this flag will save several seconds per validator if the \ user has an alternate strategy for submitting deposits.", ) - .action(ArgAction::SetTrue) + .action(ArgAction::SetTrue), ) .arg( Arg::new(SPECIFY_VOTING_KEYSTORE_PASSWORD_FLAG) @@ -118,7 +118,7 @@ pub fn cli_app() -> Command { necessary to keep backups of voting keystore passwords if the \ mnemonic is safely backed up.", ) - .action(ArgAction::SetTrue) + .action(ArgAction::SetTrue), ) .arg( Arg::new(ETH1_WITHDRAWAL_ADDRESS_FLAG) @@ -217,7 +217,7 @@ pub fn cli_app() -> Command { .hide(true) .help("Dumps the config to a desired location. Used for testing only.") .action(ArgAction::Set) - .global(true) + .global(true), ) }