Skip to content

Commit

Permalink
Optimizes to avoid having two entries if there is no relevant feature…
Browse files Browse the repository at this point in the history
… activation.
  • Loading branch information
Lichtso committed Feb 22, 2024
1 parent e8c9cec commit b15170f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions svm/src/transaction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,13 +731,21 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {

let mut timings = ExecuteDetailsTimings::default();
load_program_metrics.submit_datapoint(&mut timings);
// There can be two entries per program when the environment changes.
// One for the old environment before the epoch boundary and one for the new environment after the epoch boundary.
// These two entries have the same deployment slot, so they must differ in their effective slot instead.
// This is done by setting the effective slot of the entry for the new environment to the epoch boundary.
loaded_program.effective_slot = loaded_program
.effective_slot
.max(self.epoch_schedule.get_first_slot_in_epoch(effective_epoch));
if !Arc::ptr_eq(
&environments.program_runtime_v1,
&loaded_programs_cache.environments.program_runtime_v1,
) || !Arc::ptr_eq(
&environments.program_runtime_v2,
&loaded_programs_cache.environments.program_runtime_v2,
) {
// There can be two entries per program when the environment changes.
// One for the old environment before the epoch boundary and one for the new environment after the epoch boundary.
// These two entries have the same deployment slot, so they must differ in their effective slot instead.
// This is done by setting the effective slot of the entry for the new environment to the epoch boundary.
loaded_program.effective_slot = loaded_program
.effective_slot
.max(self.epoch_schedule.get_first_slot_in_epoch(effective_epoch));
}
loaded_program.update_access_slot(self.slot);
Arc::new(loaded_program)
}
Expand Down

0 comments on commit b15170f

Please sign in to comment.