Cherry-pick vote and stake authority changes (#6127)

* add authorized parameters to vote api (#6072)

* add authorized parameters to vote api

* code review

* add authorities to stake init (#6104)

* add authorities to stake init

* fixups

* code review
This commit is contained in:
Tyera Eulberg
2019-09-26 17:18:31 -06:00
committed by GitHub
parent 232d2b3899
commit 61930c0dd3
14 changed files with 947 additions and 428 deletions

View File

@@ -12,8 +12,7 @@ use solana_core::{
};
use solana_sdk::{
client::SyncClient,
clock::DEFAULT_TICKS_PER_SLOT,
clock::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT},
clock::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT, DEFAULT_TICKS_PER_SLOT},
genesis_block::GenesisBlock,
message::Message,
poh_config::PohConfig,
@@ -22,9 +21,15 @@ use solana_sdk::{
system_transaction,
transaction::Transaction,
};
use solana_stake_api::{config as stake_config, stake_instruction, stake_state::StakeState};
use solana_stake_api::{
config as stake_config, stake_instruction,
stake_state::{Authorized as StakeAuthorized, StakeState},
};
use solana_storage_api::{storage_contract, storage_instruction};
use solana_vote_api::{vote_instruction, vote_state::VoteState};
use solana_vote_api::{
vote_instruction,
vote_state::{VoteInit, VoteState},
};
use std::{
collections::HashMap,
fs::remove_dir_all,
@@ -436,8 +441,12 @@ impl LocalCluster {
vote_instruction::create_account(
&from_account.pubkey(),
&vote_account_pubkey,
&node_pubkey,
0,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
amount,
),
client.get_recent_blockhash().unwrap().0,
@@ -456,6 +465,7 @@ impl LocalCluster {
&stake_account_pubkey,
&vote_account_pubkey,
amount,
&StakeAuthorized::auto(&stake_account_pubkey),
),
client.get_recent_blockhash().unwrap().0,
);