CLI: Fix explicitly plumb withdraw_authority through vote-update-validator
This commit is contained in:
committed by
Trent Nelson
parent
3392ecc310
commit
2284699889
@@ -391,6 +391,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,
|
||||||
@@ -2206,11 +2207,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,
|
||||||
@@ -3498,6 +3501,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());
|
||||||
@@ -3729,6 +3733,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());
|
||||||
|
|
||||||
|
@@ -316,7 +316,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(
|
||||||
@@ -330,6 +331,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,
|
||||||
})
|
})
|
||||||
@@ -565,8 +567,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(
|
||||||
@@ -971,6 +974,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(),
|
||||||
|
@@ -125,6 +125,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