Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data SIGCNT
- data SigcntPredicateFailure
- issuer ∷ Environment SIGCNT → State SIGCNT → Gen VKey
- sigCntT ∷ BlockCount → Word8 → Gen Double
Documentation
Instances
data SigcntPredicateFailure Source #
These PredicateFailure
s are all throwable.
TooManyIssuedBlocks VKeyGenesis | The given genesis key issued too many blocks. |
NotADelegate | The key signing the block is not a delegate of a genesis key. |
Instances
issuer ∷ Environment SIGCNT → State SIGCNT → Gen VKey Source #
Generate an issuer that can still issue blocks according to the SIGCNT
rule. The issuers are
taken from the range of the delegation map passed as parameter.
This generator will throw an error if no suitable issuer can be found, which means that the block production halted.
sigCntT ∷ BlockCount → Word8 → Gen Double Source #
Generate a signature count threshold given a chain stability parameter k
and number of
genesis keys ngk
.
This threshold must allow that all the (honest) genesis keys can issue enough blocks to fill the
rolling window of k
. If this is not possible, then the block production will halt since there
will not be valid issuers. So the threshold must make it possible to find an integer n
such
that:
n <= k * t
and
k < ngk * n = { algebra } k / ngk < n
We know there must be an integer in the interval
(k/ngk, k/ngk + 1]
So to satisfy the requirements above, we can pick a t
such that:
k/ngk + 1 <= k * t = { algebra } 1/ngk + 1/k <= t
To pick a value for t
we vary the proportion of honest keys.