removes feature gate code adding shred-type to shred seed (#25963)

The feature is already activated on all clusters, and does not impact
processing of ledger/snapshots.
This commit is contained in:
behzad nouri 2022-06-20 14:39:24 +00:00 committed by GitHub
parent f14a361854
commit 47e62add5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 39 deletions

View File

@ -122,7 +122,7 @@ impl ClusterNodes<BroadcastStage> {
socket_addr_space: &SocketAddrSpace,
) -> Vec<SocketAddr> {
const MAX_CONTACT_INFO_AGE: Duration = Duration::from_secs(2 * 60);
let shred_seed = shred.seed(self.pubkey, root_bank);
let shred_seed = shred.seed(self.pubkey);
let mut rng = ChaChaRng::from_seed(shred_seed);
let index = match self.weighted_shuffle.first(&mut rng) {
None => return Vec::default(),
@ -221,7 +221,7 @@ impl ClusterNodes<RetransmitStage> {
Vec<&Node>, // neighbors
Vec<&Node>, // children
) {
let shred_seed = shred.seed(slot_leader, root_bank);
let shred_seed = shred.seed(slot_leader);
let mut weighted_shuffle = self.weighted_shuffle.clone();
// Exclude slot leader from list of nodes.
if slot_leader == self.pubkey {

View File

@ -62,10 +62,8 @@ use {
serde::{Deserialize, Serialize},
solana_entry::entry::{create_ticks, Entry},
solana_perf::packet::{deserialize_from_with_limit, Packet},
solana_runtime::bank::Bank,
solana_sdk::{
clock::Slot,
feature_set,
hash::{hashv, Hash},
pubkey::Pubkey,
signature::{Keypair, Signature, Signer},
@ -433,21 +431,13 @@ impl Shred {
self.set_signature(signature);
}
pub fn seed(&self, leader_pubkey: Pubkey, root_bank: &Bank) -> [u8; 32] {
if add_shred_type_to_shred_seed(self.slot(), root_bank) {
hashv(&[
&self.slot().to_le_bytes(),
&u8::from(self.shred_type()).to_le_bytes(),
&self.index().to_le_bytes(),
&leader_pubkey.to_bytes(),
])
} else {
hashv(&[
&self.slot().to_le_bytes(),
&self.index().to_le_bytes(),
&leader_pubkey.to_bytes(),
])
}
pub fn seed(&self, leader_pubkey: Pubkey) -> [u8; 32] {
hashv(&[
&self.slot().to_le_bytes(),
&u8::from(self.shred_type()).to_le_bytes(),
&self.index().to_le_bytes(),
&leader_pubkey.to_bytes(),
])
.to_bytes()
}
@ -742,21 +732,6 @@ pub fn verify_test_data_shred(
}
}
fn add_shred_type_to_shred_seed(shred_slot: Slot, bank: &Bank) -> bool {
let feature_slot = bank
.feature_set
.activated_slot(&feature_set::add_shred_type_to_shred_seed::id());
match feature_slot {
None => false,
Some(feature_slot) => {
let epoch_schedule = 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
}
}
}
#[cfg(test)]
mod tests {
use {

View File

@ -408,10 +408,6 @@ pub mod include_account_index_in_rent_error {
solana_sdk::declare_id!("2R72wpcQ7qV7aTJWUumdn8u5wmmTyXbK7qzEy7YSAgyY");
}
pub mod add_shred_type_to_shred_seed {
solana_sdk::declare_id!("Ds87KVeqhbv7Jw8W6avsS1mqz3Mw5J3pRTpPoDQ2QdiJ");
}
pub mod warp_timestamp_with_a_vengeance {
solana_sdk::declare_id!("3BX6SBeEBibHaVQXywdkcgyUk6evfYZkHdztXiDtEpFS");
}
@ -544,7 +540,6 @@ lazy_static! {
(add_set_compute_unit_price_ix::id(), "add compute budget ix for setting a compute unit price"),
(disable_deploy_of_alloc_free_syscall::id(), "disable new deployments of deprecated sol_alloc_free_ syscall"),
(include_account_index_in_rent_error::id(), "include account index in rent tx error #25190"),
(add_shred_type_to_shred_seed::id(), "add shred-type to shred seed #25556"),
(warp_timestamp_with_a_vengeance::id(), "warp timestamp again, adjust bounding to 150% slow #25666"),
(separate_nonce_from_blockhash::id(), "separate durable nonce and blockhash domains #25744"),
(enable_durable_nonce::id(), "enable durable nonce #25744"),