ouroboros-network:testlib
Safe HaskellNone
LanguageHaskell2010

Test.Ouroboros.Network.LedgerPeers

Synopsis

Documentation

newtype LedgerPools Source #

Instances

Instances details
Arbitrary LedgerPools Source #

Calculate relative stake.

PRECONDITION: total stake must be > 0, otherwise the exception `Ratio has zero denominator` is thrown (see https://github.com/IntersectMBO/ouroboros-network/issues/5091).

Instance details

Defined in Test.Ouroboros.Network.LedgerPeers

Show LedgerPools Source # 
Instance details

Defined in Test.Ouroboros.Network.LedgerPeers

genLedgerPoolsFrom Source #

Arguments

:: [NonEmpty RelayAccessPoint]

each inner list denotes relays of one pool. PRECONDITION: each inner list must be non-empty.

-> Gen LedgerPools 

Enhance a list of pools, each one represented by a list of RelayAccessPoint, with a stake.

prop_ledgerPeerSnapshot_requests :: ArbStakeMapOverSource -> Property Source #

This test checks whether requesting ledger peers works as intended when snapshot data is available. For each request, peers must be returned from the right source - either the ledger or snapshot, depending on whether which source is fresher.

prop_pick100 Source #

Arguments

:: Word16 
-> NonNegative Int

number of pools with 0 stake

-> ArbLedgerPeersKind 
-> MockRoots 
-> DelayAndTimeoutScripts 
-> ArbitrarySlotNo 
-> Property 

A pool with 100% stake should always be picked.

prop_pick :: LedgerPools -> ArbLedgerPeersKind -> Word16 -> Word16 -> MockRoots -> Script DNSLookupDelay -> ArbitrarySlotNo -> Property Source #

Verify that given at least one peer we manage to pick count peers.

prop_recomputeRelativeStake :: LedgerPools -> Property Source #

This functions checks the following properties: 1. The accumulated relative stake adds up to unity 2. No pool relative stake can be less than 0 3. The relays aren't mangled 4. Running this function multiple times always produces the same result

prop_ledgerPeerSnapshotCBORV2 :: ArbitrarySlotNo -> LedgerPools -> Property Source #

Checks validity of LedgerPeerSnapshot CBOR encoding, and whether round trip cycle is the identity function

prop_ledgerPeerSnapshotJSONV2 :: ArbitrarySlotNo -> LedgerPools -> Property Source #

Tests if LedgerPeerSnapshot JSON round trip is the identity function

snapshotV2 :: ArbitrarySlotNo -> LedgerPools -> LedgerPeerSnapshot Source #

helper functions for ledgerpeersnapshot encoding tests

data WithThreadAndTime a Source #

Instances

Instances details
Show a => Show (WithThreadAndTime a) Source # 
Instance details

Defined in Test.Ouroboros.Network.LedgerPeers

verboseTracer :: forall a (m :: Type -> Type). (MonadSay m, Show a) => Tracer m a Source #