Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Generators for the Core
values.
Synopsis
- vkGen ∷ Gen VKey
- vkgenesisGen ∷ Gen VKeyGenesis
- addrGen ∷ Gen Addr
- slotGen ∷ Word64 → Word64 → Gen Slot
- epochGen ∷ Word64 → Word64 → Gen Epoch
- blockCountGen ∷ Word64 → Word64 → Gen BlockCount
- k ∷ Word64 → Word64 → Gen BlockCount
- kForNumberOfEpochs ∷ Word64 → Word64 → BlockCount
Documentation
blockCountGen ∷ Word64 → Word64 → Gen BlockCount Source #
Generates a block count within the given bound
∷ Word64 | Chain length |
→ Word64 | Maximum number of epochs |
→ Gen BlockCount |
Generate a chain stability parameter value (k
) using the given chain length and desired
number of epochs.
∷ Word64 | Chain length |
→ Word64 | Desired number of epochs |
→ BlockCount |
Given a chain length, determine the k
value that will split the chain length into the desired
number of epochs.
We have that:
chainLength = slotsPerEpoch k * numberOfEpochs = { algebra } chainLength / numberOfEpochs = slotsPerEpoch k = { 'slotsPerEpochtoK' is the inverse of 'slotsPerEpoch'; algebra } slotsPerEpochToK (chainLength / numberOfEpochs) = k
So the resulting k
value will be directly proportional to the chainLength
and inversely
proportional to the chosen numberOfEpochs
.
The minimum value for k
will be 1. In particular, this will be the value
returned when the number of epochs is greater or equal than chainLength
.