Skip to content

Commit

Permalink
SVM: drop get_program_match_critera from callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Jun 20, 2024
1 parent 334b73a commit 7a8d3a9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
16 changes: 1 addition & 15 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,7 @@ use {
solana_perf::perf_libs,
solana_program_runtime::{
invoke_context::BuiltinFunctionWithContext,
loaded_programs::{
ProgramCacheEntry, ProgramCacheEntryOwner, ProgramCacheEntryType,
ProgramCacheMatchCriteria,
},
loaded_programs::{ProgramCacheEntry, ProgramCacheEntryOwner, ProgramCacheEntryType},
timings::{ExecuteTimingType, ExecuteTimings},
},
solana_sdk::{
Expand Down Expand Up @@ -6794,17 +6791,6 @@ impl TransactionProcessingCallback for Bank {
.map(|(acc, _)| acc)
}

fn get_program_match_criteria(&self, program: &Pubkey) -> ProgramCacheMatchCriteria {
if self.check_program_modification_slot {
solana_svm::program_loader::get_program_modification_slot(self, program)
.map_or(ProgramCacheMatchCriteria::Tombstone, |slot| {
ProgramCacheMatchCriteria::DeployedOnOrAfterSlot(slot)
})
} else {
ProgramCacheMatchCriteria::NoCriteria
}
}

// NOTE: must hold idempotent for the same set of arguments
/// Add a builtin program account
fn add_builtin_account(&self, name: &str, program_id: &Pubkey) {
Expand Down
2 changes: 1 addition & 1 deletion svm/src/program_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pub fn load_program_with_pubkey<CB: TransactionProcessingCallback>(
/// Returns slot 0 for programs deployed with v1/v2 loaders, since programs deployed
/// with those loaders do not retain deployment slot information.
/// Returns an error if the program's account state can not be found or parsed.
pub fn get_program_modification_slot<CB: TransactionProcessingCallback>(
pub(crate) fn get_program_modification_slot<CB: TransactionProcessingCallback>(
callbacks: &CB,
pubkey: &Pubkey,
) -> transaction::Result<Slot> {
Expand Down
9 changes: 1 addition & 8 deletions svm/src/transaction_processing_callback.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
use {
solana_program_runtime::loaded_programs::ProgramCacheMatchCriteria,
solana_sdk::{account::AccountSharedData, pubkey::Pubkey},
};
use solana_sdk::{account::AccountSharedData, pubkey::Pubkey};

/// Runtime callbacks for transaction processing.
pub trait TransactionProcessingCallback {
fn account_matches_owners(&self, account: &Pubkey, owners: &[Pubkey]) -> Option<usize>;

fn get_account_shared_data(&self, pubkey: &Pubkey) -> Option<AccountSharedData>;

fn get_program_match_criteria(&self, _program: &Pubkey) -> ProgramCacheMatchCriteria {
ProgramCacheMatchCriteria::NoCriteria
}

fn add_builtin_account(&self, _name: &str, _program_id: &Pubkey) {}
}

0 comments on commit 7a8d3a9

Please sign in to comment.