From 34308e2b3a7691b3f20a6c55bceb67a19ac20ded Mon Sep 17 00:00:00 2001 From: Joe C Date: Tue, 19 Mar 2024 07:42:06 -0500 Subject: [PATCH] runtime: snapshot minimizer: use builtin IDs from bank --- runtime/src/bank.rs | 4 ++++ runtime/src/snapshot_minimizer.rs | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6bf7c9b87c0eb0..4f878cf7e00d1f 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6064,6 +6064,10 @@ impl Bank { } } + pub(crate) fn get_builtin_program_ids(&self) -> &HashSet { + &self.builtin_program_ids + } + // Hi! leaky abstraction here.... // try to use get_account_with_fixed_root() if it's called ONLY from on-chain runtime account // processing. That alternative fn provides more safety. diff --git a/runtime/src/snapshot_minimizer.rs b/runtime/src/snapshot_minimizer.rs index ddd47c887ab7bb..009444b962ed48 100644 --- a/runtime/src/snapshot_minimizer.rs +++ b/runtime/src/snapshot_minimizer.rs @@ -1,10 +1,7 @@ //! Used to create minimal snapshots - separated here to keep accounts_db simpler use { - crate::{ - bank::{builtins::BUILTINS, Bank}, - static_ids, - }, + crate::{bank::Bank, static_ids}, dashmap::DashSet, log::info, rayon::{ @@ -116,9 +113,12 @@ impl<'a> SnapshotMinimizer<'a> { /// Used to get builtin accounts in `minimize` fn get_builtins(&self) { - BUILTINS.iter().for_each(|e| { - self.minimized_account_set.insert(e.program_id); - }); + self.bank + .get_builtin_program_ids() + .iter() + .for_each(|program_id| { + self.minimized_account_set.insert(*program_id); + }); } /// Used to get static runtime accounts in `minimize`