`solana-validator monitor` how displays slot and gossip stake % while waiting for supermajority

This commit is contained in:
Michael Vines 2022-08-10 08:46:06 -07:00
parent 82dc789362
commit 4e79d78629
1 changed files with 21 additions and 7 deletions

View File

@ -259,14 +259,23 @@ impl ValidatorConfig {
pub enum ValidatorStartProgress { pub enum ValidatorStartProgress {
Initializing, // Catch all, default state Initializing, // Catch all, default state
SearchingForRpcService, SearchingForRpcService,
DownloadingSnapshot { slot: Slot, rpc_addr: SocketAddr }, DownloadingSnapshot {
slot: Slot,
rpc_addr: SocketAddr,
},
CleaningBlockStore, CleaningBlockStore,
CleaningAccounts, CleaningAccounts,
LoadingLedger, LoadingLedger,
ProcessingLedger { slot: Slot, max_slot: Slot }, ProcessingLedger {
slot: Slot,
max_slot: Slot,
},
StartingServices, StartingServices,
Halted, // Validator halted due to `--dev-halt-at-slot` argument Halted, // Validator halted due to `--dev-halt-at-slot` argument
WaitingForSupermajority, WaitingForSupermajority {
slot: Slot,
gossip_stake_percent: u64,
},
// `Running` is the terminal state once the validator fully starts and all services are // `Running` is the terminal state once the validator fully starts and all services are
// operational // operational
@ -1890,20 +1899,20 @@ fn wait_for_supermajority(
) -> Result<bool, ValidatorError> { ) -> Result<bool, ValidatorError> {
match config.wait_for_supermajority { match config.wait_for_supermajority {
None => Ok(false), None => Ok(false),
Some(wait_for_supermajority) => { Some(wait_for_supermajority_slot) => {
if let Some(process_blockstore) = process_blockstore { if let Some(process_blockstore) = process_blockstore {
process_blockstore.process(); process_blockstore.process();
} }
let bank = bank_forks.read().unwrap().working_bank(); let bank = bank_forks.read().unwrap().working_bank();
match wait_for_supermajority.cmp(&bank.slot()) { match wait_for_supermajority_slot.cmp(&bank.slot()) {
std::cmp::Ordering::Less => return Ok(false), std::cmp::Ordering::Less => return Ok(false),
std::cmp::Ordering::Greater => { std::cmp::Ordering::Greater => {
error!( error!(
"Ledger does not have enough data to wait for supermajority, \ "Ledger does not have enough data to wait for supermajority, \
please enable snapshot fetch. Has {} needs {}", please enable snapshot fetch. Has {} needs {}",
bank.slot(), bank.slot(),
wait_for_supermajority wait_for_supermajority_slot
); );
return Err(ValidatorError::NotEnoughLedgerData); return Err(ValidatorError::NotEnoughLedgerData);
} }
@ -1921,7 +1930,6 @@ fn wait_for_supermajority(
} }
} }
*start_progress.write().unwrap() = ValidatorStartProgress::WaitingForSupermajority;
for i in 1.. { for i in 1.. {
if i % 10 == 1 { if i % 10 == 1 {
info!( info!(
@ -1934,6 +1942,12 @@ fn wait_for_supermajority(
let gossip_stake_percent = let gossip_stake_percent =
get_stake_percent_in_gossip(&bank, cluster_info, i % 10 == 0); get_stake_percent_in_gossip(&bank, cluster_info, i % 10 == 0);
*start_progress.write().unwrap() =
ValidatorStartProgress::WaitingForSupermajority {
slot: wait_for_supermajority_slot,
gossip_stake_percent,
};
if gossip_stake_percent >= WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT { if gossip_stake_percent >= WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT {
info!( info!(
"Supermajority reached, {}% active stake detected, starting up now.", "Supermajority reached, {}% active stake detected, starting up now.",