Rename VoteSignerProxy to VotingKeypair
Works just like a normal Keypair, but will only sign voting transactions.
This commit is contained in:
parent
9a4abe96c7
commit
82a2080e45
|
@ -7,7 +7,7 @@ use solana::leader_scheduler::LeaderScheduler;
|
|||
use solana::local_vote_signer_service::LocalVoteSignerService;
|
||||
use solana::socketaddr;
|
||||
use solana::thin_client::{poll_gossip_for_leader, ThinClient};
|
||||
use solana::vote_signer_proxy::{RemoteVoteSigner, VoteSignerProxy};
|
||||
use solana::voting_keypair::{RemoteVoteSigner, VotingKeypair};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::vote_program::VoteProgram;
|
||||
|
@ -257,7 +257,7 @@ fn main() {
|
|||
} else {
|
||||
Box::new(LocalVoteSigner::default())
|
||||
};
|
||||
let vote_signer = VoteSignerProxy::new_with_signer(&keypair, vote_signer);
|
||||
let vote_signer = VotingKeypair::new_with_signer(&keypair, vote_signer);
|
||||
let vote_account_id = vote_signer.pubkey();
|
||||
info!("New vote account ID is {:?}", vote_account_id);
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ impl Service for ComputeLeaderConfirmationService {
|
|||
pub mod tests {
|
||||
use crate::bank::Bank;
|
||||
use crate::compute_leader_confirmation_service::ComputeLeaderConfirmationService;
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
|
||||
use crate::genesis_block::GenesisBlock;
|
||||
use crate::leader_scheduler::tests::new_vote_account;
|
||||
|
@ -197,18 +197,19 @@ pub mod tests {
|
|||
// Create new validator to vote
|
||||
let validator_keypair = Arc::new(Keypair::new());
|
||||
let last_id = ids[i];
|
||||
let vote_signer = VoteSignerProxy::new_local(&validator_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
|
||||
// Give the validator some tokens
|
||||
bank.transfer(2, &mint_keypair, validator_keypair.pubkey(), last_id)
|
||||
.unwrap();
|
||||
new_vote_account(&validator_keypair, &vote_signer, &bank, 1, last_id);
|
||||
new_vote_account(&validator_keypair, &voting_keypair, &bank, 1, last_id);
|
||||
|
||||
if i < 6 {
|
||||
let vote_tx = Transaction::vote_new(&vote_signer, (i + 1) as u64, last_id, 0);
|
||||
let vote_tx =
|
||||
Transaction::vote_new(&voting_keypair, (i + 1) as u64, last_id, 0);
|
||||
bank.process_transaction(&vote_tx).unwrap();
|
||||
}
|
||||
(vote_signer, validator_keypair)
|
||||
(voting_keypair, validator_keypair)
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
@ -222,8 +223,8 @@ pub mod tests {
|
|||
assert_eq!(bank.confirmation_time(), std::usize::MAX);
|
||||
|
||||
// Get another validator to vote, so we now have 2/3 consensus
|
||||
let vote_signer = &vote_accounts[7].0;
|
||||
let vote_tx = Transaction::vote_new(vote_signer, 7, ids[6], 0);
|
||||
let voting_keypair = &vote_accounts[7].0;
|
||||
let vote_tx = Transaction::vote_new(voting_keypair, 7, ids[6], 0);
|
||||
bank.process_transaction(&vote_tx).unwrap();
|
||||
|
||||
ComputeLeaderConfirmationService::compute_confirmation(
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::storage_stage::StorageState;
|
|||
use crate::streamer::BlobSender;
|
||||
use crate::tpu::{Tpu, TpuReturnType};
|
||||
use crate::tvu::{Sockets, Tvu, TvuReturnType};
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use log::Level;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
@ -112,7 +112,7 @@ impl Fullnode {
|
|||
keypair: &Arc<Keypair>,
|
||||
ledger_path: &str,
|
||||
leader_scheduler: Arc<RwLock<LeaderScheduler>>,
|
||||
vote_signer: VoteSignerProxy,
|
||||
voting_keypair: VotingKeypair,
|
||||
entrypoint_info_option: Option<&NodeInfo>,
|
||||
config: &FullnodeConfig,
|
||||
) -> Self {
|
||||
|
@ -213,10 +213,10 @@ impl Fullnode {
|
|||
.collect(),
|
||||
};
|
||||
|
||||
let vote_signer_option = if config.voting_disabled {
|
||||
let voting_keypair_option = if config.voting_disabled {
|
||||
None
|
||||
} else {
|
||||
Some(Arc::new(vote_signer))
|
||||
Some(Arc::new(voting_keypair))
|
||||
};
|
||||
|
||||
// Setup channels for rotation indications
|
||||
|
@ -224,7 +224,7 @@ impl Fullnode {
|
|||
let (to_validator_sender, to_validator_receiver) = channel();
|
||||
|
||||
let (tvu, blob_sender) = Tvu::new(
|
||||
vote_signer_option,
|
||||
voting_keypair_option,
|
||||
&bank,
|
||||
entry_height,
|
||||
last_entry_id,
|
||||
|
@ -474,7 +474,7 @@ mod tests {
|
|||
use crate::streamer::responder;
|
||||
use crate::tpu::TpuReturnType;
|
||||
use crate::tvu::TvuReturnType;
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use std::cmp;
|
||||
|
@ -498,7 +498,7 @@ mod tests {
|
|||
&Arc::new(validator_keypair),
|
||||
&validator_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&Default::default()))),
|
||||
VoteSignerProxy::new(),
|
||||
VotingKeypair::new(),
|
||||
Some(&leader_node.info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -530,7 +530,7 @@ mod tests {
|
|||
&Arc::new(validator_keypair),
|
||||
&validator_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&Default::default()))),
|
||||
VoteSignerProxy::new(),
|
||||
VotingKeypair::new(),
|
||||
Some(&leader_node.info),
|
||||
&FullnodeConfig::default(),
|
||||
)
|
||||
|
@ -587,14 +587,14 @@ mod tests {
|
|||
);
|
||||
|
||||
let bootstrap_leader_keypair = Arc::new(bootstrap_leader_keypair);
|
||||
let signer = VoteSignerProxy::new_local(&bootstrap_leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&bootstrap_leader_keypair);
|
||||
// Start up the leader
|
||||
let mut bootstrap_leader = Fullnode::new(
|
||||
bootstrap_leader_node,
|
||||
&bootstrap_leader_keypair,
|
||||
&bootstrap_leader_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
signer,
|
||||
voting_keypair,
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -656,7 +656,7 @@ mod tests {
|
|||
&bootstrap_leader_keypair,
|
||||
&bootstrap_leader_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
VoteSignerProxy::new(),
|
||||
VotingKeypair::new(),
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -669,7 +669,7 @@ mod tests {
|
|||
&validator_keypair,
|
||||
&validator_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
VoteSignerProxy::new(),
|
||||
VotingKeypair::new(),
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -717,14 +717,14 @@ mod tests {
|
|||
bootstrap_height,
|
||||
);
|
||||
|
||||
let vote_signer = VoteSignerProxy::new_local(&validator_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
// Start the validator
|
||||
let validator = Fullnode::new(
|
||||
validator_node,
|
||||
&validator_keypair,
|
||||
&validator_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
vote_signer,
|
||||
voting_keypair,
|
||||
Some(&leader_node.info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -820,14 +820,14 @@ mod tests {
|
|||
bootstrap_height,
|
||||
);
|
||||
|
||||
let vote_signer = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
// Start the bootstrap leader
|
||||
let mut leader = Fullnode::new(
|
||||
leader_node,
|
||||
&leader_keypair,
|
||||
&leader_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
vote_signer,
|
||||
voting_keypair,
|
||||
Some(&leader_node_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use crate::bank::Bank;
|
||||
|
||||
use crate::entry::{create_ticks, Entry};
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use bincode::serialize;
|
||||
use byteorder::{LittleEndian, ReadBytesExt};
|
||||
use hashbrown::HashSet;
|
||||
|
@ -494,7 +494,7 @@ pub fn make_active_set_entries(
|
|||
last_entry_id: &Hash,
|
||||
last_tick_id: &Hash,
|
||||
num_ending_ticks: u64,
|
||||
) -> (Vec<Entry>, VoteSignerProxy) {
|
||||
) -> (Vec<Entry>, VotingKeypair) {
|
||||
// 1) Create transfer token entry
|
||||
let transfer_tx =
|
||||
Transaction::system_new(&token_source, active_keypair.pubkey(), 3, *last_tick_id);
|
||||
|
@ -502,8 +502,8 @@ pub fn make_active_set_entries(
|
|||
let mut last_entry_id = transfer_entry.id;
|
||||
|
||||
// 2) Create and register the vote account
|
||||
let vote_signer = VoteSignerProxy::new_local(active_keypair);
|
||||
let vote_account_id = vote_signer.pubkey();
|
||||
let voting_keypair = VotingKeypair::new_local(active_keypair);
|
||||
let vote_account_id = voting_keypair.pubkey();
|
||||
|
||||
let new_vote_account_tx =
|
||||
Transaction::vote_account_new(active_keypair, vote_account_id, *last_tick_id, 1, 1);
|
||||
|
@ -511,7 +511,7 @@ pub fn make_active_set_entries(
|
|||
last_entry_id = new_vote_account_entry.id;
|
||||
|
||||
// 3) Create vote entry
|
||||
let vote_tx = Transaction::vote_new(&vote_signer, 1, *last_tick_id, 0);
|
||||
let vote_tx = Transaction::vote_new(&voting_keypair, 1, *last_tick_id, 0);
|
||||
let vote_entry = Entry::new(&last_entry_id, 0, 1, vec![vote_tx]);
|
||||
last_entry_id = vote_entry.id;
|
||||
|
||||
|
@ -519,7 +519,7 @@ pub fn make_active_set_entries(
|
|||
let mut txs = vec![transfer_entry, new_vote_account_entry, vote_entry];
|
||||
let empty_ticks = create_ticks(num_ending_ticks, last_entry_id);
|
||||
txs.extend(empty_ticks);
|
||||
(txs, vote_signer)
|
||||
(txs, voting_keypair)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -531,7 +531,7 @@ pub mod tests {
|
|||
LeaderScheduler, LeaderSchedulerConfig, DEFAULT_BOOTSTRAP_HEIGHT,
|
||||
DEFAULT_SEED_ROTATION_INTERVAL, DEFAULT_TICKS_PER_SLOT,
|
||||
};
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use hashbrown::HashSet;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
@ -549,14 +549,14 @@ pub mod tests {
|
|||
|
||||
pub fn new_vote_account(
|
||||
from_keypair: &Keypair,
|
||||
vote_signer: &VoteSignerProxy,
|
||||
voting_keypair: &VotingKeypair,
|
||||
bank: &Bank,
|
||||
num_tokens: u64,
|
||||
last_id: Hash,
|
||||
) {
|
||||
let tx = Transaction::vote_account_new(
|
||||
from_keypair,
|
||||
vote_signer.pubkey(),
|
||||
voting_keypair.pubkey(),
|
||||
last_id,
|
||||
num_tokens,
|
||||
0,
|
||||
|
@ -564,8 +564,8 @@ pub mod tests {
|
|||
bank.process_transaction(&tx).unwrap();
|
||||
}
|
||||
|
||||
fn push_vote(vote_signer: &VoteSignerProxy, bank: &Bank, height: u64, last_id: Hash) {
|
||||
let new_vote_tx = Transaction::vote_new(vote_signer, height, last_id, 0);
|
||||
fn push_vote(voting_keypair: &VotingKeypair, bank: &Bank, height: u64, last_id: Hash) {
|
||||
let new_vote_tx = Transaction::vote_new(voting_keypair, height, last_id, 0);
|
||||
bank.process_transaction(&new_vote_tx).unwrap();
|
||||
}
|
||||
|
||||
|
@ -602,7 +602,7 @@ pub mod tests {
|
|||
for i in 0..num_validators {
|
||||
let new_validator = Arc::new(Keypair::new());
|
||||
let new_pubkey = new_validator.pubkey();
|
||||
let vote_signer = VoteSignerProxy::new_local(&new_validator);
|
||||
let voting_keypair = VotingKeypair::new_local(&new_validator);
|
||||
validators.push(new_pubkey);
|
||||
// Give the validator some tokens
|
||||
bank.transfer(
|
||||
|
@ -616,7 +616,7 @@ pub mod tests {
|
|||
// Create a vote account
|
||||
new_vote_account(
|
||||
&new_validator,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
num_vote_account_tokens as u64,
|
||||
genesis_block.last_id(),
|
||||
|
@ -624,7 +624,7 @@ pub mod tests {
|
|||
|
||||
// Vote to make the validator part of the active set for the entire test
|
||||
// (we made the active_window_length large enough at the beginning of the test)
|
||||
push_vote(&vote_signer, &bank, 1, genesis_block.last_id());
|
||||
push_vote(&voting_keypair, &bank, 1, genesis_block.last_id());
|
||||
}
|
||||
|
||||
// The scheduled leader during the bootstrapping period (assuming a seed + schedule
|
||||
|
@ -730,17 +730,22 @@ pub mod tests {
|
|||
.unwrap();
|
||||
|
||||
// Create a vote account
|
||||
let vote_signer = VoteSignerProxy::new_local(&new_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&new_keypair);
|
||||
new_vote_account(
|
||||
&new_keypair,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
1,
|
||||
genesis_block.last_id(),
|
||||
);
|
||||
|
||||
// Push a vote for the account
|
||||
push_vote(&vote_signer, &bank, start_height, genesis_block.last_id());
|
||||
push_vote(
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
start_height,
|
||||
genesis_block.last_id(),
|
||||
);
|
||||
}
|
||||
|
||||
// Insert a bunch of votes at height "start_height + active_window_length"
|
||||
|
@ -755,17 +760,17 @@ pub mod tests {
|
|||
.unwrap();
|
||||
|
||||
// Create a vote account
|
||||
let vote_signer = VoteSignerProxy::new_local(&new_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&new_keypair);
|
||||
new_vote_account(
|
||||
&new_keypair,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
1,
|
||||
genesis_block.last_id(),
|
||||
);
|
||||
|
||||
push_vote(
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
start_height + active_window_length,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1021,7 +1026,7 @@ pub mod tests {
|
|||
for i in 0..num_validators {
|
||||
let new_validator = Arc::new(Keypair::new());
|
||||
let new_pubkey = new_validator.pubkey();
|
||||
let vote_signer = VoteSignerProxy::new_local(&new_validator);
|
||||
let voting_keypair = VotingKeypair::new_local(&new_validator);
|
||||
validators.push(new_pubkey);
|
||||
// Give the validator some tokens
|
||||
bank.transfer(
|
||||
|
@ -1035,7 +1040,7 @@ pub mod tests {
|
|||
// Create a vote account
|
||||
new_vote_account(
|
||||
&new_validator,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
num_vote_account_tokens as u64,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1043,7 +1048,7 @@ pub mod tests {
|
|||
|
||||
// Vote at height i * active_window_length for validator i
|
||||
push_vote(
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
i * active_window_length + bootstrap_height,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1084,11 +1089,11 @@ pub mod tests {
|
|||
// window
|
||||
let initial_vote_height = 1;
|
||||
|
||||
let vote_signer = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
// Create a vote account
|
||||
new_vote_account(
|
||||
&leader_keypair,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
1,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1096,13 +1101,13 @@ pub mod tests {
|
|||
|
||||
// Vote twice
|
||||
push_vote(
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
initial_vote_height,
|
||||
genesis_block.last_id(),
|
||||
);
|
||||
push_vote(
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
initial_vote_height + 1,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1235,17 +1240,17 @@ pub mod tests {
|
|||
bank.transfer(5, &mint_keypair, validator_id, last_id)
|
||||
.unwrap();
|
||||
// Create a vote account
|
||||
let vote_signer = VoteSignerProxy::new_local(&validator_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
new_vote_account(
|
||||
&validator_keypair,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
1,
|
||||
genesis_block.last_id(),
|
||||
);
|
||||
|
||||
push_vote(
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
initial_vote_height,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1270,10 +1275,10 @@ pub mod tests {
|
|||
.unwrap();
|
||||
|
||||
// Create a vote account
|
||||
let vote_signer = VoteSignerProxy::new_local(&bootstrap_leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&bootstrap_leader_keypair);
|
||||
new_vote_account(
|
||||
&bootstrap_leader_keypair,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
vote_account_tokens as u64,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1281,7 +1286,7 @@ pub mod tests {
|
|||
|
||||
// Add leader to the active set
|
||||
push_vote(
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
initial_vote_height,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1397,17 +1402,17 @@ pub mod tests {
|
|||
// Create a vote account for the validator
|
||||
bank.transfer(5, &mint_keypair, validator_id, last_id)
|
||||
.unwrap();
|
||||
let vote_signer = VoteSignerProxy::new_local(&validator_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
new_vote_account(
|
||||
&validator_keypair,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
1,
|
||||
genesis_block.last_id(),
|
||||
);
|
||||
|
||||
push_vote(
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
initial_vote_height,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1416,10 +1421,10 @@ pub mod tests {
|
|||
// Create a vote account for the leader
|
||||
bank.transfer(5, &mint_keypair, bootstrap_leader_id, last_id)
|
||||
.unwrap();
|
||||
let vote_signer = VoteSignerProxy::new_local(&bootstrap_leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&bootstrap_leader_keypair);
|
||||
new_vote_account(
|
||||
&bootstrap_leader_keypair,
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
1,
|
||||
genesis_block.last_id(),
|
||||
|
@ -1427,7 +1432,7 @@ pub mod tests {
|
|||
|
||||
// Add leader to the active set
|
||||
push_vote(
|
||||
&vote_signer,
|
||||
&voting_keypair,
|
||||
&bank,
|
||||
initial_vote_height,
|
||||
genesis_block.last_id(),
|
||||
|
|
|
@ -70,7 +70,7 @@ pub mod thin_client;
|
|||
pub mod tpu;
|
||||
pub mod tpu_forwarder;
|
||||
pub mod tvu;
|
||||
pub mod vote_signer_proxy;
|
||||
pub mod voting_keypair;
|
||||
#[cfg(test)]
|
||||
pub mod window;
|
||||
pub mod window_service;
|
||||
|
@ -94,7 +94,6 @@ use solana_jsonrpc_http_server as jsonrpc_http_server;
|
|||
extern crate solana_jsonrpc_macros as jsonrpc_macros;
|
||||
use solana_jsonrpc_pubsub as jsonrpc_pubsub;
|
||||
use solana_jsonrpc_ws_server as jsonrpc_ws_server;
|
||||
//use solana_vote_signer;
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
|
|
|
@ -15,7 +15,7 @@ use crate::packet::BlobError;
|
|||
use crate::result::{Error, Result};
|
||||
use crate::service::Service;
|
||||
use crate::tvu::TvuReturnType;
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use log::Level;
|
||||
use solana_metrics::{influxdb, submit};
|
||||
use solana_sdk::hash::Hash;
|
||||
|
@ -63,7 +63,7 @@ impl ReplayStage {
|
|||
cluster_info: &Arc<RwLock<ClusterInfo>>,
|
||||
window_receiver: &EntryReceiver,
|
||||
my_id: Pubkey,
|
||||
vote_signer_proxy: Option<&Arc<VoteSignerProxy>>,
|
||||
voting_keypair: Option<&Arc<VotingKeypair>>,
|
||||
ledger_entry_sender: &EntrySender,
|
||||
entry_height: &Arc<RwLock<u64>>,
|
||||
last_entry_id: &Arc<RwLock<Hash>>,
|
||||
|
@ -144,8 +144,8 @@ impl ReplayStage {
|
|||
}
|
||||
|
||||
if 0 == num_ticks_to_next_vote {
|
||||
if let Some(vote_signer_proxy) = vote_signer_proxy {
|
||||
let keypair = vote_signer_proxy.as_ref();
|
||||
if let Some(voting_keypair) = voting_keypair {
|
||||
let keypair = voting_keypair.as_ref();
|
||||
let vote =
|
||||
Transaction::vote_new(keypair, bank.tick_height(), bank.last_id(), 0);
|
||||
cluster_info.write().unwrap().push_vote(vote);
|
||||
|
@ -203,7 +203,7 @@ impl ReplayStage {
|
|||
#[allow(clippy::new_ret_no_self, clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
my_id: Pubkey,
|
||||
vote_signer_proxy: Option<Arc<VoteSignerProxy>>,
|
||||
voting_keypair: Option<Arc<VotingKeypair>>,
|
||||
bank: Arc<Bank>,
|
||||
cluster_info: Arc<RwLock<ClusterInfo>>,
|
||||
window_receiver: EntryReceiver,
|
||||
|
@ -245,7 +245,7 @@ impl ReplayStage {
|
|||
&cluster_info,
|
||||
&window_receiver,
|
||||
my_id,
|
||||
vote_signer_proxy.as_ref(),
|
||||
voting_keypair.as_ref(),
|
||||
&ledger_entry_sender,
|
||||
&entry_height_.clone(),
|
||||
&last_entry_id.clone(),
|
||||
|
@ -290,7 +290,7 @@ mod test {
|
|||
use crate::result::Error;
|
||||
use crate::service::Service;
|
||||
use crate::tvu::TvuReturnType;
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use std::fs::remove_dir_all;
|
||||
|
@ -327,7 +327,7 @@ mod test {
|
|||
// Write two entries to the ledger so that the validator is in the active set:
|
||||
// 1) Give the validator a nonzero number of tokens 2) A vote from the validator .
|
||||
// This will cause leader rotation after the bootstrap height
|
||||
let (active_set_entries, vote_signer_proxy) =
|
||||
let (active_set_entries, voting_keypair) =
|
||||
make_active_set_entries(&my_keypair, &mint_keypair, &last_id, &last_id, 0);
|
||||
last_id = active_set_entries.last().unwrap().id;
|
||||
let initial_tick_height = genesis_entry_height;
|
||||
|
@ -370,7 +370,7 @@ mod test {
|
|||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let (_replay_stage, ledger_writer_recv) = ReplayStage::new(
|
||||
my_keypair.pubkey(),
|
||||
Some(Arc::new(vote_signer_proxy)),
|
||||
Some(Arc::new(voting_keypair)),
|
||||
Arc::new(bank),
|
||||
Arc::new(RwLock::new(cluster_info_me)),
|
||||
entry_receiver,
|
||||
|
@ -462,11 +462,11 @@ mod test {
|
|||
let (entry_sender, entry_receiver) = channel();
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let my_keypair = Arc::new(my_keypair);
|
||||
let vote_signer_proxy = Arc::new(VoteSignerProxy::new_local(&my_keypair));
|
||||
let voting_keypair = Arc::new(VotingKeypair::new_local(&my_keypair));
|
||||
let (to_leader_sender, _) = channel();
|
||||
let (replay_stage, ledger_writer_recv) = ReplayStage::new(
|
||||
my_keypair.pubkey(),
|
||||
Some(vote_signer_proxy.clone()),
|
||||
Some(voting_keypair.clone()),
|
||||
bank.clone(),
|
||||
cluster_info_me.clone(),
|
||||
entry_receiver,
|
||||
|
@ -477,7 +477,7 @@ mod test {
|
|||
None,
|
||||
);
|
||||
|
||||
let keypair = vote_signer_proxy.as_ref();
|
||||
let keypair = voting_keypair.as_ref();
|
||||
let vote = Transaction::vote_new(keypair, bank.tick_height(), bank.last_id(), 0);
|
||||
cluster_info_me.write().unwrap().push_vote(vote);
|
||||
|
||||
|
@ -525,7 +525,7 @@ mod test {
|
|||
// Write two entries to the ledger so that the validator is in the active set:
|
||||
// 1) Give the validator a nonzero number of tokens 2) A vote from the validator.
|
||||
// This will cause leader rotation after the bootstrap height
|
||||
let (active_set_entries, vote_signer_proxy) =
|
||||
let (active_set_entries, voting_keypair) =
|
||||
make_active_set_entries(&my_keypair, &mint_keypair, &last_id, &last_id, 0);
|
||||
let mut last_id = active_set_entries.last().unwrap().id;
|
||||
let initial_tick_height = genesis_entry_height;
|
||||
|
@ -566,14 +566,14 @@ mod test {
|
|||
let cluster_info_me = Arc::new(RwLock::new(ClusterInfo::new(my_node.info.clone())));
|
||||
|
||||
// Set up the replay stage
|
||||
let vote_signer_proxy = Arc::new(vote_signer_proxy);
|
||||
let voting_keypair = Arc::new(voting_keypair);
|
||||
let bank = Arc::new(bank);
|
||||
let (entry_sender, entry_receiver) = channel();
|
||||
let (rotation_tx, rotation_rx) = channel();
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let (_replay_stage, ledger_writer_recv) = ReplayStage::new(
|
||||
my_keypair.pubkey(),
|
||||
Some(vote_signer_proxy.clone()),
|
||||
Some(voting_keypair.clone()),
|
||||
bank.clone(),
|
||||
cluster_info_me.clone(),
|
||||
entry_receiver,
|
||||
|
@ -584,7 +584,7 @@ mod test {
|
|||
None,
|
||||
);
|
||||
|
||||
let keypair = vote_signer_proxy.as_ref();
|
||||
let keypair = voting_keypair.as_ref();
|
||||
let vote = Transaction::vote_new(keypair, bank.tick_height(), bank.last_id(), 0);
|
||||
cluster_info_me.write().unwrap().push_vote(vote);
|
||||
|
||||
|
@ -665,13 +665,13 @@ mod test {
|
|||
.expect("Expected to err out");
|
||||
|
||||
let my_keypair = Arc::new(my_keypair);
|
||||
let vote_signer_proxy = Arc::new(VoteSignerProxy::new_local(&my_keypair));
|
||||
let voting_keypair = Arc::new(VotingKeypair::new_local(&my_keypair));
|
||||
let res = ReplayStage::process_entries(
|
||||
&Arc::new(Bank::default()),
|
||||
&cluster_info_me,
|
||||
&entry_receiver,
|
||||
my_id,
|
||||
Some(&vote_signer_proxy),
|
||||
Some(&voting_keypair),
|
||||
&ledger_entry_sender,
|
||||
&Arc::new(RwLock::new(entry_height)),
|
||||
&Arc::new(RwLock::new(last_entry_id)),
|
||||
|
@ -697,7 +697,7 @@ mod test {
|
|||
&cluster_info_me,
|
||||
&entry_receiver,
|
||||
Keypair::new().pubkey(),
|
||||
Some(&vote_signer_proxy),
|
||||
Some(&voting_keypair),
|
||||
&ledger_entry_sender,
|
||||
&Arc::new(RwLock::new(entry_height)),
|
||||
&Arc::new(RwLock::new(last_entry_id)),
|
||||
|
@ -745,13 +745,13 @@ mod test {
|
|||
.expect("Expected to err out");
|
||||
|
||||
let my_keypair = Arc::new(my_keypair);
|
||||
let vote_signer_proxy = Arc::new(VoteSignerProxy::new_local(&my_keypair));
|
||||
let voting_keypair = Arc::new(VotingKeypair::new_local(&my_keypair));
|
||||
ReplayStage::process_entries(
|
||||
&Arc::new(Bank::default()),
|
||||
&cluster_info_me,
|
||||
&entry_receiver,
|
||||
my_id,
|
||||
Some(&vote_signer_proxy),
|
||||
Some(&voting_keypair),
|
||||
&ledger_entry_sender,
|
||||
&Arc::new(RwLock::new(entry_height)),
|
||||
&Arc::new(RwLock::new(last_entry_id)),
|
||||
|
|
|
@ -440,7 +440,7 @@ pub fn new_fullnode(ledger_name: &'static str) -> (Fullnode, NodeInfo, Keypair,
|
|||
use crate::cluster_info::Node;
|
||||
use crate::db_ledger::create_tmp_sample_ledger;
|
||||
use crate::leader_scheduler::LeaderScheduler;
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use solana_sdk::signature::KeypairUtil;
|
||||
|
||||
let node_keypair = Arc::new(Keypair::new());
|
||||
|
@ -452,13 +452,13 @@ pub fn new_fullnode(ledger_name: &'static str) -> (Fullnode, NodeInfo, Keypair,
|
|||
|
||||
let leader_scheduler = LeaderScheduler::from_bootstrap_leader(node_info.id);
|
||||
let vote_account_keypair = Arc::new(Keypair::new());
|
||||
let vote_signer = VoteSignerProxy::new_local(&vote_account_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&vote_account_keypair);
|
||||
let node = Fullnode::new(
|
||||
node,
|
||||
&node_keypair,
|
||||
&ledger_path,
|
||||
Arc::new(RwLock::new(leader_scheduler)),
|
||||
vote_signer,
|
||||
voting_keypair,
|
||||
None,
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
|
12
src/tvu.rs
12
src/tvu.rs
|
@ -22,7 +22,7 @@ use crate::retransmit_stage::RetransmitStage;
|
|||
use crate::service::Service;
|
||||
use crate::storage_stage::{StorageStage, StorageState};
|
||||
use crate::streamer::BlobSender;
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use std::net::UdpSocket;
|
||||
|
@ -64,7 +64,7 @@ impl Tvu {
|
|||
/// * `db_ledger` - the ledger itself
|
||||
#[allow(clippy::new_ret_no_self, clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
vote_signer: Option<Arc<VoteSignerProxy>>,
|
||||
voting_keypair: Option<Arc<VotingKeypair>>,
|
||||
bank: &Arc<Bank>,
|
||||
entry_height: u64,
|
||||
last_entry_id: Hash,
|
||||
|
@ -119,7 +119,7 @@ impl Tvu {
|
|||
|
||||
let (replay_stage, ledger_entry_receiver) = ReplayStage::new(
|
||||
keypair.pubkey(),
|
||||
vote_signer,
|
||||
voting_keypair,
|
||||
bank.clone(),
|
||||
cluster_info.clone(),
|
||||
blob_window_receiver,
|
||||
|
@ -205,7 +205,7 @@ pub mod tests {
|
|||
use crate::storage_stage::{StorageState, STORAGE_ROTATE_TEST_COUNT};
|
||||
use crate::streamer;
|
||||
use crate::tvu::{Sockets, Tvu};
|
||||
use crate::vote_signer_proxy::VoteSignerProxy;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use bincode::serialize;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
|
@ -291,10 +291,10 @@ pub mod tests {
|
|||
let db_ledger =
|
||||
DbLedger::open(&db_ledger_path).expect("Expected to successfully open ledger");
|
||||
let vote_account_keypair = Arc::new(Keypair::new());
|
||||
let vote_signer = VoteSignerProxy::new_local(&vote_account_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&vote_account_keypair);
|
||||
let (sender, _) = channel();
|
||||
let (tvu, _) = Tvu::new(
|
||||
Some(Arc::new(vote_signer)),
|
||||
Some(Arc::new(voting_keypair)),
|
||||
&bank,
|
||||
0,
|
||||
cur_hash,
|
||||
|
|
|
@ -54,8 +54,8 @@ impl VoteSigner for RemoteVoteSigner {
|
|||
}
|
||||
}
|
||||
|
||||
impl KeypairUtil for VoteSignerProxy {
|
||||
/// Return a local VoteSignerProxy with a new keypair. Used for unit-tests.
|
||||
impl KeypairUtil for VotingKeypair {
|
||||
/// Return a local VotingKeypair with a new keypair. Used for unit-tests.
|
||||
fn new() -> Self {
|
||||
Self::new_local(&Arc::new(Keypair::new()))
|
||||
}
|
||||
|
@ -71,13 +71,13 @@ impl KeypairUtil for VoteSignerProxy {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct VoteSignerProxy {
|
||||
pub struct VotingKeypair {
|
||||
keypair: Arc<Keypair>,
|
||||
signer: Box<VoteSigner + Send + Sync>,
|
||||
vote_account: Pubkey,
|
||||
}
|
||||
|
||||
impl VoteSignerProxy {
|
||||
impl VotingKeypair {
|
||||
pub fn new_with_signer(keypair: &Arc<Keypair>, signer: Box<VoteSigner + Send + Sync>) -> Self {
|
||||
let msg = "Registering a new node";
|
||||
let sig = keypair.sign_message(msg.as_bytes());
|
|
@ -17,7 +17,7 @@ use solana::service::Service;
|
|||
use solana::thin_client::{poll_gossip_for_leader, retry_get_balance, ThinClient};
|
||||
use solana::tpu::TpuReturnType;
|
||||
use solana::tvu::TvuReturnType;
|
||||
use solana::vote_signer_proxy::VoteSignerProxy;
|
||||
use solana::voting_keypair::VotingKeypair;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
|
@ -154,7 +154,7 @@ fn test_multi_node_ledger_window() -> result::Result<()> {
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let leader = Fullnode::new(
|
||||
leader,
|
||||
&leader_keypair,
|
||||
|
@ -162,7 +162,7 @@ fn test_multi_node_ledger_window() -> result::Result<()> {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
None,
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -173,7 +173,7 @@ fn test_multi_node_ledger_window() -> result::Result<()> {
|
|||
let validator_pubkey = keypair.pubkey().clone();
|
||||
let validator = Node::new_localhost_with_pubkey(keypair.pubkey());
|
||||
let validator_data = validator.info.clone();
|
||||
let signer_proxy = VoteSignerProxy::new_local(&keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&keypair);
|
||||
let validator = Fullnode::new(
|
||||
validator,
|
||||
&keypair,
|
||||
|
@ -181,7 +181,7 @@ fn test_multi_node_ledger_window() -> result::Result<()> {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_data),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -257,7 +257,7 @@ fn test_multi_node_validator_catchup_from_zero() -> result::Result<()> {
|
|||
"multi_node_validator_catchup_from_zero",
|
||||
);
|
||||
ledger_paths.push(leader_ledger_path.clone());
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let server = Fullnode::new(
|
||||
leader,
|
||||
&leader_keypair,
|
||||
|
@ -265,7 +265,7 @@ fn test_multi_node_validator_catchup_from_zero() -> result::Result<()> {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
None,
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -290,7 +290,7 @@ fn test_multi_node_validator_catchup_from_zero() -> result::Result<()> {
|
|||
validator_pubkey, validator_balance
|
||||
);
|
||||
|
||||
let signer_proxy = VoteSignerProxy::new_local(&keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&keypair);
|
||||
let val = Fullnode::new(
|
||||
validator,
|
||||
&keypair,
|
||||
|
@ -298,7 +298,7 @@ fn test_multi_node_validator_catchup_from_zero() -> result::Result<()> {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_data),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -350,7 +350,7 @@ fn test_multi_node_validator_catchup_from_zero() -> result::Result<()> {
|
|||
let keypair = Arc::new(Keypair::new());
|
||||
let validator_pubkey = keypair.pubkey().clone();
|
||||
let validator = Node::new_localhost_with_pubkey(keypair.pubkey());
|
||||
let signer_proxy = VoteSignerProxy::new_local(&keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&keypair);
|
||||
info!("created start from zero validator {:?}", validator_pubkey);
|
||||
|
||||
let val = Fullnode::new(
|
||||
|
@ -360,7 +360,7 @@ fn test_multi_node_validator_catchup_from_zero() -> result::Result<()> {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_data),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -441,7 +441,7 @@ fn test_multi_node_basic() {
|
|||
let leader_ledger_path = tmp_copy_ledger(&genesis_ledger_path, "multi_node_basic");
|
||||
ledger_paths.push(leader_ledger_path.clone());
|
||||
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let server = Fullnode::new(
|
||||
leader,
|
||||
&leader_keypair,
|
||||
|
@ -449,7 +449,7 @@ fn test_multi_node_basic() {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
None,
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -470,7 +470,7 @@ fn test_multi_node_basic() {
|
|||
"validator {}, balance {}",
|
||||
validator_pubkey, validator_balance
|
||||
);
|
||||
let signer_proxy = VoteSignerProxy::new_local(&keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&keypair);
|
||||
let val = Fullnode::new(
|
||||
validator,
|
||||
&keypair,
|
||||
|
@ -478,7 +478,7 @@ fn test_multi_node_basic() {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_data),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -549,7 +549,7 @@ fn test_boot_validator_from_file() -> result::Result<()> {
|
|||
ledger_paths.push(leader_ledger_path.clone());
|
||||
|
||||
let leader_data = leader.info.clone();
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let leader_fullnode = Fullnode::new(
|
||||
leader,
|
||||
&leader_keypair,
|
||||
|
@ -557,7 +557,7 @@ fn test_boot_validator_from_file() -> result::Result<()> {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
None,
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -573,7 +573,7 @@ fn test_boot_validator_from_file() -> result::Result<()> {
|
|||
let validator_data = validator.info.clone();
|
||||
let ledger_path = tmp_copy_ledger(&genesis_ledger_path, "boot_validator_from_file");
|
||||
ledger_paths.push(ledger_path.clone());
|
||||
let signer_proxy = VoteSignerProxy::new_local(&keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&keypair);
|
||||
let val_fullnode = Fullnode::new(
|
||||
validator,
|
||||
&keypair,
|
||||
|
@ -581,7 +581,7 @@ fn test_boot_validator_from_file() -> result::Result<()> {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_data),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -602,7 +602,7 @@ fn test_boot_validator_from_file() -> result::Result<()> {
|
|||
fn create_leader(
|
||||
ledger_path: &str,
|
||||
leader_keypair: Arc<Keypair>,
|
||||
signer: VoteSignerProxy,
|
||||
voting_keypair: VotingKeypair,
|
||||
) -> (NodeInfo, Fullnode) {
|
||||
let leader = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
|
||||
let leader_data = leader.info.clone();
|
||||
|
@ -613,7 +613,7 @@ fn create_leader(
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_data.id,
|
||||
))),
|
||||
signer,
|
||||
voting_keypair,
|
||||
None,
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -639,9 +639,9 @@ fn test_leader_restart_validator_start_from_old_ledger() -> result::Result<()> {
|
|||
let bob_pubkey = Keypair::new().pubkey();
|
||||
|
||||
{
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let (leader_data, leader_fullnode) =
|
||||
create_leader(&ledger_path, leader_keypair.clone(), signer_proxy);
|
||||
create_leader(&ledger_path, leader_keypair.clone(), voting_keypair);
|
||||
|
||||
// lengthen the ledger
|
||||
let leader_balance =
|
||||
|
@ -660,9 +660,9 @@ fn test_leader_restart_validator_start_from_old_ledger() -> result::Result<()> {
|
|||
);
|
||||
|
||||
{
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let (leader_data, leader_fullnode) =
|
||||
create_leader(&ledger_path, leader_keypair.clone(), signer_proxy);
|
||||
create_leader(&ledger_path, leader_keypair.clone(), voting_keypair);
|
||||
|
||||
// lengthen the ledger
|
||||
let leader_balance =
|
||||
|
@ -674,15 +674,16 @@ fn test_leader_restart_validator_start_from_old_ledger() -> result::Result<()> {
|
|||
leader_fullnode.close()?;
|
||||
}
|
||||
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let (leader_data, leader_fullnode) = create_leader(&ledger_path, leader_keypair, signer_proxy);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let (leader_data, leader_fullnode) =
|
||||
create_leader(&ledger_path, leader_keypair, voting_keypair);
|
||||
|
||||
// start validator from old ledger
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let validator = Node::new_localhost_with_pubkey(keypair.pubkey());
|
||||
let validator_data = validator.info.clone();
|
||||
|
||||
let signer_proxy = VoteSignerProxy::new_local(&keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&keypair);
|
||||
let val_fullnode = Fullnode::new(
|
||||
validator,
|
||||
&keypair,
|
||||
|
@ -690,7 +691,7 @@ fn test_leader_restart_validator_start_from_old_ledger() -> result::Result<()> {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_data.id,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_data),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -755,7 +756,7 @@ fn test_multi_node_dynamic_network() {
|
|||
|
||||
let leader_ledger_path = tmp_copy_ledger(&genesis_ledger_path, "multi_node_dynamic_network");
|
||||
ledger_paths.push(leader_ledger_path.clone());
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let server = Fullnode::new(
|
||||
leader,
|
||||
&leader_keypair,
|
||||
|
@ -763,7 +764,7 @@ fn test_multi_node_dynamic_network() {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
None,
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -829,7 +830,7 @@ fn test_multi_node_dynamic_network() {
|
|||
let rd = validator.info.clone();
|
||||
info!("starting {} {}", keypair.pubkey(), rd.id);
|
||||
let keypair = Arc::new(keypair);
|
||||
let signer_proxy = VoteSignerProxy::new_local(&keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&keypair);
|
||||
let val = Fullnode::new(
|
||||
validator,
|
||||
&keypair,
|
||||
|
@ -837,7 +838,7 @@ fn test_multi_node_dynamic_network() {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_pubkey,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_data),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -1006,13 +1007,13 @@ fn test_leader_to_validator_transition() {
|
|||
bootstrap_height,
|
||||
);
|
||||
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let mut leader = Fullnode::new(
|
||||
leader_node,
|
||||
&leader_keypair,
|
||||
&leader_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -1155,25 +1156,25 @@ fn test_leader_validator_basic() {
|
|||
);
|
||||
|
||||
// Start the validator node
|
||||
let signer_proxy = VoteSignerProxy::new_local(&validator_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
let mut validator = Fullnode::new(
|
||||
validator_node,
|
||||
&validator_keypair,
|
||||
&validator_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
||||
// Start the leader fullnode
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let mut leader = Fullnode::new(
|
||||
leader_node,
|
||||
&leader_keypair,
|
||||
&leader_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -1349,7 +1350,7 @@ fn test_dropped_handoff_recovery() {
|
|||
info!("bootstrap_leader: {}", bootstrap_leader_keypair.pubkey());
|
||||
info!("'next leader': {}", next_leader_keypair.pubkey());
|
||||
|
||||
let signer_proxy = VoteSignerProxy::new_local(&bootstrap_leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&bootstrap_leader_keypair);
|
||||
// Start up the bootstrap leader fullnode
|
||||
let bootstrap_leader_ledger_path =
|
||||
tmp_copy_ledger(&genesis_ledger_path, "test_dropped_handoff_recovery");
|
||||
|
@ -1359,7 +1360,7 @@ fn test_dropped_handoff_recovery() {
|
|||
&bootstrap_leader_keypair,
|
||||
&bootstrap_leader_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -1375,13 +1376,13 @@ fn test_dropped_handoff_recovery() {
|
|||
let validator_id = keypair.pubkey();
|
||||
info!("validator {}: {}", i, validator_id);
|
||||
let validator_node = Node::new_localhost_with_pubkey(validator_id);
|
||||
let signer_proxy = VoteSignerProxy::new_local(&keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&keypair);
|
||||
let validator = Fullnode::new(
|
||||
validator_node,
|
||||
&keypair,
|
||||
&validator_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -1401,13 +1402,13 @@ fn test_dropped_handoff_recovery() {
|
|||
|
||||
info!("Starting the 'next leader' node");
|
||||
let next_leader_node = Node::new_localhost_with_pubkey(next_leader_keypair.pubkey());
|
||||
let signer_proxy = VoteSignerProxy::new_local(&next_leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&next_leader_keypair);
|
||||
let next_leader = Fullnode::new(
|
||||
next_leader_node,
|
||||
&next_leader_keypair,
|
||||
&next_leader_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -1537,7 +1538,7 @@ fn test_full_leader_validator_network() {
|
|||
|
||||
let validator_id = kp.pubkey();
|
||||
let validator_node = Node::new_localhost_with_pubkey(validator_id);
|
||||
let signer_proxy = VoteSignerProxy::new_local(&kp);
|
||||
let voting_keypair = VotingKeypair::new_local(&kp);
|
||||
let leader_scheduler =
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config)));
|
||||
let validator = Fullnode::new(
|
||||
|
@ -1545,7 +1546,7 @@ fn test_full_leader_validator_network() {
|
|||
&kp,
|
||||
&validator_ledger_path,
|
||||
leader_scheduler.clone(),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -1555,14 +1556,14 @@ fn test_full_leader_validator_network() {
|
|||
}
|
||||
|
||||
info!("Start up the bootstrap leader");
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let leader_scheduler = Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config)));
|
||||
let bootstrap_leader = Fullnode::new(
|
||||
bootstrap_leader_node,
|
||||
&leader_keypair,
|
||||
&bootstrap_leader_ledger_path,
|
||||
leader_scheduler.clone(),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
@ -1733,13 +1734,13 @@ fn test_broadcast_last_tick() {
|
|||
|
||||
// Start up the bootstrap leader fullnode
|
||||
let bootstrap_leader_keypair = Arc::new(bootstrap_leader_keypair);
|
||||
let signer_proxy = VoteSignerProxy::new_local(&bootstrap_leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&bootstrap_leader_keypair);
|
||||
let mut bootstrap_leader = Fullnode::new(
|
||||
bootstrap_leader_node,
|
||||
&bootstrap_leader_keypair,
|
||||
&bootstrap_leader_ledger_path,
|
||||
Arc::new(RwLock::new(LeaderScheduler::new(&leader_scheduler_config))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&bootstrap_leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
|
|
@ -16,7 +16,7 @@ use solana::leader_scheduler::LeaderScheduler;
|
|||
use solana::replicator::Replicator;
|
||||
use solana::storage_stage::STORAGE_ROTATE_TEST_COUNT;
|
||||
use solana::streamer::blob_receiver;
|
||||
use solana::vote_signer_proxy::VoteSignerProxy;
|
||||
use solana::voting_keypair::VotingKeypair;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::system_transaction::SystemTransaction;
|
||||
|
@ -47,7 +47,7 @@ fn test_replicator_startup() {
|
|||
tmp_copy_ledger(&leader_ledger_path, "replicator_test_validator_ledger");
|
||||
|
||||
{
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
|
||||
let mut fullnode_config = FullnodeConfig::default();
|
||||
fullnode_config.storage_rotate_count = STORAGE_ROTATE_TEST_COUNT;
|
||||
|
@ -58,13 +58,13 @@ fn test_replicator_startup() {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_info.id.clone(),
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
None,
|
||||
&fullnode_config,
|
||||
);
|
||||
|
||||
let validator_keypair = Arc::new(Keypair::new());
|
||||
let signer_proxy = VoteSignerProxy::new_local(&validator_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
|
||||
let mut leader_client = mk_client(&leader_info);
|
||||
|
||||
|
@ -86,7 +86,7 @@ fn test_replicator_startup() {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_info.id,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_info),
|
||||
&fullnode_config,
|
||||
);
|
||||
|
@ -272,7 +272,7 @@ fn test_replicator_startup_ledger_hang() {
|
|||
tmp_copy_ledger(&leader_ledger_path, "replicator_test_validator_ledger");
|
||||
|
||||
{
|
||||
let signer_proxy = VoteSignerProxy::new_local(&leader_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
|
||||
let _ = Fullnode::new(
|
||||
leader_node,
|
||||
|
@ -281,13 +281,13 @@ fn test_replicator_startup_ledger_hang() {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_info.id.clone(),
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
None,
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
||||
let validator_keypair = Arc::new(Keypair::new());
|
||||
let signer_proxy = VoteSignerProxy::new_local(&validator_keypair);
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
let validator_node = Node::new_localhost_with_pubkey(validator_keypair.pubkey());
|
||||
|
||||
let _ = Fullnode::new(
|
||||
|
@ -297,7 +297,7 @@ fn test_replicator_startup_ledger_hang() {
|
|||
Arc::new(RwLock::new(LeaderScheduler::from_bootstrap_leader(
|
||||
leader_info.id,
|
||||
))),
|
||||
signer_proxy,
|
||||
voting_keypair,
|
||||
Some(&leader_info),
|
||||
&FullnodeConfig::default(),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue