Skip to content

Commit

Permalink
Fixes test_runtime_feature_enable_with_program_cache().
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Oct 24, 2023
1 parent 580e452 commit a29f8cc
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12504,8 +12504,14 @@ fn test_runtime_feature_enable_with_program_cache() {
genesis_config
.accounts
.remove(&feature_set::reject_callx_r10::id());
let mut bank_forks = BankForks::new(Bank::new_for_tests(&genesis_config));
let bank_forks = BankForks::new(Bank::new_for_tests(&genesis_config));
let root_bank = bank_forks.root_bank();
let bank_forks = Arc::new(RwLock::new(bank_forks));
root_bank
.loaded_programs_cache
.write()
.unwrap()
.set_fork_graph(bank_forks.clone());

// Test a basic transfer
let amount = genesis_config.rent.minimum_balance(0);
Expand Down Expand Up @@ -12564,9 +12570,19 @@ fn test_runtime_feature_enable_with_program_cache() {

// Reroot to call LoadedPrograms::prune() and end the current recompilation phase
goto_end_of_slot(bank.clone());
bank_forks.insert(Arc::into_inner(bank).unwrap());
let bank = bank_forks.working_bank();
bank_forks.set_root(bank.slot, &AbsRequestSender::default(), None);
bank_forks
.write()
.unwrap()
.insert(Arc::into_inner(bank).unwrap());
let bank = bank_forks.read().unwrap().working_bank();
bank.loaded_programs_cache
.write()
.unwrap()
.prune(bank.slot, bank.epoch());
bank_forks
.write()
.unwrap()
.set_root(bank.slot, &AbsRequestSender::default(), None);

// Advance to next epoch, which starts the next recompilation phase
let bank = new_from_parent_next_epoch(bank, 1);
Expand Down

0 comments on commit a29f8cc

Please sign in to comment.