ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Committee.WFALS.Model.Utils

Description

Utility functions for the WFALS model tests.

Synopsis

Generators

genStakeGen (Stake 'Ledger 'Global) Source #

Generate a random stake as a Rational number

genUniqueVoterIdsIntGen [VoterId] Source #

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

genStakeDistrIntGen (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 'GlobalNumSeats 'GlobalProperty) → 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 'GlobalNumSeats 'GlobalProperty) → 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.

tabulateTargetNumSeatsNumSeats 'GlobalPropertyProperty Source #

Tabulate the target number of seats

tabulateStakeDistrSizeStakeDistr 'Ledger 'GlobalPropertyProperty Source #

Tabulate the size of a stake distribution

tabulatePersistentToNonPersistentRatioNumSeats 'GlobalNumSeats 'GlobalPropertyProperty Source #

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