consensus-diffusion-test
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Genesis.Setup.GenChains

Synopsis

Documentation

data GenesisTest blk schedule Source #

All the data used by point schedule tests.

Constructors

GenesisTest 

Fields

Instances

Instances details
Functor (GenesisTest blk) Source # 
Instance details

Defined in Test.Consensus.PointSchedule

Methods

fmap ∷ (a → b) → GenesisTest blk a → GenesisTest blk b #

(<$) ∷ a → GenesisTest blk b → GenesisTest blk a #

class IssueTestBlock blk where Source #

Class of block types for which we can issue blocks for a test.

Methods

issueFirstBlock Source #

Arguments

Int

The fork number

SlotNo

The relative number of slots elapsed since the parent block was issued, NOT the desired slot number of the block itself.

→ blk 

issueSuccessorBlock Source #

Arguments

Maybe Int

A new fork number, or Nothing if it should be on the same branch as its parent.

SlotNo

The relative number of slots elapsed since the parent block was issued, NOT the desired slot number of the block itself.

→ blk 
→ blk 

genChains ∷ (HasHeader blk, IssueTestBlock blk) ⇒ Gen WordGen (GenesisTest blk ()) Source #

genChainsWithExtraHonestPeers Source #

Arguments

∷ (HasHeader blk, IssueTestBlock blk) 
Gen Word

Number of extra honest peers

Gen Word

Number of forks

Gen (GenesisTest blk ()) 

Random generator for a block tree. The block tree contains one trunk (the “honest” chain) and as many branches as given as a parameter (the “alternative” chains or “bad” chains). For instance, one such tree could be graphically represented as:

slots: 1 2 3 4 5 6 7 8 9 trunk: O─────1──2──3──4─────5──6──7 │ ╰─────6 ╰─────3──4─────5 For now, the extraHonestPeers generator is only used to fill the GenesisTest field. However, in the future it could also be used to generate "short forks" near the tip of the trunk.