Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype SlotNumber = SlotNumber {}
- addSlotCount ∷ SlotCount → SlotNumber → SlotNumber
- subSlotCount ∷ SlotCount → SlotNumber → SlotNumber
- newtype SlotCount = SlotCount {}
- newtype EpochSlots = EpochSlots {}
- data WithEpochSlots a = WithEpochSlots {}
- epochFirstSlot ∷ EpochSlots → EpochNumber → SlotNumber
- newtype EpochNumber = EpochNumber {}
- isBootstrapEra ∷ EpochNumber → EpochNumber → Bool
- data EpochAndSlotCount = EpochAndSlotCount {}
- toSlotNumber ∷ EpochSlots → EpochAndSlotCount → SlotNumber
- fromSlotNumber ∷ EpochSlots → SlotNumber → EpochAndSlotCount
- slotNumberEpoch ∷ EpochSlots → SlotNumber → EpochNumber
Documentation
newtype SlotNumber Source #
SlotNumber
is an absolute slot number from the beginning of time
SlotNumber
is held in a Word64
. Assuming a slot every 20 seconds, Word64
is sufficient for slot indices for 10^13 years.
Instances
addSlotCount ∷ SlotCount → SlotNumber → SlotNumber Source #
Increase a SlotNumber
by SlotCount
subSlotCount ∷ SlotCount → SlotNumber → SlotNumber Source #
Deprecated: this function is dangerous and can usually be replaced by addSlotCount
Decrease a SlotNumber
by SlotCount
, going no lower than 0
A number of slots
Instances
newtype EpochSlots Source #
The number of slots per epoch.
Instances
data WithEpochSlots a Source #
Data with an accompanying slots per epoch context.
Instances
Show a ⇒ Show (WithEpochSlots a) Source # | |
Defined in Cardano.Chain.Slotting.EpochSlots | |
Buildable (WithEpochSlots Block) Source # | |
Defined in Cardano.Chain.Block.Block | |
Buildable (WithEpochSlots Header) Source # | |
Defined in Cardano.Chain.Block.Header | |
Eq a ⇒ Eq (WithEpochSlots a) Source # | |
Defined in Cardano.Chain.Slotting.EpochSlots (==) ∷ WithEpochSlots a → WithEpochSlots a → Bool Source # (/=) ∷ WithEpochSlots a → WithEpochSlots a → Bool Source # |
epochFirstSlot ∷ EpochSlots → EpochNumber → SlotNumber Source #
Calculate the first slot in an epoch.
Note that this function will give an undetermined result if Byron is not the
first and only era - a more robust method should use EpochInfo
from
cardano-slotting.
newtype EpochNumber Source #
Index of epoch.
Instances
∷ EpochNumber | Unlock stake epoch |
→ EpochNumber | Epoch in question (for which we determine whether it belongs to the bootstrap era) |
→ Bool |
Bootstrap era is ongoing until stakes are unlocked. The reward era starts from the epoch specified as the epoch that unlocks stakes:
[unlock stake epoch] / Epoch: ... E-3 E-2 E-1 E+0 E+1 E+2 E+3 ... ------------------ | ----------------------- Bootstrap era Reward era
data EpochAndSlotCount Source #
EpochAndSlotCount
identifies a slot by its EpochNumber
and the number of
slots into the epoch that it sits
Instances
toSlotNumber ∷ EpochSlots → EpochAndSlotCount → SlotNumber Source #
Flatten EpochAndSlotCount
into a single absolute SlotNumber
fromSlotNumber ∷ EpochSlots → SlotNumber → EpochAndSlotCount Source #
Construct a EpochAndSlotCount
from a SlotNumber
, using a given EpochSlots