Rename bootstrap leader (#7906)
* Rename bootstrap leader to bootstrap validator It's a normal validator as soon as other validators enter the leader schedule. * cargo fmt * Fix build Thanks @CriesofCarrots!
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
pub use solana_runtime::genesis_utils::{
|
||||
create_genesis_config_with_leader, GenesisConfigInfo, BOOTSTRAP_LEADER_LAMPORTS,
|
||||
create_genesis_config_with_leader, GenesisConfigInfo, BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
// same as genesis_config::create_genesis_config, but with bootstrap_leader staking logic
|
||||
// same as genesis_config::create_genesis_config, but with bootstrap_validator staking logic
|
||||
// for the core crate tests
|
||||
pub fn create_genesis_config(mint_lamports: u64) -> GenesisConfigInfo {
|
||||
create_genesis_config_with_leader(
|
||||
mint_lamports,
|
||||
&Pubkey::new_rand(),
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
)
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ mod tests {
|
||||
blockstore::make_slot_entries,
|
||||
genesis_utils::{
|
||||
create_genesis_config, create_genesis_config_with_leader, GenesisConfigInfo,
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
},
|
||||
get_tmp_ledger_path,
|
||||
staking_utils::tests::setup_vote_and_stake_accounts,
|
||||
@ -376,9 +376,9 @@ mod tests {
|
||||
fn test_next_leader_slot() {
|
||||
let pubkey = Pubkey::new_rand();
|
||||
let mut genesis_config = create_genesis_config_with_leader(
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
&pubkey,
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
)
|
||||
.genesis_config;
|
||||
genesis_config.epoch_schedule = EpochSchedule::custom(
|
||||
@ -427,9 +427,9 @@ mod tests {
|
||||
fn test_next_leader_slot_blockstore() {
|
||||
let pubkey = Pubkey::new_rand();
|
||||
let mut genesis_config = create_genesis_config_with_leader(
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
&pubkey,
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
)
|
||||
.genesis_config;
|
||||
genesis_config.epoch_schedule.warmup = false;
|
||||
@ -525,7 +525,7 @@ mod tests {
|
||||
&mint_keypair,
|
||||
&vote_account,
|
||||
&node_pubkey,
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
);
|
||||
|
||||
// Have to wait until the epoch at after the epoch stakes generated at genesis
|
||||
|
@ -55,14 +55,15 @@ fn sort_stakes(stakes: &mut Vec<(Pubkey, u64)>) {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use solana_runtime::genesis_utils::{
|
||||
create_genesis_config_with_leader, BOOTSTRAP_LEADER_LAMPORTS,
|
||||
create_genesis_config_with_leader, BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_leader_schedule_via_bank() {
|
||||
let pubkey = Pubkey::new_rand();
|
||||
let genesis_config =
|
||||
create_genesis_config_with_leader(0, &pubkey, BOOTSTRAP_LEADER_LAMPORTS).genesis_config;
|
||||
create_genesis_config_with_leader(0, &pubkey, BOOTSTRAP_VALIDATOR_LAMPORTS)
|
||||
.genesis_config;
|
||||
let bank = Bank::new(&genesis_config);
|
||||
|
||||
let pubkeys_and_stakes: Vec<_> = staking_utils::staked_nodes(&bank).into_iter().collect();
|
||||
@ -83,9 +84,9 @@ mod tests {
|
||||
fn test_leader_scheduler1_basic() {
|
||||
let pubkey = Pubkey::new_rand();
|
||||
let genesis_config = create_genesis_config_with_leader(
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
&pubkey,
|
||||
BOOTSTRAP_LEADER_LAMPORTS,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
)
|
||||
.genesis_config;
|
||||
let bank = Bank::new(&genesis_config);
|
||||
|
@ -101,7 +101,7 @@ where
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::genesis_utils::{
|
||||
create_genesis_config, GenesisConfigInfo, BOOTSTRAP_LEADER_LAMPORTS,
|
||||
create_genesis_config, GenesisConfigInfo, BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
};
|
||||
use solana_sdk::{
|
||||
clock::Clock,
|
||||
@ -183,10 +183,10 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn test_epoch_stakes_and_lockouts() {
|
||||
solana_logger::setup();
|
||||
let stake = BOOTSTRAP_LEADER_LAMPORTS * 100;
|
||||
let stake = BOOTSTRAP_VALIDATOR_LAMPORTS * 100;
|
||||
let leader_stake = Stake {
|
||||
delegation: Delegation {
|
||||
stake: BOOTSTRAP_LEADER_LAMPORTS,
|
||||
stake: BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
activation_epoch: std::u64::MAX, // mark as bootstrap
|
||||
..Delegation::default()
|
||||
},
|
||||
@ -205,7 +205,7 @@ pub(crate) mod tests {
|
||||
let vote_account = Keypair::new();
|
||||
|
||||
// Give the validator some stake but don't setup a staking account
|
||||
// Validator has no lamports staked, so they get filtered out. Only the bootstrap leader
|
||||
// Validator has no lamports staked, so they get filtered out. Only the bootstrap validator
|
||||
// created by the genesis config will get included
|
||||
bank.transfer(1, &mint_keypair, &validator.pubkey())
|
||||
.unwrap();
|
||||
|
Reference in New Issue
Block a user