From 0291e8c702c75d277ecb9bacc265b13580d58d3d Mon Sep 17 00:00:00 2001 From: Tyera Date: Wed, 22 Mar 2023 22:13:56 -0600 Subject: [PATCH] cli: require one or more authority params in `stake-authorized-checked` (#30863) * Require one or more authority params * Add auth list len check --- cli/src/stake.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cli/src/stake.rs b/cli/src/stake.rs index 4444c4462..0064f87e6 100644 --- a/cli/src/stake.rs +++ b/cli/src/stake.rs @@ -392,6 +392,7 @@ impl StakeSubCommands for App<'_, '_> { .value_name("KEYPAIR") .takes_value(true) .validator(is_valid_signer) + .required_unless("new_withdraw_authority") .help("New authorized staker") ) .arg( @@ -400,6 +401,7 @@ impl StakeSubCommands for App<'_, '_> { .value_name("KEYPAIR") .takes_value(true) .validator(is_valid_signer) + .required_unless("new_stake_authority") .help("New authorized withdrawer") ) .arg(stake_authority_arg()) @@ -948,6 +950,11 @@ pub fn parse_stake_authorize( default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?; let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name); + if new_authorizations.is_empty() { + return Err(CliError::BadParameter( + "New authorization list must include at least one authority".to_string(), + )); + } let new_authorizations = new_authorizations .into_iter() .map(