Skip to content

Commit

Permalink
fix one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Nov 5, 2024
1 parent df65770 commit 6c37fa2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12372,6 +12372,17 @@ where
let bank = new_from_parent_next_epoch(bank, &bank_forks, 2);
bank.freeze(); // trigger rent collection

// advance to the next slot to create a new bank, which is cleanable. The
// previous bank is at epoch boundary. An epoch boundary bank is not
// cleanable because epoch rewards sysvar is written in this slot. Before
// #3398, it was cleanable because rent collection will rewrite the epoch
// rewards sysvar due to rent_epoch not setting to u64::MAX. With #3398,
// rent_epoch is set to u64::MAX at creating time, so epoch rewards sysvar
// is not rewritten. Therefore, the slot at epoch boundary is now
// uncleanable. This is why we need to advance to the next slot.
let slot = bank.slot() + 1;
let bank = new_bank_from_parent_with_bank_forks(bank_forks.as_ref(), bank, &collector, slot);

// create zero-lamports account to be cleaned
let account = AccountSharedData::new(0, len1, &program);
let slot = bank.slot() + 1;
Expand Down Expand Up @@ -12419,9 +12430,9 @@ fn test_create_zero_lamport_with_clean() {
bank.squash();
bank.force_flush_accounts_cache();
// do clean and assert that it actually did its job
assert_eq!(5, bank.get_snapshot_storages(None).len());
assert_eq!(6, bank.get_snapshot_storages(None).len());
bank.clean_accounts();
assert_eq!(4, bank.get_snapshot_storages(None).len());
assert_eq!(5, bank.get_snapshot_storages(None).len());
});
}

Expand Down

0 comments on commit 6c37fa2

Please sign in to comment.