ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Committee.WFALS.Model.Utils

Description

Utility functions for the WFALS model tests.

Synopsis

Generators

genStake ∷ Gen (Stake 'Ledger 'Global) Source #

Generate a random stake as a Rational number

genUniqueVoterIds ∷ Int → Gen [VoterId] Source #

Generate a non-empty list of unique voter IDs of a given size.

genStakeDistr ∷ Int → Gen (StakeDistr 'Ledger 'Global) Source #

Generate a non-empty random stake distribution of a given size

NOTE: the size is shifted up by one to ensure non-emptiness.

Property helpers

forAllValidStakeDistrAndNumSeats ∷ (StakeDistr 'Ledger 'Global → NumSeats 'Global → Property) → Property Source #

Helper to generate stake distributions along with a number of seats that lies within the acceptable range [1, #{nodes with positive stake}]

forAllPossiblyInvalidStakeDistrAndNumSeats ∷ (StakeDistr 'Ledger 'Global → NumSeats 'Global → Property) → Property Source #

Helper to generate stake distributions along with a number of seats that could possibly be invalid in different ways, e.g., too many expected seats or an empty stake distribution.

tabulateTargetNumSeats ∷ NumSeats 'Global → Property → Property Source #

Tabulate the target number of seats

tabulateStakeDistrSize ∷ StakeDistr 'Ledger 'Global → Property → Property Source #

Tabulate the size of a stake distribution

tabulatePersistentToNonPersistentRatio ∷ NumSeats 'Global → NumSeats 'Global → Property → Property Source #

Tabulate the ratio of persistent to non-persistent seats as the percentage of persistent seats out of the total number of seats.