ouroboros-consensus-0.21.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Util.ChainUpdates

Contents

Description

Generate sequences of updates to model an evolving chain

Synopsis

Documentation

data ChainUpdate Source #

Constructors

AddBlock TestBlock 
SwitchFork (Point TestBlock) [TestBlock]

Roll back to the given Point, and then immediately roll forward by the given TestBlocks.

Instances

Instances details
Show ChainUpdate Source # 
Instance details

Defined in Test.Util.ChainUpdates

Eq ChainUpdate Source # 
Instance details

Defined in Test.Util.ChainUpdates

Condense ChainUpdate Source # 
Instance details

Defined in Test.Util.ChainUpdates

data UpdateBehavior Source #

Different strategies how to generate a sequence of ChainUpdates.

Constructors

SelectedChainBehavior

Chain updates tracking the selected chain of an honest node. In particular, this includes:

  • All blocks involved are valid.
  • Every ChainUpdate improves the chain.
TentativeChainBehavior

Chain updates tracking the tentative chain of an honest node (in the context of diffusion pipelining). This is similiar to SelectedChainBehavior, but allows for the following sequence of ChainUpdates:

  1. AddBlock blk for blk invalid
  2. SwitchFork (prevPoint blk) [blk'] where blk' is preferable to blk.

genChainUpdates Source #

Arguments

UpdateBehavior 
SecurityParam 
Int

The number of updates to generate

Gen [ChainUpdate] 

Tests

prop_genChainUpdatesSecurityParamIntProperty Source #

Test that applying the generated updates gives us the same chain as cusCurrentChain.