Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Generate sequences of updates to model an evolving chain
Synopsis
- data ChainUpdate
- data UpdateBehavior
- genChainUpdates ∷ UpdateBehavior → SecurityParam → Int → Gen [ChainUpdate]
- toChainUpdates ∷ [ChainUpdate] → [ChainUpdate TestBlock TestBlock]
- prop_genChainUpdates ∷ SecurityParam → Int → Property
Documentation
data ChainUpdate Source #
AddBlock TestBlock | |
SwitchFork (Point TestBlock) [TestBlock] | Roll back to the given |
Instances
Show ChainUpdate Source # | |
Defined in Test.Util.ChainUpdates showsPrec ∷ Int → ChainUpdate → ShowS # show ∷ ChainUpdate → String # showList ∷ [ChainUpdate] → ShowS # | |
Eq ChainUpdate Source # | |
Defined in Test.Util.ChainUpdates (==) ∷ ChainUpdate → ChainUpdate → Bool # (/=) ∷ ChainUpdate → ChainUpdate → Bool # | |
Condense ChainUpdate Source # | |
Defined in Test.Util.ChainUpdates condense ∷ ChainUpdate → String Source # |
data UpdateBehavior Source #
Different strategies how to generate a sequence of ChainUpdate
s.
SelectedChainBehavior | Chain updates tracking the selected chain of an honest node. In particular, this includes:
|
TentativeChainBehavior | Chain updates tracking the tentative chain of an honest node (in the
context of diffusion pipelining). This is similiar to
|
Instances
Bounded UpdateBehavior Source # | |
Defined in Test.Util.ChainUpdates | |
Enum UpdateBehavior Source # | |
Defined in Test.Util.ChainUpdates succ ∷ UpdateBehavior → UpdateBehavior # pred ∷ UpdateBehavior → UpdateBehavior # toEnum ∷ Int → UpdateBehavior # fromEnum ∷ UpdateBehavior → Int # enumFrom ∷ UpdateBehavior → [UpdateBehavior] # enumFromThen ∷ UpdateBehavior → UpdateBehavior → [UpdateBehavior] # enumFromTo ∷ UpdateBehavior → UpdateBehavior → [UpdateBehavior] # enumFromThenTo ∷ UpdateBehavior → UpdateBehavior → UpdateBehavior → [UpdateBehavior] # | |
Show UpdateBehavior Source # | |
Defined in Test.Util.ChainUpdates showsPrec ∷ Int → UpdateBehavior → ShowS # show ∷ UpdateBehavior → String # showList ∷ [UpdateBehavior] → ShowS # | |
Eq UpdateBehavior Source # | |
Defined in Test.Util.ChainUpdates (==) ∷ UpdateBehavior → UpdateBehavior → Bool # (/=) ∷ UpdateBehavior → UpdateBehavior → Bool # |
∷ UpdateBehavior | |
→ SecurityParam | |
→ Int | The number of updates to generate |
→ Gen [ChainUpdate] |
Tests
prop_genChainUpdates ∷ SecurityParam → Int → Property Source #
Test that applying the generated updates gives us the same chain
as cusCurrentChain
.