use correct epoch schedule (#24904)
This commit is contained in:
parent
503d0baf6d
commit
755100dd7c
|
@ -5210,6 +5210,7 @@ impl AccountsDb {
|
||||||
&loaded_hash,
|
&loaded_hash,
|
||||||
pubkey,
|
pubkey,
|
||||||
*slot,
|
*slot,
|
||||||
|
config.epoch_schedule,
|
||||||
config.rent_collector,
|
config.rent_collector,
|
||||||
&stats,
|
&stats,
|
||||||
max_slot,
|
max_slot,
|
||||||
|
@ -5758,6 +5759,7 @@ impl AccountsDb {
|
||||||
&loaded_hash,
|
&loaded_hash,
|
||||||
pubkey,
|
pubkey,
|
||||||
slot,
|
slot,
|
||||||
|
config.epoch_schedule,
|
||||||
config.rent_collector,
|
config.rent_collector,
|
||||||
stats,
|
stats,
|
||||||
storage.range().end.saturating_sub(1), // 'end' is exclusive, convert to inclusive
|
storage.range().end.saturating_sub(1), // 'end' is exclusive, convert to inclusive
|
||||||
|
|
|
@ -386,6 +386,7 @@ impl ExpectedRentCollection {
|
||||||
loaded_hash: &Hash,
|
loaded_hash: &Hash,
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
storage_slot: Slot,
|
storage_slot: Slot,
|
||||||
|
epoch_schedule: &EpochSchedule,
|
||||||
rent_collector: &RentCollector,
|
rent_collector: &RentCollector,
|
||||||
stats: &HashStats,
|
stats: &HashStats,
|
||||||
max_slot_in_storages_inclusive: Slot,
|
max_slot_in_storages_inclusive: Slot,
|
||||||
|
@ -398,6 +399,7 @@ impl ExpectedRentCollection {
|
||||||
pubkey,
|
pubkey,
|
||||||
loaded_account,
|
loaded_account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
epoch_schedule,
|
||||||
rent_collector,
|
rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -442,20 +444,18 @@ impl ExpectedRentCollection {
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
loaded_account: &impl ReadableAccount,
|
loaded_account: &impl ReadableAccount,
|
||||||
storage_slot: Slot,
|
storage_slot: Slot,
|
||||||
|
epoch_schedule: &EpochSchedule,
|
||||||
rent_collector: &RentCollector,
|
rent_collector: &RentCollector,
|
||||||
max_slot_in_storages_inclusive: Slot,
|
max_slot_in_storages_inclusive: Slot,
|
||||||
find_unskipped_slot: impl Fn(Slot) -> Option<Slot>,
|
find_unskipped_slot: impl Fn(Slot) -> Option<Slot>,
|
||||||
filler_account_suffix: Option<&Pubkey>,
|
filler_account_suffix: Option<&Pubkey>,
|
||||||
) -> Option<Self> {
|
) -> Option<Self> {
|
||||||
let slots_per_epoch = rent_collector
|
let slots_per_epoch = epoch_schedule.get_slots_in_epoch(rent_collector.epoch);
|
||||||
.epoch_schedule
|
|
||||||
.get_slots_in_epoch(rent_collector.epoch);
|
|
||||||
|
|
||||||
let partition_from_pubkey =
|
let partition_from_pubkey =
|
||||||
crate::bank::Bank::partition_from_pubkey(pubkey, slots_per_epoch);
|
crate::bank::Bank::partition_from_pubkey(pubkey, slots_per_epoch);
|
||||||
let (epoch_of_max_storage_slot, partition_index_from_max_slot) = rent_collector
|
let (epoch_of_max_storage_slot, partition_index_from_max_slot) =
|
||||||
.epoch_schedule
|
epoch_schedule.get_epoch_and_slot_index(max_slot_in_storages_inclusive);
|
||||||
.get_epoch_and_slot_index(max_slot_in_storages_inclusive);
|
|
||||||
|
|
||||||
// now, we have to find the root that is >= the slot where this pubkey's rent would have been collected
|
// now, we have to find the root that is >= the slot where this pubkey's rent would have been collected
|
||||||
let first_slot_in_max_epoch =
|
let first_slot_in_max_epoch =
|
||||||
|
@ -579,6 +579,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -606,6 +607,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -630,6 +632,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
expected_rent_collection_slot_max_epoch,
|
expected_rent_collection_slot_max_epoch,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -657,6 +660,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
expected_rent_collection_slot_max_epoch + if greater { 1 } else { 0 },
|
expected_rent_collection_slot_max_epoch + if greater { 1 } else { 0 },
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -682,6 +686,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
expected_rent_collection_slot_max_epoch,
|
expected_rent_collection_slot_max_epoch,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive + if previous_epoch { slots_per_epoch } else { 0 },
|
max_slot_in_storages_inclusive + if previous_epoch { slots_per_epoch } else { 0 },
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -715,6 +720,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
expected_rent_collection_slot_max_epoch,
|
expected_rent_collection_slot_max_epoch,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -754,6 +760,7 @@ pub mod tests {
|
||||||
pubkey,
|
pubkey,
|
||||||
&account,
|
&account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -803,6 +810,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -845,6 +853,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -877,6 +886,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -1004,6 +1014,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -1037,6 +1048,7 @@ pub mod tests {
|
||||||
&pubkey,
|
&pubkey,
|
||||||
&account,
|
&account,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
find_unskipped_slot,
|
find_unskipped_slot,
|
||||||
|
@ -1067,6 +1079,7 @@ pub mod tests {
|
||||||
&hash,
|
&hash,
|
||||||
&pubkey,
|
&pubkey,
|
||||||
storage_slot,
|
storage_slot,
|
||||||
|
&epoch_schedule,
|
||||||
&rent_collector,
|
&rent_collector,
|
||||||
&HashStats::default(),
|
&HashStats::default(),
|
||||||
max_slot_in_storages_inclusive,
|
max_slot_in_storages_inclusive,
|
||||||
|
|
Loading…
Reference in New Issue