Skip to content

Commit

Permalink
Remove value parser for private key inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
malm0d authored and Vid201 committed Jun 15, 2024
1 parent 01a47bd commit e55ac50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
6 changes: 3 additions & 3 deletions bin/silius/src/cli/args.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::{
parse_address, parse_duration, parse_enr, parse_label_value, parse_send_bundle_mode,
parse_u256, parse_uopool_mode, validate_private_key,
parse_u256, parse_uopool_mode,
};
use alloy_chains::{Chain, NamedChain};
use clap::{ArgGroup, Parser, ValueEnum};
Expand Down Expand Up @@ -52,11 +52,11 @@ pub struct BundlerArgs {
pub mnemonic_file: Option<PathBuf>,

/// Private key for the wallet
#[clap(long, value_parser=validate_private_key, group = "account")]
#[clap(long, group = "account")]
pub private_key: Option<String>,

/// Flashbots private key
#[clap(long, value_parser=validate_private_key, conflicts_with = "mnemonic_file")]
#[clap(long, conflicts_with = "mnemonic_file")]
pub flashbots_private_key: Option<String>,

/// The bundler beneficiary address.
Expand Down
16 changes: 0 additions & 16 deletions bin/silius/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,3 @@ where

Ok(())
}

pub fn validate_private_key(hex_string: &str) -> Result<String, String> {
let chars = hex_string.chars();

if chars.clone().count() != 64 {
return Err(format!("{hex_string} is not a valid private key"));
}

for c in chars {
if !c.is_ascii_hexdigit() {
return Err(format!("{hex_string} is not a valid hexadecimal string"));
}
}

Ok(String::from(hex_string))
}

0 comments on commit e55ac50

Please sign in to comment.