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 19, 2024
1 parent b5d9440 commit b451c9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6061,6 +6061,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
11 changes: 7 additions & 4 deletions runtime/src/snapshot_minimizer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Used to create minimal snapshots - separated here to keep accounts_db simpler
use {
crate::{bank::Bank, builtins::BUILTINS, static_ids},
crate::{bank::Bank, static_ids},
dashmap::DashSet,
log::info,
rayon::{
Expand Down Expand Up @@ -113,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 b451c9f

Please sign in to comment.