diff --git a/eth2/types/src/slot_epoch.rs b/eth2/types/src/slot_epoch.rs index 40b0c5e951..ccf8ec76d2 100644 --- a/eth2/types/src/slot_epoch.rs +++ b/eth2/types/src/slot_epoch.rs @@ -241,6 +241,10 @@ impl_display!(Epoch); impl_ssz!(Epoch); impl Slot { + pub fn new(slot: u64) -> Slot { + Slot(slot) + } + pub fn epoch(&self, epoch_length: u64) -> Epoch { Epoch::from(self.0 / epoch_length) } @@ -251,6 +255,10 @@ impl Slot { } impl Epoch { + pub fn new(slot: u64) -> Epoch { + Epoch(slot) + } + pub fn start_slot(&self, epoch_length: u64) -> Slot { Slot::from(self.0.saturating_mul(epoch_length)) }