From 0167daa116611c8bb43571d3a3af2c003c15608a Mon Sep 17 00:00:00 2001 From: Jack May Date: Wed, 28 Jul 2021 10:25:33 -0700 Subject: [PATCH] cleanup feature consistent_recent_blockhashes_sysvar (#18932) --- runtime/src/accounts.rs | 18 +----------------- runtime/src/bank.rs | 26 +++++--------------------- sdk/src/feature_set.rs | 5 ----- 3 files changed, 6 insertions(+), 43 deletions(-) diff --git a/runtime/src/accounts.rs b/runtime/src/accounts.rs index d2cd586a6d..eb3b473a19 100644 --- a/runtime/src/accounts.rs +++ b/runtime/src/accounts.rs @@ -890,7 +890,6 @@ impl Accounts { loaded: &'a mut [TransactionLoadResult], rent_collector: &RentCollector, last_blockhash_with_fee_calculator: &(Hash, FeeCalculator), - fix_recent_blockhashes_sysvar_delay: bool, rent_for_sysvars: bool, ) { let accounts_to_store = self.collect_accounts_to_store( @@ -899,7 +898,6 @@ impl Accounts { loaded, rent_collector, last_blockhash_with_fee_calculator, - fix_recent_blockhashes_sysvar_delay, rent_for_sysvars, ); self.accounts_db.store_cached(slot, &accounts_to_store); @@ -924,7 +922,6 @@ impl Accounts { loaded: &'a mut [TransactionLoadResult], rent_collector: &RentCollector, last_blockhash_with_fee_calculator: &(Hash, FeeCalculator), - fix_recent_blockhashes_sysvar_delay: bool, rent_for_sysvars: bool, ) -> Vec<(&'a Pubkey, &'a AccountSharedData)> { let mut accounts = Vec::with_capacity(loaded.len()); @@ -963,7 +960,6 @@ impl Accounts { res, maybe_nonce_rollback, last_blockhash_with_fee_calculator, - fix_recent_blockhashes_sysvar_delay, ); if fee_payer_index.is_none() { fee_payer_index = Some(i); @@ -1011,21 +1007,13 @@ pub fn prepare_if_nonce_account( tx_result: &Result<()>, maybe_nonce_rollback: Option<(&Pubkey, &AccountSharedData, Option<&AccountSharedData>)>, last_blockhash_with_fee_calculator: &(Hash, FeeCalculator), - fix_recent_blockhashes_sysvar_delay: bool, ) -> bool { if let Some((nonce_key, nonce_acc, _maybe_fee_account)) = maybe_nonce_rollback { if account_pubkey == nonce_key { - let overwrite = if tx_result.is_err() { + if tx_result.is_err() { // Nonce TX failed with an InstructionError. Roll back // its account state *account = nonce_acc.clone(); - true - } else { - // Retain overwrite on successful transactions until - // recent_blockhashes_sysvar_delay fix is activated - !fix_recent_blockhashes_sysvar_delay - }; - if overwrite { // Since hash_age_kind is DurableNonce, unwrap is safe here let state = StateMut::::state(nonce_acc) .unwrap() @@ -1987,7 +1975,6 @@ mod tests { &rent_collector, &(Hash::default(), FeeCalculator::default()), true, - true, ); assert_eq!(collected_accounts.len(), 2); assert!(collected_accounts @@ -2140,7 +2127,6 @@ mod tests { tx_result, maybe_nonce_rollback, last_blockhash_with_fee_calculator, - true, ); expect_account == account } @@ -2358,7 +2344,6 @@ mod tests { &rent_collector, &(next_blockhash, FeeCalculator::default()), true, - true, ); assert_eq!(collected_accounts.len(), 2); assert_eq!( @@ -2475,7 +2460,6 @@ mod tests { &rent_collector, &(next_blockhash, FeeCalculator::default()), true, - true, ); assert_eq!(collected_accounts.len(), 1); let collected_nonce_account = collected_accounts diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index ad10f67078..2cb045fe34 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -1297,10 +1297,6 @@ impl Bank { new.update_stake_history(Some(parent_epoch)); new.update_clock(Some(parent_epoch)); new.update_fees(); - if !new.fix_recent_blockhashes_sysvar_delay() { - new.update_recent_blockhashes(); - } - new } @@ -2662,9 +2658,7 @@ impl Bank { let mut w_blockhash_queue = self.blockhash_queue.write().unwrap(); if self.is_block_boundary(self.tick_height.load(Relaxed) + 1) { w_blockhash_queue.register_hash(hash, &self.fee_calculator); - if self.fix_recent_blockhashes_sysvar_delay() { - self.update_recent_blockhashes_locked(&w_blockhash_queue); - } + self.update_recent_blockhashes_locked(&w_blockhash_queue); } // ReplayStage will start computing the accounts delta hash when it // detects the tick height has reached the boundary, so the system @@ -3524,7 +3518,6 @@ impl Bank { loaded_txs, &self.rent_collector, &self.last_blockhash_with_fee_calculator(), - self.fix_recent_blockhashes_sysvar_delay(), self.rent_for_sysvars(), ); let rent_debits = self.collect_rent(executed, loaded_txs); @@ -5496,15 +5489,6 @@ impl Bank { } } - fn fix_recent_blockhashes_sysvar_delay(&self) -> bool { - match self.cluster_type() { - ClusterType::Development | ClusterType::Devnet | ClusterType::Testnet => true, - ClusterType::MainnetBeta => self - .feature_set - .is_active(&feature_set::consistent_recent_blockhashes_sysvar::id()), - } - } - fn rent_for_sysvars(&self) -> bool { self.feature_set .is_active(&feature_set::rent_for_sysvars::id()) @@ -10885,25 +10869,25 @@ pub(crate) mod tests { if bank.slot == 0 { assert_eq!( bank.hash().to_string(), - "BfvaoHkrQwrkQo7T1mW6jmJXveRy11rut8bva2H1Rt5H" + "DqaWg7EVKzb5Fpe92zNBtXAWqLwcedgHDicYrCBnf3QK" ); } if bank.slot == 32 { assert_eq!( bank.hash().to_string(), - "JBGPApnSMPKZaYiR16v46XSSGcKxy8kCbVtN1CG1XDxW" + "AYdhzhKrM74r9XuZBDGcHeFzg2DEtp1boggnEnzDjZSq" ); } if bank.slot == 64 { assert_eq!( bank.hash().to_string(), - "BDCt9cGPfxpgJXzp8Tq1nX1zSqpbs8xrkAFyRhmXKiuX" + "EsbPVYzo1qz5reEUH5okKW4ExB6WbcidkVdW5mzpFn7C" ); } if bank.slot == 128 { assert_eq!( bank.hash().to_string(), - "4zUpK4VUhKLaPUgeMMSeDR2w827goriRL5NndJxGDVmz" + "H3DWrQ6FqbLkFNDxbWQ62UKRbw2dbuxf3oVF2VpBk6Ga" ); break; } diff --git a/sdk/src/feature_set.rs b/sdk/src/feature_set.rs index fdbb390e78..01005912c0 100644 --- a/sdk/src/feature_set.rs +++ b/sdk/src/feature_set.rs @@ -30,10 +30,6 @@ pub mod instructions_sysvar_enabled { solana_sdk::declare_id!("EnvhHCLvg55P7PDtbvR1NwuTuAeodqpusV3MR5QEK8gs"); } -pub mod consistent_recent_blockhashes_sysvar { - solana_sdk::declare_id!("3h1BQWPDS5veRsq6mDBWruEpgPxRJkfwGexg5iiQ9mYg"); -} - pub mod deprecate_rewards_sysvar { solana_sdk::declare_id!("GaBtBJvmS4Arjj5W1NmFcyvPjsHN38UGYDq2MDwbs9Qu"); } @@ -203,7 +199,6 @@ lazy_static! { /// Map of feature identifiers to user-visible description pub static ref FEATURE_NAMES: HashMap = [ (instructions_sysvar_enabled::id(), "instructions sysvar"), - (consistent_recent_blockhashes_sysvar::id(), "consistent recentblockhashes sysvar"), (deprecate_rewards_sysvar::id(), "deprecate unused rewards sysvar"), (pico_inflation::id(), "pico inflation"), (full_inflation::devnet_and_testnet::id(), "full inflation on devnet and testnet"),