Skip to content

Commit

Permalink
runtime: snapshot minimizer: use builtin IDs from bank
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Mar 21, 2024
1 parent bc20558 commit 34308e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6064,6 +6064,10 @@ impl Bank {
}
}

pub(crate) fn get_builtin_program_ids(&self) -> &HashSet<Pubkey> {
&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.
Expand Down
14 changes: 7 additions & 7 deletions runtime/src/snapshot_minimizer.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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`
Expand Down

0 comments on commit 34308e2

Please sign in to comment.