Vote InitializeAccount and UpdateNode instructions now need a signature from the validator identity (#8947)

automerge
This commit is contained in:
Michael Vines
2020-03-19 01:58:52 -07:00
committed by GitHub
parent 24d871b529
commit f78a90bce2
10 changed files with 213 additions and 141 deletions

View File

@ -4905,15 +4905,19 @@ mod tests {
assert!(bank.get_account(&solana_vote_program::id()).is_some());
let mock_account = Keypair::new();
let mock_validator_identity = Keypair::new();
let instructions = vote_instruction::create_account(
&mint_keypair.pubkey(),
&mock_account.pubkey(),
&VoteInit::default(),
&VoteInit {
node_pubkey: mock_validator_identity.pubkey(),
..VoteInit::default()
},
1,
);
let transaction = Transaction::new_signed_instructions(
&[&mint_keypair, &mock_account],
&[&mint_keypair, &mock_account, &mock_validator_identity],
instructions,
bank.last_blockhash(),
);
@ -4946,15 +4950,19 @@ mod tests {
}
let mock_account = Keypair::new();
let mock_validator_identity = Keypair::new();
let instructions = vote_instruction::create_account(
&mint_keypair.pubkey(),
&mock_account.pubkey(),
&VoteInit::default(),
&VoteInit {
node_pubkey: mock_validator_identity.pubkey(),
..VoteInit::default()
},
1,
);
let transaction = Transaction::new_signed_instructions(
&[&mint_keypair, &mock_account],
&[&mint_keypair, &mock_account, &mock_validator_identity],
instructions,
bank.last_blockhash(),
);

View File

@ -163,7 +163,8 @@ fn test_stake_account_lifetime() {
let stake_pubkey = stake_keypair.pubkey();
let vote_keypair = Keypair::new();
let vote_pubkey = vote_keypair.pubkey();
let node_pubkey = Pubkey::new_rand();
let identity_keypair = Keypair::new();
let identity_pubkey = identity_keypair.pubkey();
let GenesisConfigInfo {
mut genesis_config,
@ -183,7 +184,7 @@ fn test_stake_account_lifetime() {
&mint_pubkey,
&vote_pubkey,
&VoteInit {
node_pubkey,
node_pubkey: identity_pubkey,
authorized_voter: vote_pubkey,
authorized_withdrawer: vote_pubkey,
commission: 50,
@ -191,7 +192,7 @@ fn test_stake_account_lifetime() {
10,
));
bank_client
.send_message(&[&mint_keypair, &vote_keypair], message)
.send_message(&[&mint_keypair, &vote_keypair, &identity_keypair], message)
.expect("failed to create vote account");
let authorized = stake_state::Authorized::auto(&stake_pubkey);
@ -394,7 +395,8 @@ fn test_stake_account_lifetime() {
fn test_create_stake_account_from_seed() {
let vote_keypair = Keypair::new();
let vote_pubkey = vote_keypair.pubkey();
let node_pubkey = Pubkey::new_rand();
let identity_keypair = Keypair::new();
let identity_pubkey = identity_keypair.pubkey();
let GenesisConfigInfo {
mut genesis_config,
@ -418,7 +420,7 @@ fn test_create_stake_account_from_seed() {
&mint_pubkey,
&vote_pubkey,
&VoteInit {
node_pubkey,
node_pubkey: identity_pubkey,
authorized_voter: vote_pubkey,
authorized_withdrawer: vote_pubkey,
commission: 50,
@ -426,7 +428,7 @@ fn test_create_stake_account_from_seed() {
10,
));
bank_client
.send_message(&[&mint_keypair, &vote_keypair], message)
.send_message(&[&mint_keypair, &vote_keypair, &identity_keypair], message)
.expect("failed to create vote account");
let authorized = stake_state::Authorized::auto(&mint_pubkey);