| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Byron.Spec.Chain.STS.Rule.SigCnt
Synopsis
- data SIGCNT
- data SigcntPredicateFailure
- issuer ∷ Environment SIGCNT → State SIGCNT → Gen VKey
- sigCntT ∷ BlockCount → Word8 → Gen Double
Documentation
Instances
data SigcntPredicateFailure Source #
These PredicateFailures are all throwable.
Constructors
| 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
| Data SigcntPredicateFailure Source # | |
Defined in Byron.Spec.Chain.STS.Rule.SigCnt Methods gfoldl ∷ (∀ d b. Data d ⇒ c (d → b) → d → c b) → (∀ g. g → c g) → SigcntPredicateFailure → c SigcntPredicateFailure # gunfold ∷ (∀ b r. Data b ⇒ c (b → r) → c r) → (∀ r. r → c r) → Constr → c SigcntPredicateFailure # toConstr ∷ SigcntPredicateFailure → Constr # dataTypeOf ∷ SigcntPredicateFailure → DataType # dataCast1 ∷ Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c SigcntPredicateFailure) # dataCast2 ∷ Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c SigcntPredicateFailure) # gmapT ∷ (∀ b. Data b ⇒ b → b) → SigcntPredicateFailure → SigcntPredicateFailure # gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → SigcntPredicateFailure → r # gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → SigcntPredicateFailure → r # gmapQ ∷ (∀ d. Data d ⇒ d → u) → SigcntPredicateFailure → [u] # gmapQi ∷ Int → (∀ d. Data d ⇒ d → u) → SigcntPredicateFailure → u # gmapM ∷ Monad m ⇒ (∀ d. Data d ⇒ d → m d) → SigcntPredicateFailure → m SigcntPredicateFailure # gmapMp ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → SigcntPredicateFailure → m SigcntPredicateFailure # gmapMo ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → SigcntPredicateFailure → m SigcntPredicateFailure # | |
| Show SigcntPredicateFailure Source # | |
Defined in Byron.Spec.Chain.STS.Rule.SigCnt Methods showsPrec ∷ Int → SigcntPredicateFailure → ShowS # show ∷ SigcntPredicateFailure → String # showList ∷ [SigcntPredicateFailure] → ShowS # | |
| Eq SigcntPredicateFailure Source # | |
Defined in Byron.Spec.Chain.STS.Rule.SigCnt Methods (==) ∷ SigcntPredicateFailure → SigcntPredicateFailure → Bool # (/=) ∷ SigcntPredicateFailure → SigcntPredicateFailure → Bool # | |
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 < nWe 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 <= tTo pick a value for t we vary the proportion of honest keys.