From 97fd700d5299656e85f961b77aef61ad81411518 Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Fri, 28 Feb 2025 13:52:37 +0000 Subject: [PATCH] rolls out chained Merkle shreds to 100% of mainnet slots (#5088) (cherry picked from commit 2f2dbd11b9ea15a4f48b05101ca31853fd2b33c7) --- .../broadcast_stage/standard_broadcast_run.rs | 45 +++---------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/turbine/src/broadcast_stage/standard_broadcast_run.rs b/turbine/src/broadcast_stage/standard_broadcast_run.rs index f5848f6258743c..84405a80f56ca0 100644 --- a/turbine/src/broadcast_stage/standard_broadcast_run.rs +++ b/turbine/src/broadcast_stage/standard_broadcast_run.rs @@ -11,9 +11,7 @@ use { blockstore, shred::{shred_code, ProcessShredsStats, ReedSolomonCache, Shred, Shredder}, }, - solana_sdk::{ - genesis_config::ClusterType, hash::Hash, signature::Keypair, timing::AtomicInterval, - }, + solana_sdk::{hash::Hash, signature::Keypair, timing::AtomicInterval}, std::{sync::RwLock, time::Duration}, tokio::sync::mpsc::Sender as AsyncSender, }; @@ -76,7 +74,6 @@ impl StandardBroadcastRun { &mut self, keypair: &Keypair, max_ticks_in_slot: u8, - cluster_type: ClusterType, stats: &mut ProcessShredsStats, ) -> Vec { if self.completed { @@ -91,8 +88,7 @@ impl StandardBroadcastRun { keypair, &[], // entries true, // is_last_in_slot, - should_chain_merkle_shreds(self.slot, cluster_type) - .then_some(self.chained_merkle_root), + Some(self.chained_merkle_root), self.next_shred_index, self.next_code_index, true, // merkle_variant @@ -117,7 +113,6 @@ impl StandardBroadcastRun { entries: &[Entry], reference_tick: u8, is_slot_end: bool, - cluster_type: ClusterType, process_stats: &mut ProcessShredsStats, max_data_shreds_per_slot: u32, max_code_shreds_per_slot: u32, @@ -135,8 +130,7 @@ impl StandardBroadcastRun { keypair, entries, is_slot_end, - should_chain_merkle_shreds(self.slot, cluster_type) - .then_some(self.chained_merkle_root), + Some(self.chained_merkle_root), self.next_shred_index, self.next_code_index, true, // merkle_variant @@ -202,17 +196,12 @@ impl StandardBroadcastRun { let mut process_stats = ProcessShredsStats::default(); let mut to_shreds_time = Measure::start("broadcast_to_shreds"); - let cluster_type = bank.cluster_type(); if self.slot != bank.slot() { // Finish previous slot if it was interrupted. if !self.completed { - let shreds = self.finish_prev_slot( - keypair, - bank.ticks_per_slot() as u8, - cluster_type, - &mut process_stats, - ); + let shreds = + self.finish_prev_slot(keypair, bank.ticks_per_slot() as u8, &mut process_stats); debug_assert!(shreds.iter().all(|shred| shred.slot() == self.slot)); // Broadcast shreds for the interrupted slot. let batch_info = Some(BroadcastShredBatchInfo { @@ -279,7 +268,6 @@ impl StandardBroadcastRun { &receive_results.entries, reference_tick as u8, is_last_in_slot, - cluster_type, &mut process_stats, blockstore::MAX_DATA_SHREDS_PER_SLOT as u32, shred_code::MAX_CODE_SHREDS_PER_SLOT as u32, @@ -507,16 +495,6 @@ impl BroadcastRun for StandardBroadcastRun { } } -fn should_chain_merkle_shreds(slot: Slot, cluster_type: ClusterType) -> bool { - match cluster_type { - ClusterType::Development => true, - ClusterType::Devnet => true, - // Roll out chained Merkle shreds to ~53% of mainnet slots. - ClusterType::MainnetBeta => slot % 19 < 10, - ClusterType::Testnet => true, - } -} - #[cfg(test)] mod test { use { @@ -604,7 +582,6 @@ mod test { let shreds = run.finish_prev_slot( &keypair, 0, // max_ticks_in_slot - ClusterType::Development, &mut ProcessShredsStats::default(), ); assert!(run.completed); @@ -854,7 +831,6 @@ mod test { &entries[0..entries.len() - 2], 0, false, - ClusterType::Development, &mut stats, 1000, 1000, @@ -864,16 +840,7 @@ mod test { assert!(!data.is_empty()); assert!(!coding.is_empty()); - let r = bs.entries_to_shreds( - &keypair, - &entries, - 0, - false, - ClusterType::Development, - &mut stats, - 10, - 10, - ); + let r = bs.entries_to_shreds(&keypair, &entries, 0, false, &mut stats, 10, 10); info!("{:?}", r); assert_matches!(r, Err(BroadcastError::TooManyShreds)); }