CLI: Fix explicitly plumb withdraw_authority through vote-update-validator
(cherry picked from commit 2284699889
)
This commit is contained in:
committed by
Trent Nelson
parent
6666e54a1f
commit
006a5c5c88
@ -407,6 +407,7 @@ pub enum CliCommand {
|
|||||||
VoteUpdateValidator {
|
VoteUpdateValidator {
|
||||||
vote_account_pubkey: Pubkey,
|
vote_account_pubkey: Pubkey,
|
||||||
new_identity_account: SignerIndex,
|
new_identity_account: SignerIndex,
|
||||||
|
withdraw_authority: SignerIndex,
|
||||||
},
|
},
|
||||||
VoteUpdateCommission {
|
VoteUpdateCommission {
|
||||||
vote_account_pubkey: Pubkey,
|
vote_account_pubkey: Pubkey,
|
||||||
@ -2219,11 +2220,13 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
|
|||||||
CliCommand::VoteUpdateValidator {
|
CliCommand::VoteUpdateValidator {
|
||||||
vote_account_pubkey,
|
vote_account_pubkey,
|
||||||
new_identity_account,
|
new_identity_account,
|
||||||
|
withdraw_authority,
|
||||||
} => process_vote_update_validator(
|
} => process_vote_update_validator(
|
||||||
&rpc_client,
|
&rpc_client,
|
||||||
config,
|
config,
|
||||||
&vote_account_pubkey,
|
&vote_account_pubkey,
|
||||||
*new_identity_account,
|
*new_identity_account,
|
||||||
|
*withdraw_authority,
|
||||||
),
|
),
|
||||||
CliCommand::VoteUpdateCommission {
|
CliCommand::VoteUpdateCommission {
|
||||||
vote_account_pubkey,
|
vote_account_pubkey,
|
||||||
@ -3505,6 +3508,7 @@ mod tests {
|
|||||||
config.command = CliCommand::VoteUpdateValidator {
|
config.command = CliCommand::VoteUpdateValidator {
|
||||||
vote_account_pubkey: bob_pubkey,
|
vote_account_pubkey: bob_pubkey,
|
||||||
new_identity_account: 2,
|
new_identity_account: 2,
|
||||||
|
withdraw_authority: 1,
|
||||||
};
|
};
|
||||||
let result = process_command(&config);
|
let result = process_command(&config);
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
@ -3724,6 +3728,7 @@ mod tests {
|
|||||||
config.command = CliCommand::VoteUpdateValidator {
|
config.command = CliCommand::VoteUpdateValidator {
|
||||||
vote_account_pubkey: bob_pubkey,
|
vote_account_pubkey: bob_pubkey,
|
||||||
new_identity_account: 1,
|
new_identity_account: 1,
|
||||||
|
withdraw_authority: 1,
|
||||||
};
|
};
|
||||||
assert!(process_command(&config).is_err());
|
assert!(process_command(&config).is_err());
|
||||||
|
|
||||||
|
@ -340,7 +340,8 @@ pub fn parse_vote_update_validator(
|
|||||||
pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
|
pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
|
||||||
let (new_identity_account, new_identity_pubkey) =
|
let (new_identity_account, new_identity_pubkey) =
|
||||||
signer_of(matches, "new_identity_account", wallet_manager)?;
|
signer_of(matches, "new_identity_account", wallet_manager)?;
|
||||||
let (authorized_withdrawer, _) = signer_of(matches, "authorized_withdrawer", wallet_manager)?;
|
let (authorized_withdrawer, authorized_withdrawer_pubkey) =
|
||||||
|
signer_of(matches, "authorized_withdrawer", wallet_manager)?;
|
||||||
|
|
||||||
let payer_provided = None;
|
let payer_provided = None;
|
||||||
let signer_info = generate_unique_signers(
|
let signer_info = generate_unique_signers(
|
||||||
@ -354,6 +355,7 @@ pub fn parse_vote_update_validator(
|
|||||||
command: CliCommand::VoteUpdateValidator {
|
command: CliCommand::VoteUpdateValidator {
|
||||||
vote_account_pubkey,
|
vote_account_pubkey,
|
||||||
new_identity_account: signer_info.index_of(new_identity_pubkey).unwrap(),
|
new_identity_account: signer_info.index_of(new_identity_pubkey).unwrap(),
|
||||||
|
withdraw_authority: signer_info.index_of(authorized_withdrawer_pubkey).unwrap(),
|
||||||
},
|
},
|
||||||
signers: signer_info.signers,
|
signers: signer_info.signers,
|
||||||
})
|
})
|
||||||
@ -566,8 +568,9 @@ pub fn process_vote_update_validator(
|
|||||||
config: &CliConfig,
|
config: &CliConfig,
|
||||||
vote_account_pubkey: &Pubkey,
|
vote_account_pubkey: &Pubkey,
|
||||||
new_identity_account: SignerIndex,
|
new_identity_account: SignerIndex,
|
||||||
|
withdraw_authority: SignerIndex,
|
||||||
) -> ProcessResult {
|
) -> ProcessResult {
|
||||||
let authorized_withdrawer = config.signers[1];
|
let authorized_withdrawer = config.signers[withdraw_authority];
|
||||||
let new_identity_account = config.signers[new_identity_account];
|
let new_identity_account = config.signers[new_identity_account];
|
||||||
let new_identity_pubkey = new_identity_account.pubkey();
|
let new_identity_pubkey = new_identity_account.pubkey();
|
||||||
check_unique_pubkeys(
|
check_unique_pubkeys(
|
||||||
@ -934,6 +937,7 @@ mod tests {
|
|||||||
command: CliCommand::VoteUpdateValidator {
|
command: CliCommand::VoteUpdateValidator {
|
||||||
vote_account_pubkey: pubkey,
|
vote_account_pubkey: pubkey,
|
||||||
new_identity_account: 2,
|
new_identity_account: 2,
|
||||||
|
withdraw_authority: 1,
|
||||||
},
|
},
|
||||||
signers: vec![
|
signers: vec![
|
||||||
read_keypair_file(&default_keypair_file).unwrap().into(),
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
||||||
|
@ -111,6 +111,7 @@ fn test_vote_authorize_and_withdraw() {
|
|||||||
config.command = CliCommand::VoteUpdateValidator {
|
config.command = CliCommand::VoteUpdateValidator {
|
||||||
vote_account_pubkey,
|
vote_account_pubkey,
|
||||||
new_identity_account: 2,
|
new_identity_account: 2,
|
||||||
|
withdraw_authority: 1,
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user