ouroboros-consensus:unstable-cardano-testlib
Safe HaskellNone
LanguageHaskell2010

Test.ThreadNet.Infra.TwoEras

Description

Definitions used in ThreadNet tests that involve two eras.

Synopsis

Generators

data Partition Source #

When and for how long the nodes are partitioned

The nodes are divided via message delays into two sub-networks by the parity of their CoreNodeId.

Constructors

Partition SlotNo NumSlots

the scheduled start slot and duration (which includes the start slot)

Instances

Instances details
Show Partition Source # 
Instance details

Defined in Test.ThreadNet.Infra.TwoEras

Methods

showsPrec ∷ Int → Partition → ShowS #

show ∷ Partition → String #

showList ∷ [Partition] → ShowS #

genPartition ∷ NumCoreNodes → NumSlots → SecurityParam → Gen Partition Source #

Generate setupPartition

genTestConfig ∷ SecurityParam → (EpochSize, EpochSize) → Gen TestConfig Source #

Generate a setupTestConfig relevant to the case where the first era (eg Byron) lasts for one epoch and the second era (eg Shelley) lasts for an interesting number of slots.

Era inspection

data ReachesEra2 Source #

Whether the test included second era blocks and (pre)reqs relevant to that

Note these fields are ordered alphabetically not semantically; see label_ReachesEra2.

Constructors

ReachesEra2 

Fields

  • rsEra1Slots ∷ Prereq

    enough slots in the first era to enable a block in the second era

  • rsPV ∷ Prereq

    sufficient protocol version to enable a block in the second era

  • rsEra2Blocks ∷ Bool

    blocks from the second era included in final chains

  • rsEra2Slots ∷ Requirement

    enough slots in the second era to necessitate a block in the second era

Instances

Instances details
Generic ReachesEra2 Source # 
Instance details

Defined in Test.ThreadNet.Infra.TwoEras

Associated Types

type Rep ReachesEra2 
Instance details

Defined in Test.ThreadNet.Infra.TwoEras

type Rep ReachesEra2 = D1 ('MetaData "ReachesEra2" "Test.ThreadNet.Infra.TwoEras" "ouroboros-consensus-4.0.0.0-inplace-unstable-cardano-testlib" 'False) (C1 ('MetaCons "ReachesEra2" 'PrefixI 'True) ((S1 ('MetaSel ('Just "rsEra1Slots") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Prereq) :*: S1 ('MetaSel ('Just "rsPV") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Prereq)) :*: (S1 ('MetaSel ('Just "rsEra2Blocks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "rsEra2Slots") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Requirement))))
Show ReachesEra2 Source # 
Instance details

Defined in Test.ThreadNet.Infra.TwoEras

CollectReqs ReachesEra2 Source # 
Instance details

Defined in Test.ThreadNet.Infra.TwoEras

Methods

collectReqs ∷ ReachesEra2 → ([Prereq], [Requirement])

type Rep ReachesEra2 Source # 
Instance details

Defined in Test.ThreadNet.Infra.TwoEras

type Rep ReachesEra2 = D1 ('MetaData "ReachesEra2" "Test.ThreadNet.Infra.TwoEras" "ouroboros-consensus-4.0.0.0-inplace-unstable-cardano-testlib" 'False) (C1 ('MetaCons "ReachesEra2" 'PrefixI 'True) ((S1 ('MetaSel ('Just "rsEra1Slots") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Prereq) :*: S1 ('MetaSel ('Just "rsPV") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Prereq)) :*: (S1 ('MetaSel ('Just "rsEra2Blocks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "rsEra2Slots") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Requirement))))

activeSlotCoeff ∷ Rational Source #

The active slot coefficient, f.

Some of these tests include epochs in the second era in which stakepools are actually leading. In that case, the k, d, and f parameters and the length of any scheduled network partitions need to be balanced so that Common Prefix violations (in particular, wedges) are extremely unlikely.

isFirstEraBlock ∷ ∀ era (eras ∷ [Type]). HardForkBlock (era ': eras) → Bool Source #

ledgerReachesEra2 ∷ ReachesEra2 → Bool Source #

Is the update proposal adopted?

mkMessageDelay ∷ Partition → CalcMessageDelay blk Source #

The temporary partition as a CalcMessageDelay

Calculates the delays that implement setupPartition.

numFirstEraEpochs ∷ Num a ⇒ a Source #

The number of epochs in the first era in this test

All nodes join in slot 0, we generate the proposal in slot 0, we also generate the votes in slot 0, and the nodes are endorsing the proposal as of slot 0. Thus we expect that the first era will end after one epoch. Otherwise it would indicate some sort of protocol failure.

secondEraOverlaySlots ∷ NumSlots → NumSlots → UnitInterval → EpochSize → Set SlotNo Source #

All OBFT overlay slots in the second era.

Properties

label_ReachesEra2 ∷ ReachesEra2 → String Source #

List the (pre)reqs in semantic order, followed by the observation

label_hadActiveNonOverlaySlots ∷ ∀ era (eras ∷ [Type]). TestOutput (HardForkBlock (era ': eras)) → Set SlotNo → String Source #

Whether there was a block forged in a non-overlay slot in the second era.

This event evidences that the stake pools were correctly created and delegated to.

prop_ReachesEra2 ∷ ReachesEra2 → Property Source #

Checks if the observation satisfies the (pre)reqs