From 4fde707bc06e21b3b28bd132f24d074fa9796a7c Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Mon, 4 Nov 2024 10:34:46 -0600 Subject: [PATCH] sanitized_epoch in scheduler controller --- .../scheduler_controller.rs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs index 492984615c8424..40173de0e7aff7 100644 --- a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs +++ b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs @@ -509,9 +509,7 @@ impl SchedulerController { (root_bank, working_bank) }; let alt_resolved_slot = root_bank.slot(); - let last_slot_in_epoch = root_bank - .epoch_schedule() - .get_last_slot_in_epoch(root_bank.epoch()); + let sanitized_epoch = root_bank.epoch(); let transaction_account_lock_limit = working_bank.get_transaction_account_lock_limit(); let vote_only = working_bank.vote_only_bank(); @@ -556,7 +554,7 @@ impl SchedulerController { arc_packets.push(packet); transactions.push(tx); max_ages.push(calculate_max_age( - last_slot_in_epoch, + sanitized_epoch, deactivation_slot, alt_resolved_slot, )); @@ -698,10 +696,14 @@ impl SchedulerController { /// slots, the value used here is the lower-bound on the deactivation /// period, i.e. the transaction's address lookups are valid until /// AT LEAST this slot. -fn calculate_max_age(resolved_epoch: Epoch, deactivation_slot: Slot, current_slot: Slot) -> MaxAge { +fn calculate_max_age( + sanitized_epoch: Epoch, + deactivation_slot: Slot, + current_slot: Slot, +) -> MaxAge { let alt_min_expire_slot = estimate_last_valid_slot(deactivation_slot.min(current_slot)); MaxAge { - sanitized_epoch: resolved_epoch, + sanitized_epoch, alt_invalidation_slot: alt_min_expire_slot, } } @@ -1213,11 +1215,11 @@ mod tests { #[test] fn test_calculate_max_age() { let current_slot = 100; - let resolved_epoch = 10; + let sanitized_epoch = 10; // ALT deactivation slot is delayed assert_eq!( - calculate_max_age(resolved_epoch, current_slot - 1, current_slot), + calculate_max_age(sanitized_epoch, current_slot - 1, current_slot), MaxAge { sanitized_epoch, alt_invalidation_slot: current_slot - 1 @@ -1227,7 +1229,7 @@ mod tests { // no deactivation slot assert_eq!( - calculate_max_age(resolved_epoch, u64::MAX, current_slot), + calculate_max_age(sanitized_epoch, u64::MAX, current_slot), MaxAge { sanitized_epoch, alt_invalidation_slot: current_slot + solana_sdk::slot_hashes::get_entries() as u64,