Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
apply 'debug_do_not_add_builtins' to feature activations (#18110) (#1…
Browse files Browse the repository at this point in the history
…8150)

(cherry picked from commit fbc94d8)

Co-authored-by: Jeff Washington (jwash) <75863576+jeffwashington@users.noreply.github.com>
  • Loading branch information
mergify[bot] and jeffwashington authored Jun 23, 2021
1 parent 677664e commit f41f3f6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -5108,8 +5112,10 @@ impl Bank {
self.rewrite_stakes();
}

self.ensure_feature_builtins(init_finish_or_warp, &new_feature_activations);
self.reconfigure_token2_native_mint();
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();
}

Expand Down

0 comments on commit f41f3f6

Please sign in to comment.