use stake config to defeat warmup in local_cluster (#5549)
* use stake config to defeat warmup in local_cluster * fixups
This commit is contained in:
parent
52c2191545
commit
01eb7600d9
|
@ -75,6 +75,7 @@ impl Tower {
|
|||
if lamports == 0 {
|
||||
continue;
|
||||
}
|
||||
trace!("{} {} with stake {}", self.node_pubkey, key, lamports);
|
||||
let vote_state = VoteState::from(&account);
|
||||
if vote_state.is_none() {
|
||||
datapoint_warn!(
|
||||
|
|
|
@ -1,32 +1,37 @@
|
|||
use solana::blocktree::create_new_tmp_ledger;
|
||||
use solana::cluster::Cluster;
|
||||
use solana::cluster_info::{Node, FULLNODE_PORT_RANGE};
|
||||
use solana::contact_info::ContactInfo;
|
||||
use solana::genesis_utils::{create_genesis_block_with_leader, GenesisBlockInfo};
|
||||
use solana::gossip_service::discover_cluster;
|
||||
use solana::replicator::Replicator;
|
||||
use solana::service::Service;
|
||||
use solana::validator::{Validator, ValidatorConfig};
|
||||
use solana_client::thin_client::create_client;
|
||||
use solana_client::thin_client::ThinClient;
|
||||
use solana_sdk::client::SyncClient;
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::message::Message;
|
||||
use solana_sdk::poh_config::PohConfig;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::system_transaction;
|
||||
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
|
||||
use solana_sdk::timing::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT};
|
||||
use solana_sdk::transaction::Transaction;
|
||||
use solana_stake_api::{stake_instruction, stake_state::StakeState};
|
||||
use solana::{
|
||||
blocktree::create_new_tmp_ledger,
|
||||
cluster::Cluster,
|
||||
cluster_info::{Node, FULLNODE_PORT_RANGE},
|
||||
contact_info::ContactInfo,
|
||||
genesis_utils::{create_genesis_block_with_leader, GenesisBlockInfo},
|
||||
gossip_service::discover_cluster,
|
||||
replicator::Replicator,
|
||||
service::Service,
|
||||
validator::{Validator, ValidatorConfig},
|
||||
};
|
||||
use solana_client::thin_client::{create_client, ThinClient};
|
||||
use solana_sdk::{
|
||||
client::SyncClient,
|
||||
genesis_block::GenesisBlock,
|
||||
message::Message,
|
||||
poh_config::PohConfig,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, KeypairUtil},
|
||||
system_transaction,
|
||||
timing::DEFAULT_TICKS_PER_SLOT,
|
||||
timing::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT},
|
||||
transaction::Transaction,
|
||||
};
|
||||
use solana_stake_api::{config as stake_config, stake_instruction, stake_state::StakeState};
|
||||
use solana_storage_api::{storage_contract, storage_instruction};
|
||||
use solana_vote_api::{vote_instruction, vote_state::VoteState};
|
||||
use std::collections::HashMap;
|
||||
use std::fs::remove_dir_all;
|
||||
use std::io::{Error, ErrorKind, Result};
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs::remove_dir_all,
|
||||
io::{Error, ErrorKind, Result},
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
pub struct ValidatorInfo {
|
||||
pub keypair: Arc<Keypair>,
|
||||
|
@ -164,6 +169,19 @@ impl LocalCluster {
|
|||
storage_contract::create_validator_storage_account(leader_pubkey, 1),
|
||||
));
|
||||
|
||||
// override staking config
|
||||
genesis_block.accounts.push((
|
||||
stake_config::id(),
|
||||
stake_config::create_account(
|
||||
1,
|
||||
&stake_config::Config {
|
||||
warmup_rate: 1_000_000_000.0f64,
|
||||
cooldown_rate: 1_000_000_000.0f64,
|
||||
slash_penalty: std::u8::MAX,
|
||||
},
|
||||
),
|
||||
));
|
||||
|
||||
let (leader_ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_block);
|
||||
let leader_contact_info = leader_node.info.clone();
|
||||
let leader_storage_keypair = Arc::new(storage_keypair);
|
||||
|
|
Loading…
Reference in New Issue