Introduce eager rent collection (#9527)

* Switch AccountsIndex.account_maps from HashMap to BTreeMap

* Introduce eager rent collection

* Start to add tests

* Avoid too short eager rent collection cycles

* Add more tests

* Add more tests...

* Refacotr!!!!!!

* Refactoring follow up

* More tiny cleanups

* Don't rewrite 0-lamport accounts to be deterministic

* Refactor a bit

* Do hard fork, restore tests, and perf. mitigation

* Fix build...

* Refactor and add switch over for testnet (TdS)

* Use to_be_bytes

* cleanup

* More tiny cleanup

* Rebase cleanup

* Set Bank::genesis_hash when resuming from snapshot

* Reorder fns and clean ups

* Better naming and commenting

* Yet more naming clarifications

* Make prefix width strictly uniform for 2-base partition_count

* Fix typo...

* Revert cluster-dependent gate

* kick ci?

* kick ci?

* kick ci?
This commit is contained in:
Ryo Onodera
2020-05-13 16:22:14 +09:00
committed by GitHub
parent ee7f15eff1
commit 1eb40c3fe0
9 changed files with 1003 additions and 35 deletions

View File

@ -85,6 +85,12 @@ pub type Segment = u64;
/// some number of Slots.
pub type Epoch = u64;
/// SlotIndex is an index to the slots of a epoch
pub type SlotIndex = u64;
/// SlotCount is the number of slots in a epoch
pub type SlotCount = u64;
/// UnixTimestamp is an approximate measure of real-world time,
/// expressed as Unix time (ie. seconds since the Unix epoch)
pub type UnixTimestamp = i64;

View File

@ -78,6 +78,14 @@ impl Hash {
pub fn new(hash_slice: &[u8]) -> Self {
Hash(<[u8; HASH_BYTES]>::try_from(hash_slice).unwrap())
}
pub const fn new_from_array(hash_array: [u8; HASH_BYTES]) -> Self {
Self(hash_array)
}
pub fn to_bytes(self) -> [u8; HASH_BYTES] {
self.0
}
}
/// Return a Sha256 hash for the given data.