Skip to content

Commit

Permalink
Shorten the ClusterInfoVoteListener leader lookahead window
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
steviez committed Jul 31, 2024
1 parent 2fce82b commit f65bd57
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/src/cluster_info_vote_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f65bd57

Please sign in to comment.