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

Test.Ouroboros.Consensus.ChainGenerator.RaceIterator

Description

These functions iteratively produce all race windows in a slot vector.

The first window is produced by init, which unconditionally starts the window at the first slot. This window can then be passed to next, which starts the new window after the first active slot.

---X--X--X--X-- ...
^ start of window 1 from init
    ^ start of window 2 from next
       ^ start of window 3 from next

Valid windows must have k+1 active slots. If the vector doesn't have sufficient slots to meet this condition, init and next return Nothing and we fall back to initConservative and nextConservative, which return windows truncated at the end of time.

Synopsis

Documentation

newtype Race base Source #

A window whose last slot contains the k+1st active slot in it

Constructors

UnsafeRace (SomeWindow RaceLbl base SlotE) 

Bundled Patterns

pattern RaceSomeWindow RaceLbl base SlotERace base 

Instances

Instances details
Read (Race base) Source # 
Instance details

Defined in Test.Ouroboros.Consensus.ChainGenerator.RaceIterator

Methods

readsPrecIntReadS (Race base) #

readListReadS [Race base] #

readPrecReadPrec (Race base) #

readListPrecReadPrec [Race base] #

Show (Race base) Source # 
Instance details

Defined in Test.Ouroboros.Consensus.ChainGenerator.RaceIterator

Methods

showsPrecIntRace base → ShowS #

showRace base → String #

showList ∷ [Race base] → ShowS #

Eq (Race base) Source # 
Instance details

Defined in Test.Ouroboros.Consensus.ChainGenerator.RaceIterator

Methods

(==)Race base → Race base → Bool #

(/=)Race base → Race base → Bool #

initKcpVector base SlotE SMaybe (Race base) Source #

Yields the race window starting at position 0 of the given vector if the k+1 active slot exists.

initConservativeVector base SlotE SRace base Source #

initConservative creates a window for the whole vector.

next ∷ ∀ base. Vector base SlotE SRace base → Maybe (Race base) Source #

next v r yields the race window anchored at the first active slot of r if there is an active slot after r.

nextConservative ∷ ∀ base. Vector base SlotE SRace base → Maybe (Race base) Source #

nextConservative v r yields a window anchored at the first active slot of r if it exists, and extending until the end of v.