From f65bd57f0e87ef278fa04026184430f39d7402b4 Mon Sep 17 00:00:00 2001 From: steviez Date: Wed, 31 Jul 2024 17:53:41 -0500 Subject: [PATCH] Shorten the ClusterInfoVoteListener leader lookahead window The ClusterInfoVoteListener is responsible for forwarding votes to BankingStage. The service only forwards votes when the node will be leader soon, and it determines this by checking the PohRecorder. As currently written, the service will begin forwarding when the node will be leader in slot_hashes::MAX_ENTRIES * 3 slots. This comes out to 512 * 3 = 1536 slots. However, any transaction with a blockhash exeeding MAX_PROCESSING_AGE (150) non-skipped slots is expired and invalid. Thus, there is no point in sending votes to BankingStage until we are within MAX_PROCESSING_AGE (150) slots of our leader window. So, shorten the lookead window down to MAX_PROCESSING_AGE slots. --- core/src/cluster_info_vote_listener.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/cluster_info_vote_listener.rs b/core/src/cluster_info_vote_listener.rs index ae90a97b88377f..8dfb7271e99854 100644 --- a/core/src/cluster_info_vote_listener.rs +++ b/core/src/cluster_info_vote_listener.rs @@ -30,11 +30,10 @@ use { epoch_stakes::EpochStakes, vote_sender_types::ReplayVoteReceiver, }, solana_sdk::{ - clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_TICKS_PER_SLOT}, + clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE}, hash::Hash, pubkey::Pubkey, signature::Signature, - slot_hashes, timing::AtomicInterval, transaction::Transaction, }, @@ -392,7 +391,7 @@ impl ClusterInfoVoteListener { let would_be_leader = poh_recorder .read() .unwrap() - .would_be_leader(3 * slot_hashes::MAX_ENTRIES as u64 * DEFAULT_TICKS_PER_SLOT); + .would_be_leader(MAX_PROCESSING_AGE as u64 * DEFAULT_TICKS_PER_SLOT); if let Err(e) = verified_vote_packets.receive_and_process_vote_packets( &verified_vote_label_packets_receiver,