byron-spec-ledger-1.0.1.0: Executable specification of Cardano ledger
Safe HaskellSafe-Inferred
LanguageHaskell2010

Byron.Spec.Ledger.Core.Generators

Description

Generators for the Core values.

Synopsis

Documentation

slotGenWord64Word64Gen Slot Source #

Generates a slot within the given bound

epochGenWord64Word64Gen Epoch Source #

Generates an epoch within the given bound

blockCountGenWord64Word64Gen BlockCount Source #

Generates a block count within the given bound

k Source #

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.

kForNumberOfEpochs Source #

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.