Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Apr 25, 2020
1 parent 55dd5a2 commit 57be116
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1683,8 +1683,8 @@ impl Bank {
.fetch_add(collected_rent, Ordering::Relaxed);
}

fn collect_rent_in_partition(&self, (range_start, range_end, partition_count): Partition) {
let subrange = Self::pubkey_range_by_partition(range_start, range_end, partition_count);
fn collect_rent_in_partition(&self, partition: Partition) {
let subrange = Self::pubkey_range_by_partition(partition);

let accounts = self
.rc
Expand All @@ -1706,9 +1706,7 @@ impl Bank {
}

fn pubkey_range_by_partition(
start_index: PartitionIndex,
end_index: PartitionIndex,
partition_count: PartitionsPerCycle,
(start_index, end_index, partition_count): Partition,
) -> std::ops::RangeInclusive<Pubkey> {
type Prefix = u64;
const PREFIX_SIZE: usize = mem::size_of::<Prefix>();
Expand Down Expand Up @@ -3786,7 +3784,7 @@ mod tests {

#[test]
fn test_rent_eager_pubkey_range_minimal() {
let range = Bank::pubkey_range_by_partition(0, 0, 1);
let range = Bank::pubkey_range_by_partition((0, 0, 1));
assert_eq!(
range,
Pubkey::new_from_array([0x00; 32])..=Pubkey::new_from_array([0xff; 32])
Expand All @@ -3795,7 +3793,7 @@ mod tests {

#[test]
fn test_rent_eager_pubkey_range_dividable() {
let range = Bank::pubkey_range_by_partition(0, 0, 2);
let range = Bank::pubkey_range_by_partition((0, 0, 2));
assert_eq!(
range,
Pubkey::new_from_array([
Expand All @@ -3810,7 +3808,7 @@ mod tests {
])
);

let range = Bank::pubkey_range_by_partition(0, 1, 2);
let range = Bank::pubkey_range_by_partition((0, 1, 2));
assert_eq!(
range,
Pubkey::new_from_array([
Expand All @@ -3830,7 +3828,7 @@ mod tests {
fn test_rent_eager_pubkey_range_not_dividable() {
solana_logger::setup();

let range = Bank::pubkey_range_by_partition(0, 0, 3);
let range = Bank::pubkey_range_by_partition((0, 0, 3));
assert_eq!(
range,
Pubkey::new_from_array([
Expand All @@ -3845,7 +3843,7 @@ mod tests {
])
);

let range = Bank::pubkey_range_by_partition(0, 1, 3);
let range = Bank::pubkey_range_by_partition((0, 1, 3));
assert_eq!(
range,
Pubkey::new_from_array([
Expand All @@ -3860,7 +3858,7 @@ mod tests {
])
);

let range = Bank::pubkey_range_by_partition(1, 2, 3);
let range = Bank::pubkey_range_by_partition((1, 2, 3));
assert_eq!(
range,
Pubkey::new_from_array([
Expand All @@ -3879,7 +3877,7 @@ mod tests {
#[test]
fn test_rent_eager_pubkey_range_gap() {
solana_logger::setup();
let range = Bank::pubkey_range_by_partition(120, 1023, 12345);
let range = Bank::pubkey_range_by_partition((120, 1023, 12345));
assert_eq!(
range,
Pubkey::new_from_array([
Expand Down

0 comments on commit 57be116

Please sign in to comment.