ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Committee.Utils

Description

Utility functions for the voting committee tests.

Synopsis

General utilities

mkPoolIdStringPoolId Source #

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

NOTE: we are assuming that this function preserves uniqueness.

unfairWFATiebreakerWFATiebreaker Source #

An unfair tie-breaker that compares pool IDs lexicographically.

QuickCheck generators

genEpochNonceGen Nonce Source #

Generate a random nonce for testing purposes.

genPositiveStakeGen 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.

onErrorEither 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

tabulateNumPoolsMap PoolId (privateKey, publicKey, LedgerStake) → PropertyProperty Source #

Tabulate the number of pools in a test run.

tabulatePoolStakeLedgerStakePropertyProperty Source #

Tabulate whether a pool has positive or zero stake.