HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulebyron-spec-ledger-1.1.0.1Haskell2010

Byron.Spec.Ledger.Core.Generators

Generators for the Ledger.Core values.

  • 8 values
valuek
  1. :: Word64

    Chain length

  2. -> Word64

    Maximum number of epochs

  3. -> Gen BlockCount
#

Generate a chain stability parameter value (k) using the given chain length and desired number of epochs.

valuekForNumberOfEpochs
  1. :: Word64

    Chain length

  2. -> Word64

    Desired number of epochs

  3. -> 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.