Safe Haskell | None |
---|---|
Language | Haskell2010 |
Byron.Spec.Ledger.Core.Generators
Description
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
Arguments
:: 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.
Arguments
:: 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
.