From b442d9d36ad31d0144293dab48ab23b9003d1299 Mon Sep 17 00:00:00 2001 From: ksolana <110843012+ksolana@users.noreply.github.com> Date: Mon, 22 Jul 2024 22:29:36 -0700 Subject: [PATCH 1/2] Add removed line from PR1192 --- svm/src/transaction_processor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 5a8b5e37ce0b92..d75cfabce72927 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -592,6 +592,7 @@ impl TransactionBatchProcessor { }; if let Some((key, program)) = program_to_store { + loaded_programs_for_txs.as_mut().unwrap().loaded_missing = true; let mut program_cache = self.program_cache.write().unwrap(); // Submit our last completed loading task. if program_cache.finish_cooperative_loading_task(self.slot, key, program) From 305a62262e7b4d35df9a9cbb3a77742357058709 Mon Sep 17 00:00:00 2001 From: ksolana <110843012+ksolana@users.noreply.github.com> Date: Tue, 23 Jul 2024 07:39:48 -0700 Subject: [PATCH 2/2] Test missing programs were loaded --- svm/src/transaction_processor.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index d75cfabce72927..e5e8af2f9a35e0 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -551,7 +551,7 @@ impl TransactionBatchProcessor { }) .collect(); - let mut loaded_programs_for_txs = None; + let mut loaded_programs_for_txs: Option = None; loop { let (program_to_store, task_cookie, task_waiter) = { // Lock the global cache. @@ -1336,6 +1336,7 @@ mod tests { let mut account_maps: HashMap = HashMap::new(); account_maps.insert(key, 4); + let mut loaded_missing = 0; for limit_to_load_programs in [false, true] { let result = batch_processor.replenish_program_cache( @@ -1345,12 +1346,17 @@ mod tests { limit_to_load_programs, ); assert!(!result.hit_max_limit); + if result.loaded_missing { + loaded_missing += 1; + } + let program = result.find(&key).unwrap(); assert!(matches!( program.program, ProgramCacheEntryType::FailedVerification(_) )); } + assert!(loaded_missing > 0); } #[test]