Skip to content

Commit

Permalink
fix: optional threshold & num_key > threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
phy-chain committed Mar 1, 2024
1 parent 46023b8 commit 320f222
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crates/apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4156,7 +4156,7 @@ pub mod args {
let public_keys = PUBLIC_KEYS.parse(matches);
let threshold = THRESHOLD.parse(matches);

if threshold <= Some(0) {
if threshold == Some(0) {
eprintln!("Threshold must be higher than 0.");
std::process::exit(1);
}
Expand Down Expand Up @@ -4373,7 +4373,7 @@ pub mod args {
PathBuf::from(TX_BECOME_VALIDATOR_WASM);
let threshold = THRESHOLD.parse(matches);

if threshold <= Some(0) {
if threshold == Some(0) {
eprintln!("Threshold must be higher than 0.");
std::process::exit(1);
}
Expand Down Expand Up @@ -4492,10 +4492,17 @@ pub mod args {
let public_keys = PUBLIC_KEYS.parse(matches);
let threshold = THRESHOLD.parse(matches);

if threshold <= Some(0) {
if threshold == Some(0) {
eprintln!("Threshold must be higher than 0.");
std::process::exit(1);
}
let num_keys = public_keys.len() as u8;
if let Some(threshold) = threshold {
if (num_keys >= 1) && (num_keys < threshold) {
eprintln!("Threshold must be less than the number of public keys provided.");
std::process::exit(1);
}
}

Self {
tx,
Expand Down

0 comments on commit 320f222

Please sign in to comment.