From a29f8cca0a69dc1eef4aadfd36a523054867906d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Tue, 24 Oct 2023 18:35:15 +0000 Subject: [PATCH] Fixes test_runtime_feature_enable_with_program_cache(). --- runtime/src/bank/tests.rs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/runtime/src/bank/tests.rs b/runtime/src/bank/tests.rs index 88ffab9f196ee5..91a0bd07d25cc0 100644 --- a/runtime/src/bank/tests.rs +++ b/runtime/src/bank/tests.rs @@ -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); @@ -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);