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

Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel

Description

Infrastructure for doing chain selection across eras

Synopsis

Documentation

data AcrossEraMode cfg a where Source #

GADT indicating whether we are lifting compare or preferCandidate to the HFC, together with the type of configuration we need for that and the result type.

data AcrossEraSelectionTypeTypeType where Source #

Constructors

CompareBlockNoAcrossEraSelection x y

Just compare block numbers

This is a useful default when two eras run totally different consensus protocols, and we just want to choose the longer chain.

CompareSameSelectViewSelectView (BlockProtocol x) ~ SelectView (BlockProtocol y) ⇒ AcrossEraSelection x y

Two eras using the same SelectView. In this case, we can just compare chains even across eras, as the chain ordering is fully captured by SelectView and its ChainOrder instance.

We use the ChainOrderConfig of the SelectView in the newer era (with the intuition that newer eras are generally "preferred") when invoking compareChains. However, this choice is arbitrary; we could also make it configurable here.

data WithBlockNo (f ∷ k → Type) (a ∷ k) Source #

Constructors

WithBlockNo 

Fields

Instances

Instances details
Generic (WithBlockNo f a) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel

Associated Types

type Rep (WithBlockNo f a) ∷ TypeType #

Methods

fromWithBlockNo f a → Rep (WithBlockNo f a) x #

toRep (WithBlockNo f a) x → WithBlockNo f a #

Show (f a) ⇒ Show (WithBlockNo f a) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel

Methods

showsPrecIntWithBlockNo f a → ShowS #

showWithBlockNo f a → String #

showList ∷ [WithBlockNo f a] → ShowS #

Eq (f a) ⇒ Eq (WithBlockNo f a) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel

Methods

(==)WithBlockNo f a → WithBlockNo f a → Bool #

(/=)WithBlockNo f a → WithBlockNo f a → Bool #

NoThunks (f a) ⇒ NoThunks (WithBlockNo f a) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel

type Rep (WithBlockNo f a) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel

type Rep (WithBlockNo f a) = D1 ('MetaData "WithBlockNo" "Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel" "ouroboros-consensus-0.18.0.0-inplace" 'False) (C1 ('MetaCons "WithBlockNo" 'PrefixI 'True) (S1 ('MetaSel ('Just "getBlockNo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BlockNo) :*: S1 ('MetaSel ('Just "dropBlockNo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))

mapWithBlockNo ∷ (f x → g y) → WithBlockNo f x → WithBlockNo g y Source #