Introduce a Slot type (#7997)

* Introduce a `Slot` type

Instead of having some type definition that only was used in half of the
code or directly using `u64`, this adds a new unit type wrapper `Slot`.
This makes it especially easy for the outside api to know what type is
expected/returned.

* Change epoch duratioC

* rename all instances of slot number to slot

* Make the constructor private

Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
Bastian Köcher
2021-01-28 20:44:22 +01:00
committed by GitHub
parent 6c2dd28dfb
commit b6294418f8
34 changed files with 549 additions and 445 deletions
@@ -151,7 +151,7 @@ mod test {
#[test]
fn load_decode_from_v0_epoch_changes() {
let epoch = EpochV0 {
start_slot: 0,
start_slot: 0.into(),
authorities: vec![],
randomness: [0; 32],
epoch_index: 1,
@@ -195,8 +195,8 @@ mod test {
.map(|(_, _, epoch)| epoch.clone())
.collect::<Vec<_>>() ==
vec![PersistedEpochHeader::Regular(EpochHeader {
start_slot: 0,
end_slot: 100,
start_slot: 0.into(),
end_slot: 100.into(),
})],
); // PersistedEpochHeader does not implement Debug, so we use assert! directly.