passes through feature-set to gossip requests handling (#12878)
* passes through feature-set to down to gossip requests handling * takes the feature-set from root_bank instead of working_bank
This commit is contained in:
parent
42943ab86d
commit
48283161c3
|
@ -52,6 +52,7 @@ use solana_perf::packet::{
|
||||||
};
|
};
|
||||||
use solana_rayon_threadlimit::get_thread_count;
|
use solana_rayon_threadlimit::get_thread_count;
|
||||||
use solana_runtime::bank_forks::BankForks;
|
use solana_runtime::bank_forks::BankForks;
|
||||||
|
use solana_runtime::feature_set::{self, FeatureSet};
|
||||||
use solana_sdk::hash::Hash;
|
use solana_sdk::hash::Hash;
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_SLOTS_PER_EPOCH},
|
clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_SLOTS_PER_EPOCH},
|
||||||
|
@ -1651,6 +1652,7 @@ impl ClusterInfo {
|
||||||
stakes: &HashMap<Pubkey, u64>,
|
stakes: &HashMap<Pubkey, u64>,
|
||||||
packets: Packets,
|
packets: Packets,
|
||||||
response_sender: &PacketSender,
|
response_sender: &PacketSender,
|
||||||
|
feature_set: Option<&FeatureSet>,
|
||||||
epoch_time_ms: u64,
|
epoch_time_ms: u64,
|
||||||
) {
|
) {
|
||||||
// iter over the packets, collect pulls separately and process everything else
|
// iter over the packets, collect pulls separately and process everything else
|
||||||
|
@ -1781,7 +1783,7 @@ impl ClusterInfo {
|
||||||
self.stats
|
self.stats
|
||||||
.pull_requests_count
|
.pull_requests_count
|
||||||
.add_relaxed(gossip_pull_data.len() as u64);
|
.add_relaxed(gossip_pull_data.len() as u64);
|
||||||
let rsp = self.handle_pull_requests(recycler, gossip_pull_data, stakes);
|
let rsp = self.handle_pull_requests(recycler, gossip_pull_data, stakes, feature_set);
|
||||||
if let Some(rsp) = rsp {
|
if let Some(rsp) = rsp {
|
||||||
let _ignore_disconnect = response_sender.send(rsp);
|
let _ignore_disconnect = response_sender.send(rsp);
|
||||||
}
|
}
|
||||||
|
@ -1809,7 +1811,13 @@ impl ClusterInfo {
|
||||||
recycler: &PacketsRecycler,
|
recycler: &PacketsRecycler,
|
||||||
requests: Vec<PullData>,
|
requests: Vec<PullData>,
|
||||||
stakes: &HashMap<Pubkey, u64>,
|
stakes: &HashMap<Pubkey, u64>,
|
||||||
|
feature_set: Option<&FeatureSet>,
|
||||||
) -> Option<Packets> {
|
) -> Option<Packets> {
|
||||||
|
if matches!(feature_set, Some(feature_set) if
|
||||||
|
feature_set.is_active(&feature_set::pull_request_ping_pong_check::id()))
|
||||||
|
{
|
||||||
|
// TODO: add ping-pong check on pull-request addresses.
|
||||||
|
}
|
||||||
// split the requests into addrs and filters
|
// split the requests into addrs and filters
|
||||||
let mut caller_and_filters = vec![];
|
let mut caller_and_filters = vec![];
|
||||||
let mut addrs = vec![];
|
let mut addrs = vec![];
|
||||||
|
@ -2114,12 +2122,13 @@ impl ClusterInfo {
|
||||||
recycler: &PacketsRecycler,
|
recycler: &PacketsRecycler,
|
||||||
response_sender: &PacketSender,
|
response_sender: &PacketSender,
|
||||||
stakes: HashMap<Pubkey, u64>,
|
stakes: HashMap<Pubkey, u64>,
|
||||||
|
feature_set: Option<&FeatureSet>,
|
||||||
epoch_time_ms: u64,
|
epoch_time_ms: u64,
|
||||||
) {
|
) {
|
||||||
let sender = response_sender.clone();
|
let sender = response_sender.clone();
|
||||||
thread_pool.install(|| {
|
thread_pool.install(|| {
|
||||||
requests.into_par_iter().for_each_with(sender, |s, reqs| {
|
requests.into_par_iter().for_each_with(sender, |s, reqs| {
|
||||||
self.handle_packets(&recycler, &stakes, reqs, s, epoch_time_ms)
|
self.handle_packets(&recycler, &stakes, reqs, s, feature_set, epoch_time_ms)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2153,13 +2162,25 @@ impl ClusterInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
let (stakes, epoch_time_ms) = Self::get_stakes_and_epoch_time(bank_forks);
|
let (stakes, epoch_time_ms) = Self::get_stakes_and_epoch_time(bank_forks);
|
||||||
|
// Using root_bank instead of working_bank here so that an enbaled
|
||||||
|
// feature does not roll back (if the feature happens to get enabled in
|
||||||
|
// a minority fork).
|
||||||
|
let feature_set = bank_forks.map(|bank_forks| {
|
||||||
|
bank_forks
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.root_bank()
|
||||||
|
.deref()
|
||||||
|
.feature_set
|
||||||
|
.clone()
|
||||||
|
});
|
||||||
self.process_packets(
|
self.process_packets(
|
||||||
requests,
|
requests,
|
||||||
thread_pool,
|
thread_pool,
|
||||||
recycler,
|
recycler,
|
||||||
response_sender,
|
response_sender,
|
||||||
stakes,
|
stakes,
|
||||||
|
feature_set.as_deref(),
|
||||||
epoch_time_ms,
|
epoch_time_ms,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,10 @@ pub mod pubkey_log_syscall_enabled {
|
||||||
solana_sdk::declare_id!("MoqiU1vryuCGQSxFKA1SZ316JdLEFFhoAu6cKUNk7dN");
|
solana_sdk::declare_id!("MoqiU1vryuCGQSxFKA1SZ316JdLEFFhoAu6cKUNk7dN");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod pull_request_ping_pong_check {
|
||||||
|
solana_sdk::declare_id!("5RzEHTnf6D7JPZCvwEzjM19kzBsyjSU3HoMfXaQmVgnZ");
|
||||||
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// Map of feature identifiers to user-visible description
|
/// Map of feature identifiers to user-visible description
|
||||||
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
|
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
|
||||||
|
@ -88,6 +92,7 @@ lazy_static! {
|
||||||
(timestamp_correction::id(), "correct bank timestamps"),
|
(timestamp_correction::id(), "correct bank timestamps"),
|
||||||
(cumulative_rent_related_fixes::id(), "rent fixes (#10206, #10468, #11342)"),
|
(cumulative_rent_related_fixes::id(), "rent fixes (#10206, #10468, #11342)"),
|
||||||
(pubkey_log_syscall_enabled::id(), "pubkey log syscall"),
|
(pubkey_log_syscall_enabled::id(), "pubkey log syscall"),
|
||||||
|
(pull_request_ping_pong_check::id(), "ping-pong packet check #12794"),
|
||||||
/*************** ADD NEW FEATURES HERE ***************/
|
/*************** ADD NEW FEATURES HERE ***************/
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Reference in New Issue