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öcherandAndré Silva authored and GitHub committed 2021-01-28 19:44:22 +00:00
1 parent 6c2dd28dfb
commit b6294418f8
34 files changed
+549 -445

No files matched your search

@@ -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.