consensus-test
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Consensus.PeerSimulator.CSJInvariants

Description

This module provides a watcher of the invariants that are specific to the ChainSync jumping (CSJ) implementation. Those invariants are typically documented in the codebase but are not checked in any way, yet they are crucial for CSJ to work properly. This watcher monitors the ChainSync handlers and throws a Violation exception when an invariant stops holding. It is intended for testing purposes.

Synopsis

Documentation

data Violation peer blk Source #

An exception that is thrown when an invariant is violated. It carries the name of the invariant and the view of the state that triggered the invariant violation.

Instances

Instances details
(Typeable blk, StandardHash blk, Eq peer, Show peer, Typeable peer) ⇒ Exception (Violation peer blk) Source # 
Instance details

Defined in Test.Consensus.PeerSimulator.CSJInvariants

(StandardHash blk, Show peer) ⇒ Show (Violation peer blk) Source # 
Instance details

Defined in Test.Consensus.PeerSimulator.CSJInvariants

Methods

showsPrecIntViolation peer blk → ShowS #

showViolation peer blk → String #

showList ∷ [Violation peer blk] → ShowS #

(StandardHash blk, Eq peer) ⇒ Eq (Violation peer blk) Source # 
Instance details

Defined in Test.Consensus.PeerSimulator.CSJInvariants

Methods

(==)Violation peer blk → Violation peer blk → Bool #

(/=)Violation peer blk → Violation peer blk → Bool #

watcher ∷ (MonadSTM m, MonadThrow m, Eq peer, Show peer, Typeable peer, Typeable blk, StandardHash blk) ⇒ StrictTVar m (Map peer (ChainSyncClientHandle m blk)) → Watcher m (View peer blk) (View peer blk) Source #

The watcher of ChainSync jumping invariants. It receives the ChainSync handles and monitors them for changes. When a change is detected, it runs all the invariants and throws Violation if any of the invariants is violated.