Skip to content

Commit

Permalink
removes old runtime feature gates in gossip and turbine (#16633)
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadnouri authored Apr 26, 2021
1 parent f2ab038 commit 9706512
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 49 deletions.
19 changes: 4 additions & 15 deletions core/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2051,7 +2051,6 @@ impl ClusterInfo {
recycler: &PacketsRecycler,
stakes: &HashMap<Pubkey, u64>,
response_sender: &PacketSender,
feature_set: Option<&FeatureSet>,
require_stake_for_gossip: bool,
) {
let _st = ScopedTimer::from(&self.stats.handle_batch_pull_requests_time);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand All @@ -2176,7 +2167,6 @@ impl ClusterInfo {
recycler: &PacketsRecycler,
requests: Vec<PullData>,
stakes: &HashMap<Pubkey, u64>,
feature_set: Option<&FeatureSet>,
require_stake_for_gossip: bool,
) -> Packets {
let mut time = Measure::start("handle_pull_requests");
Expand All @@ -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)
Expand Down Expand Up @@ -2786,7 +2776,6 @@ impl ClusterInfo {
recycler,
&stakes,
response_sender,
feature_set,
require_stake_for_gossip,
);
Ok(())
Expand Down
26 changes: 2 additions & 24 deletions core/src/retransmit_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 0 additions & 10 deletions sdk/src/feature_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -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");
}
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 9706512

Please sign in to comment.