Skip to content

Commit

Permalink
sanitized_epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Nov 5, 2024
1 parent d5c5878 commit 53a98e0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions core/src/banking_stage/consume_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
},
],
Expand Down
2 changes: 1 addition & 1 deletion core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
4 changes: 2 additions & 2 deletions core/src/banking_stage/scheduler_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ impl<T: LikeClusterInfo> SchedulerController<T> {
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,
}
}
Expand Down Expand Up @@ -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,
}
Expand All @@ -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,
}
);
Expand Down

0 comments on commit 53a98e0

Please sign in to comment.