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 {
|
if lamports == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
trace!("{} {} with stake {}", self.node_pubkey, key, lamports);
|
||||||
let vote_state = VoteState::from(&account);
|
let vote_state = VoteState::from(&account);
|
||||||
if vote_state.is_none() {
|
if vote_state.is_none() {
|
||||||
datapoint_warn!(
|
datapoint_warn!(
|
||||||
|
@ -1,32 +1,37 @@
|
|||||||
use solana::blocktree::create_new_tmp_ledger;
|
use solana::{
|
||||||
use solana::cluster::Cluster;
|
blocktree::create_new_tmp_ledger,
|
||||||
use solana::cluster_info::{Node, FULLNODE_PORT_RANGE};
|
cluster::Cluster,
|
||||||
use solana::contact_info::ContactInfo;
|
cluster_info::{Node, FULLNODE_PORT_RANGE},
|
||||||
use solana::genesis_utils::{create_genesis_block_with_leader, GenesisBlockInfo};
|
contact_info::ContactInfo,
|
||||||
use solana::gossip_service::discover_cluster;
|
genesis_utils::{create_genesis_block_with_leader, GenesisBlockInfo},
|
||||||
use solana::replicator::Replicator;
|
gossip_service::discover_cluster,
|
||||||
use solana::service::Service;
|
replicator::Replicator,
|
||||||
use solana::validator::{Validator, ValidatorConfig};
|
service::Service,
|
||||||
use solana_client::thin_client::create_client;
|
validator::{Validator, ValidatorConfig},
|
||||||
use solana_client::thin_client::ThinClient;
|
};
|
||||||
use solana_sdk::client::SyncClient;
|
use solana_client::thin_client::{create_client, ThinClient};
|
||||||
use solana_sdk::genesis_block::GenesisBlock;
|
use solana_sdk::{
|
||||||
use solana_sdk::message::Message;
|
client::SyncClient,
|
||||||
use solana_sdk::poh_config::PohConfig;
|
genesis_block::GenesisBlock,
|
||||||
use solana_sdk::pubkey::Pubkey;
|
message::Message,
|
||||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
poh_config::PohConfig,
|
||||||
use solana_sdk::system_transaction;
|
pubkey::Pubkey,
|
||||||
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
|
signature::{Keypair, KeypairUtil},
|
||||||
use solana_sdk::timing::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT};
|
system_transaction,
|
||||||
use solana_sdk::transaction::Transaction;
|
timing::DEFAULT_TICKS_PER_SLOT,
|
||||||
use solana_stake_api::{stake_instruction, stake_state::StakeState};
|
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_storage_api::{storage_contract, storage_instruction};
|
||||||
use solana_vote_api::{vote_instruction, vote_state::VoteState};
|
use solana_vote_api::{vote_instruction, vote_state::VoteState};
|
||||||
use std::collections::HashMap;
|
use std::{
|
||||||
use std::fs::remove_dir_all;
|
collections::HashMap,
|
||||||
use std::io::{Error, ErrorKind, Result};
|
fs::remove_dir_all,
|
||||||
use std::path::PathBuf;
|
io::{Error, ErrorKind, Result},
|
||||||
use std::sync::Arc;
|
path::PathBuf,
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct ValidatorInfo {
|
pub struct ValidatorInfo {
|
||||||
pub keypair: Arc<Keypair>,
|
pub keypair: Arc<Keypair>,
|
||||||
@ -164,6 +169,19 @@ impl LocalCluster {
|
|||||||
storage_contract::create_validator_storage_account(leader_pubkey, 1),
|
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_ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_block);
|
||||||
let leader_contact_info = leader_node.info.clone();
|
let leader_contact_info = leader_node.info.clone();
|
||||||
let leader_storage_keypair = Arc::new(storage_keypair);
|
let leader_storage_keypair = Arc::new(storage_keypair);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user