From 97065121153e38cdd7c91dcc436fa050c2f63bca Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Mon, 26 Apr 2021 17:12:02 +0000 Subject: [PATCH] removes old runtime feature gates in gossip and turbine (#16633) --- core/src/cluster_info.rs | 19 ++++--------------- core/src/retransmit_stage.rs | 26 ++------------------------ sdk/src/feature_set.rs | 10 ---------- 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/core/src/cluster_info.rs b/core/src/cluster_info.rs index e15da0be908165..584463eef0dd9e 100644 --- a/core/src/cluster_info.rs +++ b/core/src/cluster_info.rs @@ -2051,7 +2051,6 @@ impl ClusterInfo { recycler: &PacketsRecycler, stakes: &HashMap, response_sender: &PacketSender, - feature_set: Option<&FeatureSet>, require_stake_for_gossip: bool, ) { let _st = ScopedTimer::from(&self.stats.handle_batch_pull_requests_time); @@ -2094,13 +2093,8 @@ impl ClusterInfo { self.stats .pull_requests_count .add_relaxed(requests.len() as u64); - let response = self.handle_pull_requests( - recycler, - requests, - stakes, - feature_set, - require_stake_for_gossip, - ); + let response = + self.handle_pull_requests(recycler, requests, stakes, require_stake_for_gossip); if !response.is_empty() { self.stats .packets_sent_pull_responses_count @@ -2132,13 +2126,10 @@ impl ClusterInfo { now: Instant, mut rng: &'a mut R, packets: &'a mut Packets, - feature_set: Option<&FeatureSet>, ) -> impl FnMut(&PullData) -> bool + 'a where R: Rng + CryptoRng, { - let check_enabled = matches!(feature_set, Some(feature_set) if - feature_set.is_active(&feature_set::pull_request_ping_pong_check::id())); let mut cache = HashMap::<(Pubkey, SocketAddr), bool>::new(); let mut pingf = move || Ping::new_rand(&mut rng, &self.keypair).ok(); let mut ping_cache = self.ping_cache.write().unwrap(); @@ -2156,7 +2147,7 @@ impl ClusterInfo { .pull_request_ping_pong_check_failed_count .add_relaxed(1) } - check || !check_enabled + check }; // Because pull-responses are sent back to packet.meta.addr() of // incoming pull-requests, pings are also sent to request.from_addr (as @@ -2176,7 +2167,6 @@ impl ClusterInfo { recycler: &PacketsRecycler, requests: Vec, stakes: &HashMap, - feature_set: Option<&FeatureSet>, require_stake_for_gossip: bool, ) -> Packets { let mut time = Measure::start("handle_pull_requests"); @@ -2189,7 +2179,7 @@ impl ClusterInfo { let (caller_and_filters, addrs): (Vec<_>, Vec<_>) = { let mut rng = rand::thread_rng(); let check_pull_request = - self.check_pull_request(Instant::now(), &mut rng, &mut packets, feature_set); + self.check_pull_request(Instant::now(), &mut rng, &mut packets); requests .into_iter() .filter(check_pull_request) @@ -2786,7 +2776,6 @@ impl ClusterInfo { recycler, &stakes, response_sender, - feature_set, require_stake_for_gossip, ); Ok(()) diff --git a/core/src/retransmit_stage.rs b/core/src/retransmit_stage.rs index ae6c7e6f9332d4..0b6777c937da8e 100644 --- a/core/src/retransmit_stage.rs +++ b/core/src/retransmit_stage.rs @@ -28,9 +28,7 @@ use solana_measure::measure::Measure; use solana_metrics::inc_new_counter_error; use solana_perf::packet::{Packet, Packets}; use solana_runtime::{bank::Bank, bank_forks::BankForks}; -use solana_sdk::{ - clock::Slot, epoch_schedule::EpochSchedule, feature_set, pubkey::Pubkey, timing::timestamp, -}; +use solana_sdk::{clock::Slot, epoch_schedule::EpochSchedule, pubkey::Pubkey, timing::timestamp}; use solana_streamer::streamer::PacketReceiver; use std::{ cmp, @@ -273,22 +271,6 @@ fn check_if_first_shred_received( } } -// Returns true if turbine retransmit peers patch (#14565) is enabled. -fn enable_turbine_retransmit_peers_patch(shred_slot: Slot, root_bank: &Bank) -> bool { - let feature_slot = root_bank - .feature_set - .activated_slot(&feature_set::turbine_retransmit_peers_patch::id()); - match feature_slot { - None => false, - Some(feature_slot) => { - let epoch_schedule = root_bank.epoch_schedule(); - let feature_epoch = epoch_schedule.get_epoch(feature_slot); - let shred_epoch = epoch_schedule.get_epoch(shred_slot); - feature_epoch < shred_epoch - } - } -} - // Drops shred slot leader from retransmit peers. // TODO: decide which bank should be used here. fn get_retransmit_peers( @@ -424,17 +406,13 @@ fn retransmit( r_bank.deref(), r_epoch_stakes_cache.deref(), ); - let (my_index, mut shuffled_stakes_and_index) = ClusterInfo::shuffle_peers_and_index( + let (my_index, shuffled_stakes_and_index) = ClusterInfo::shuffle_peers_and_index( &my_id, &r_epoch_stakes_cache.peers, &stakes_and_index, packet.meta.seed, ); peers_len = cmp::max(peers_len, shuffled_stakes_and_index.len()); - // Until the patch is activated, do the old buggy thing. - if !enable_turbine_retransmit_peers_patch(shred_slot, root_bank.deref()) { - shuffled_stakes_and_index.remove(my_index); - } // split off the indexes, we don't need the stakes anymore let indexes: Vec<_> = shuffled_stakes_and_index .into_iter() diff --git a/sdk/src/feature_set.rs b/sdk/src/feature_set.rs index cc88d76eefc5e1..31d771a5631f81 100644 --- a/sdk/src/feature_set.rs +++ b/sdk/src/feature_set.rs @@ -51,10 +51,6 @@ pub mod no_overflow_rent_distribution { solana_sdk::declare_id!("4kpdyrcj5jS47CZb2oJGfVxjYbsMm2Kx97gFyZrxxwXz"); } -pub mod pull_request_ping_pong_check { - solana_sdk::declare_id!("5RzEHTnf6D7JPZCvwEzjM19kzBsyjSU3HoMfXaQmVgnZ"); -} - pub mod stake_program_v2 { solana_sdk::declare_id!("Gvd9gGJZDHGMNf1b3jkxrfBQSR5etrfTQSBNKCvLSFJN"); } @@ -75,10 +71,6 @@ pub mod stake_program_v3 { solana_sdk::declare_id!("Ego6nTu7WsBcZBvVqJQKp6Yku2N3mrfG8oYCfaLZkAeK"); } -pub mod turbine_retransmit_peers_patch { - solana_sdk::declare_id!("5Lu3JnWSFwRYpXzwDMkanWSk6XqSuF2i5fpnVhzB5CTc"); -} - pub mod require_custodian_for_locked_stake_authorize { solana_sdk::declare_id!("D4jsDcXaqdW8tDAWn8H4R25Cdns2YwLneujSL1zvjW6R"); } @@ -149,13 +141,11 @@ lazy_static! { (full_inflation::devnet_and_testnet::id(), "full inflation on devnet and testnet"), (spl_token_v2_multisig_fix::id(), "spl-token multisig fix"), (no_overflow_rent_distribution::id(), "no overflow rent distribution"), - (pull_request_ping_pong_check::id(), "ping-pong packet check #12794"), (stake_program_v2::id(), "solana_stake_program v2"), (rewrite_stake::id(), "rewrite stake"), (filter_stake_delegation_accounts::id(), "filter stake_delegation_accounts #14062"), (bpf_loader_upgradeable_program::id(), "upgradeable bpf loader"), (stake_program_v3::id(), "solana_stake_program v3"), - (turbine_retransmit_peers_patch::id(), "turbine retransmit peers patch #14631"), (require_custodian_for_locked_stake_authorize::id(), "require custodian to authorize withdrawer change for locked stake"), (spl_token_v2_self_transfer_fix::id(), "spl-token self-transfer fix"), (full_inflation::mainnet::certusone::enable::id(), "full inflation enabled by Certus One"),