apply 'debug_do_not_add_builtins' to feature activations (#18110) (#18150)

(cherry picked from commit fbc94d84c8)

Co-authored-by: Jeff Washington (jwash) <75863576+jeffwashington@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2021-06-23 17:34:19 +00:00
committed by GitHub
parent 677664e71d
commit f41f3f6b51

View File

@ -1237,7 +1237,7 @@ impl Bank {
// Following code may touch AccountsDb, requiring proper ancestors
let parent_epoch = parent.epoch();
if parent_epoch < new.epoch() {
new.apply_feature_activations(false);
new.apply_feature_activations(false, false);
}
let cloned = new
@ -1281,7 +1281,7 @@ impl Bank {
pub fn warp_from_parent(parent: &Arc<Bank>, collector_id: &Pubkey, slot: Slot) -> Self {
let parent_timestamp = parent.clock().unix_timestamp;
let mut new = Bank::new_from_parent(parent, collector_id, slot);
new.apply_feature_activations(true);
new.apply_feature_activations(true, false);
new.update_epoch_stakes(new.epoch_schedule().get_epoch(slot));
new.tick_height.store(new.max_tick_height(), Relaxed);
@ -4287,7 +4287,7 @@ impl Bank {
}
self.feature_builtins = Arc::new(builtins.feature_builtins);
self.apply_feature_activations(true);
self.apply_feature_activations(true, debug_do_not_add_builtins);
}
pub fn set_inflation(&self, inflation: Inflation) {
@ -5078,7 +5078,11 @@ impl Bank {
// This is called from snapshot restore AND for each epoch boundary
// The entire code path herein must be idempotent
fn apply_feature_activations(&mut self, init_finish_or_warp: bool) {
fn apply_feature_activations(
&mut self,
init_finish_or_warp: bool,
debug_do_not_add_builtins: bool,
) {
let new_feature_activations = self.compute_active_feature_set(!init_finish_or_warp);
if new_feature_activations.contains(&feature_set::pico_inflation::id()) {
@ -5108,8 +5112,10 @@ impl Bank {
self.rewrite_stakes();
}
if !debug_do_not_add_builtins {
self.ensure_feature_builtins(init_finish_or_warp, &new_feature_activations);
self.reconfigure_token2_native_mint();
}
self.ensure_no_storage_rewards_pool();
}