From 53a98e06d4a2fc6ace48ee036147b7be1b603992 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Mon, 4 Nov 2024 10:30:02 -0600 Subject: [PATCH] sanitized_epoch --- core/src/banking_stage/consume_worker.rs | 20 +++++++++---------- core/src/banking_stage/consumer.rs | 2 +- core/src/banking_stage/scheduler_messages.rs | 4 ++-- .../scheduler_controller.rs | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/core/src/banking_stage/consume_worker.rs b/core/src/banking_stage/consume_worker.rs index b06e64386c2ae0..5c565ae0f73fc8 100644 --- a/core/src/banking_stage/consume_worker.rs +++ b/core/src/banking_stage/consume_worker.rs @@ -894,7 +894,7 @@ mod tests { let bid = TransactionBatchId::new(0); let id = TransactionId::new(0); let max_age = MaxAge { - resolved_epoch: bank.epoch(), + sanitized_epoch: bank.epoch(), alt_invalidation_slot: bank.slot(), }; let work = ConsumeWork { @@ -943,7 +943,7 @@ mod tests { let bid = TransactionBatchId::new(0); let id = TransactionId::new(0); let max_age = MaxAge { - resolved_epoch: bank.epoch(), + sanitized_epoch: bank.epoch(), alt_invalidation_slot: bank.slot(), }; let work = ConsumeWork { @@ -993,7 +993,7 @@ mod tests { let id1 = TransactionId::new(1); let id2 = TransactionId::new(0); let max_age = MaxAge { - resolved_epoch: bank.epoch(), + sanitized_epoch: bank.epoch(), alt_invalidation_slot: bank.slot(), }; consume_sender @@ -1054,7 +1054,7 @@ mod tests { let id1 = TransactionId::new(1); let id2 = TransactionId::new(0); let max_age = MaxAge { - resolved_epoch: bank.epoch(), + sanitized_epoch: bank.epoch(), alt_invalidation_slot: bank.slot(), }; consume_sender @@ -1193,27 +1193,27 @@ mod tests { transactions: txs, max_ages: vec![ MaxAge { - resolved_epoch: bank.epoch() - 1, + sanitized_epoch: bank.epoch() - 1, alt_invalidation_slot: Slot::MAX, }, MaxAge { - resolved_epoch: bank.epoch(), + sanitized_epoch: bank.epoch(), alt_invalidation_slot: Slot::MAX, }, MaxAge { - resolved_epoch: bank.epoch() + 1, + sanitized_epoch: bank.epoch() + 1, alt_invalidation_slot: Slot::MAX, }, MaxAge { - resolved_epoch: bank.epoch(), + sanitized_epoch: bank.epoch(), alt_invalidation_slot: bank.slot() - 1, }, MaxAge { - resolved_epoch: bank.epoch(), + sanitized_epoch: bank.epoch(), alt_invalidation_slot: bank.slot(), }, MaxAge { - resolved_epoch: bank.epoch(), + sanitized_epoch: bank.epoch(), alt_invalidation_slot: bank.slot() + 1, }, ], diff --git a/core/src/banking_stage/consumer.rs b/core/src/banking_stage/consumer.rs index b628fc53c6bce5..612df0ee0d66c1 100644 --- a/core/src/banking_stage/consumer.rs +++ b/core/src/banking_stage/consumer.rs @@ -445,7 +445,7 @@ impl Consumer { let pre_results = txs.iter().zip(max_ages).map(|(tx, max_age)| { // If the transaction was sanitized before this bank's epoch, // additional checks are necessary. - if bank.epoch() != max_age.resolved_epoch { + if bank.epoch() != max_age.sanitized_epoch { // Reserved key set may have changed, so we must verify that // no writable keys are reserved. bank.check_reserved_keys(tx)?; diff --git a/core/src/banking_stage/scheduler_messages.rs b/core/src/banking_stage/scheduler_messages.rs index eb95fc643d2a03..d0e5379ee761a2 100644 --- a/core/src/banking_stage/scheduler_messages.rs +++ b/core/src/banking_stage/scheduler_messages.rs @@ -41,13 +41,13 @@ impl Display for TransactionId { #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct MaxAge { - pub resolved_epoch: Epoch, + pub sanitized_epoch: Epoch, pub alt_invalidation_slot: Slot, } impl MaxAge { pub const MAX: Self = Self { - resolved_epoch: Epoch::MAX, + sanitized_epoch: Epoch::MAX, alt_invalidation_slot: Slot::MAX, }; } diff --git a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs index 1f957551dfbb17..99cae3b53d648f 100644 --- a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs +++ b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs @@ -704,7 +704,7 @@ impl SchedulerController { fn calculate_max_age(resolved_epoch: Epoch, deactivation_slot: Slot, current_slot: Slot) -> MaxAge { let alt_min_expire_slot = estimate_last_valid_slot(deactivation_slot.min(current_slot)); MaxAge { - resolved_epoch, + sanitized_epoch: resolved_epoch, alt_invalidation_slot: alt_min_expire_slot, } } @@ -1222,7 +1222,7 @@ mod tests { assert_eq!( calculate_max_age(resolved_epoch, current_slot - 1, current_slot), MaxAge { - resolved_epoch, + sanitized_epoch, alt_invalidation_slot: current_slot - 1 + solana_sdk::slot_hashes::get_entries() as u64, } @@ -1232,7 +1232,7 @@ mod tests { assert_eq!( calculate_max_age(resolved_epoch, u64::MAX, current_slot), MaxAge { - resolved_epoch, + sanitized_epoch, alt_invalidation_slot: current_slot + solana_sdk::slot_hashes::get_entries() as u64, } );