ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.HardFork.Combinator.Protocol.ChainSel

Description

Infrastructure for doing chain selection across eras

Documentation

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.

SelectSameProtocolBlockProtocol x ~ BlockProtocol y ⇒ AcrossEraSelection x y

Two eras running the same protocol

In this case, we can just call compareChains even across eras. (The ChainSelConfig must also be the same in both eras: we assert this at the value level.)

NOTE: We require that the eras have the same protocol, not merely the same SelectView, because if we have two eras with different protocols that happen to use the same SelectView but a different way to compare chains, it's not clear how to do cross-era selection.

CustomChainSel ∷ (SelectView (BlockProtocol x) → SelectView (BlockProtocol y) → Ordering) → AcrossEraSelection x y

Custom chain selection

This is the most general form, and allows to override chain selection for the specific combination of two eras with a custom comparison function.

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

Constructors

WithBlockNo 

Fields

Instances

Instances details
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 Source #

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

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

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

Generic (WithBlockNo f a) Source # 
Instance details

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

Associated Types

type Rep (WithBlockNo f a) ∷ TypeType Source #

Methods

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

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

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

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

Methods

noThunks ∷ Context → WithBlockNo f a → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → WithBlockNo f a → IO (Maybe ThunkInfo) #

showTypeOfProxy (WithBlockNo f a) → String #

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.1.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 #