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

@ -272,7 +272,7 @@ mod tests {
EpochSchedule, DEFAULT_LEADER_SCHEDULE_SLOT_OFFSET, DEFAULT_SLOTS_PER_EPOCH,
MINIMUM_SLOTS_PER_EPOCH,
};
use solana_sdk::signature::Keypair;
use solana_sdk::signature::{Keypair, Signer};
use std::{sync::mpsc::channel, sync::Arc, thread::Builder};
#[test]
@ -526,15 +526,16 @@ mod tests {
let cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank));
// Create new vote account
let node_pubkey = Pubkey::new_rand();
let validator_identity = Keypair::new();
let vote_account = Keypair::new();
setup_vote_and_stake_accounts(
&bank,
&mint_keypair,
&vote_account,
&node_pubkey,
&validator_identity,
BOOTSTRAP_VALIDATOR_LAMPORTS,
);
let node_pubkey = validator_identity.pubkey();
// Have to wait until the epoch at after the epoch stakes generated at genesis
// for the new votes to take effect.

View File

@ -130,7 +130,7 @@ pub(crate) mod tests {
bank: &Bank,
from_account: &Keypair,
vote_account: &Keypair,
node_pubkey: &Pubkey,
validator_identity_account: &Keypair,
amount: u64,
) {
let vote_pubkey = vote_account.pubkey();
@ -146,12 +146,12 @@ pub(crate) mod tests {
process_instructions(
bank,
&[from_account, vote_account],
&[from_account, vote_account, validator_identity_account],
vote_instruction::create_account(
&from_account.pubkey(),
&vote_pubkey,
&VoteInit {
node_pubkey: *node_pubkey,
node_pubkey: validator_identity_account.pubkey(),
authorized_voter: vote_pubkey,
authorized_withdrawer: vote_pubkey,
commission: 0,
@ -209,13 +209,7 @@ pub(crate) mod tests {
// Make a mint vote account. Because the mint has nonzero stake, this
// should show up in the active set
setup_vote_and_stake_accounts(
&bank,
&mint_keypair,
&vote_account,
&mint_keypair.pubkey(),
stake,
);
setup_vote_and_stake_accounts(&bank, &mint_keypair, &vote_account, &mint_keypair, stake);
// simulated stake
let other_stake = Stake {