Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype SlotNumber = SlotNumber { }
- addSlotCount :: SlotCount -> SlotNumber -> SlotNumber
- subSlotCount :: SlotCount -> SlotNumber -> SlotNumber
- newtype SlotCount = SlotCount { }
- newtype EpochSlots = EpochSlots { }
-
data
WithEpochSlots
a =
WithEpochSlots
{
- epochSlots :: EpochSlots
- unWithEpochSlots :: a
- epochFirstSlot :: EpochSlots -> EpochNumber -> SlotNumber
- newtype EpochNumber = EpochNumber { }
- isBootstrapEra :: EpochNumber -> EpochNumber -> Bool
-
data
EpochAndSlotCount
=
EpochAndSlotCount
{
- epochNo :: ! EpochNumber
- slotCount :: ! SlotCount
- 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
Eq SlotCount Source # | |
Ord SlotCount Source # | |
Defined in Cardano.Chain.Slotting.SlotCount |
|
Read SlotCount Source # | |
Show SlotCount Source # | |
Generic SlotCount Source # | |
NFData SlotCount Source # | |
Defined in Cardano.Chain.Slotting.SlotCount |
|
ToCBOR SlotCount Source # | |
FromCBOR SlotCount Source # | |
Buildable SlotCount Source # | |
type Rep SlotCount Source # | |
Defined in Cardano.Chain.Slotting.SlotCount
type
Rep
SlotCount
=
D1
('
MetaData
"SlotCount" "Cardano.Chain.Slotting.SlotCount" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" '
True
) (
C1
('
MetaCons
"SlotCount" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"unSlotCount") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
Word64
)))
|
newtype EpochSlots Source #
The number of slots per epoch.
Instances
data WithEpochSlots a Source #
Data with an accompanying slots per epoch context.
Instances
Eq a => Eq ( WithEpochSlots a) Source # | |
Defined in Cardano.Chain.Slotting.EpochSlots (==) :: WithEpochSlots a -> WithEpochSlots a -> Bool Source # (/=) :: WithEpochSlots a -> WithEpochSlots a -> Bool Source # |
|
Show a => Show ( WithEpochSlots a) Source # | |
Defined in Cardano.Chain.Slotting.EpochSlots |
|
Buildable ( WithEpochSlots Header ) Source # | |
Defined in Cardano.Chain.Block.Header |
|
Buildable ( WithEpochSlots Block ) Source # | |
Defined in Cardano.Chain.Block.Block |
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
EpochAndSlotCount | |
|
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
slotNumberEpoch :: EpochSlots -> SlotNumber -> EpochNumber Source #