Skip to content

Commit

Permalink
remove find_program_in_cache alias
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Jun 17, 2024
1 parent b6eb52f commit 4ebfb56
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 0 additions & 4 deletions program-runtime/src/invoke_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,6 @@ impl<'a> InvokeContext<'a> {
}
}

pub fn find_program_in_cache(&self, pubkey: &Pubkey) -> Option<Arc<ProgramCacheEntry>> {
self.program_cache_for_tx_batch.find(pubkey)
}

pub fn get_environments_for_slot(
&self,
effective_slot: Slot,
Expand Down
5 changes: 3 additions & 2 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ macro_rules! deploy_program {
environments.program_runtime_v1.clone(),
true,
)?;
if let Some(old_entry) = $invoke_context.find_program_in_cache(&$program_id) {
if let Some(old_entry) = $invoke_context.program_cache_for_tx_batch.find(&$program_id) {
executor.tx_usage_counter.store(
old_entry.tx_usage_counter.load(Ordering::Relaxed),
Ordering::Relaxed
Expand Down Expand Up @@ -437,7 +437,8 @@ pub fn process_instruction_inner(

let mut get_or_create_executor_time = Measure::start("get_or_create_executor_time");
let executor = invoke_context
.find_program_in_cache(program_account.get_key())
.program_cache_for_tx_batch
.find(program_account.get_key())
.ok_or_else(|| {
ic_logger_msg!(log_collector, "Program is not cached");
InstructionError::InvalidAccountData
Expand Down
8 changes: 6 additions & 2 deletions programs/loader-v4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,10 @@ pub fn process_instruction_deploy(
state.slot = current_slot;
state.status = LoaderV4Status::Deployed;

if let Some(old_entry) = invoke_context.find_program_in_cache(program.get_key()) {
if let Some(old_entry) = invoke_context
.program_cache_for_tx_batch
.find(program.get_key())
{
executor.tx_usage_counter.store(
old_entry.tx_usage_counter.load(Ordering::Relaxed),
Ordering::Relaxed,
Expand Down Expand Up @@ -592,7 +595,8 @@ pub fn process_instruction_inner(
}
let mut get_or_create_executor_time = Measure::start("get_or_create_executor_time");
let loaded_program = invoke_context
.find_program_in_cache(program.get_key())
.program_cache_for_tx_batch
.find(program.get_key())
.ok_or_else(|| {
ic_logger_msg!(log_collector, "Program is not cached");
InstructionError::InvalidAccountData
Expand Down

0 comments on commit 4ebfb56

Please sign in to comment.