consensus-diffusion-test
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.PeerSimulator.StateDiagram

Description

A pretty-printer and tracer that shows the current peer simulator state in a block tree, highlighting the candidate fragments, selection, and forks in different colors, omitting uninteresting segments.

Synopsis

Documentation

data PeerSimState blk Source #

All inputs for the state diagram printer.

peerSimStateDiagramSTMTracer ∷ (IOLike m, HasHeader blk, Eq (Header blk), GetHeader blk) ⇒ Tracer m StringBlockTree blk → STM m (AnchoredFragment (Header blk)) → STM m (Map PeerId (AnchoredFragment (Header blk))) → STM m (Map PeerId (Maybe (NodeState blk))) → m (Tracer m ()) Source #

Construct a stateful tracer that prints the current peer simulator state in a block tree, highlighting the candidate fragments, selection, and forks in different colors, omitting uninteresting segments.

Since the tracer gets its input from concurrent state, it takes only a dummy () value as its argument.

peerSimStateDiagramSTMTracerDebug ∷ (IOLike m, HasHeader blk, Eq (Header blk), GetHeader blk) ⇒ BlockTree blk → STM m (AnchoredFragment (Header blk)) → STM m (Map PeerId (AnchoredFragment (Header blk))) → STM m (Map PeerId (Maybe (NodeState blk))) → m (Tracer m ()) Source #

Construct a stateful tracer that prints the current peer simulator state in a block tree, highlighting the candidate fragments, selection, and forks in different colors, omitting uninteresting segments.

Since the tracer gets its input from concurrent state, it takes only a dummy () value as its argument.

This variant uses the global debug tracer.

peerSimStateDiagramTracer ∷ ∀ blk (m ∷ TypeType). (HasHeader blk, Eq (Header blk), GetHeader blk) ⇒ Tracer m StringTracer m (PeerSimState blk) Source #

Construct a tracer that prints the current peer simulator state in a block tree, highlighting the candidate fragments, selection, and forks in different colors, omitting uninteresting segments.

peerSimStateDiagramWith ∷ (Eq (Header blk), HasHeader blk, GetHeader blk) ⇒ RenderConfigPeerSimState blk → (String, Map PeerId Word64) Source #

Pretty-print the current peer simulator state in a block tree, highlighting the candidate fragments, selection, and forks in different colors, omitting uninteresting segments.