Skip to content

Commit

Permalink
Environment mismatch needs to just skip the entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Dec 12, 2023
1 parent 9d6bae6 commit 1556297
Showing 1 changed file with 30 additions and 29 deletions.
59 changes: 30 additions & 29 deletions program-runtime/src/loaded_programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,37 +847,38 @@ impl<FG: ForkGraph> LoadedPrograms<FG> {
|| entry.deployment_slot == loaded_programs_for_tx_batch.slot
|| is_ancestor
{
let entry_to_return =
if loaded_programs_for_tx_batch.slot >= entry.effective_slot {
if !Self::is_entry_usable(
entry,
loaded_programs_for_tx_batch.slot,
match_criteria,
) || !Self::matches_environment(
entry,
&loaded_programs_for_tx_batch.environments,
) {
break;
}

if let LoadedProgramType::Unloaded(_environment) = &entry.program {
break;
}

entry.clone()
} else if entry.is_implicit_delay_visibility_tombstone(
let entry_to_return = if loaded_programs_for_tx_batch.slot
>= entry.effective_slot
&& Self::matches_environment(
entry,
&loaded_programs_for_tx_batch.environments,
) {
if !Self::is_entry_usable(
entry,
loaded_programs_for_tx_batch.slot,
match_criteria,
) {
// Found a program entry on the current fork, but it's not effective
// yet. It indicates that the program has delayed visibility. Return
// the tombstone to reflect that.
Arc::new(LoadedProgram::new_tombstone(
entry.deployment_slot,
LoadedProgramType::DelayVisibility,
))
} else {
continue;
};
break;
}

if let LoadedProgramType::Unloaded(_environment) = &entry.program {
break;
}

entry.clone()
} else if entry.is_implicit_delay_visibility_tombstone(
loaded_programs_for_tx_batch.slot,
) {
// Found a program entry on the current fork, but it's not effective
// yet. It indicates that the program has delayed visibility. Return
// the tombstone to reflect that.
Arc::new(LoadedProgram::new_tombstone(
entry.deployment_slot,
LoadedProgramType::DelayVisibility,
))
} else {
continue;
};
entry_to_return
.tx_usage_counter
.fetch_add(*usage_count, Ordering::Relaxed);
Expand Down

0 comments on commit 1556297

Please sign in to comment.