Skip to content

Commit

Permalink
v1.14: cli: require one or more authority params in `stake-authorized…
Browse files Browse the repository at this point in the history
…-checked` (backport of #30863) (#30865)

cli: require one or more authority params in `stake-authorized-checked` (#30863)

* Require one or more authority params

* Add auth list len check

(cherry picked from commit 0291e8c)

Co-authored-by: Tyera <[email protected]>
  • Loading branch information
mergify[bot] and CriesofCarrots authored Mar 23, 2023
1 parent f1ccc41 commit b29a37c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cli/src/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,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(
Expand All @@ -398,6 +399,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())
Expand Down Expand Up @@ -946,6 +948,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(
Expand Down

0 comments on commit b29a37c

Please sign in to comment.