ouroboros-consensus:unstable-consensus-testlib
Safe HaskellNone
LanguageHaskell2010

Test.Util.Committee

Description

Utility functions for the voting committee tests.

Synopsis

General utilities

mkPoolId ∷ String → PoolId Source #

Create a pool ID from an arbitrary string of any length.

NOTE: we are assuming that this function preserves uniqueness.

unfairWFATiebreaker ∷ WFATiebreaker Source #

An unfair tie-breaker that compares pool IDs lexicographically.

QuickCheck generators

genEpochNonce ∷ Gen Nonce Source #

Generate a random nonce for testing purposes.

genPositiveStake ∷ Gen LedgerStake Source #

Generate a positive stake value using a geometric distribution.

genPools Source #

Arguments

∷ Int

Maximum number of pools to generate

→ Gen (privateKey, publicKey)

Keypair generator

→ Gen (Map PoolId (privateKey, publicKey, LedgerStake)) 

Generate a non-empty map of pools with crypto keys and varying stakes.

NOTE: the generator ensures at least one pool has positive stake.

Property helpers

eqWithShowCmp Source #

Arguments

∷ (a → String)

Custom show function

→ (a → a → Bool)

Custom equality function

→ a

First value

→ a

Second value

→ Property 

Check equality using a custom comparison and show function.

onError ∷ Either err a → (err → a) → a Source #

Handle Either errors by converting them to values.

mkBucket Source #

Arguments

∷ Integer

Bucket size

→ Integer

Value to bucket

→ String 

Create a bucketized label for tabulation.

Tabulation helpers

tabulateNumPools ∷ Map PoolId (privateKey, publicKey, LedgerStake) → Property → Property Source #

Tabulate the number of pools in a test run.

tabulatePoolStake ∷ LedgerStake → Property → Property Source #

Tabulate whether a pool has positive or zero stake.