ouroboros-consensus-0.27.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

Synopsis

Documentation

data AcrossEraMode (cfg ∷ TypeType) 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 AcrossEraTiebreaker a b where Source #

How to compare chains of equal length across eras.

Constructors

NoTiebreakerAcrossEras ∷ ∀ a b. AcrossEraTiebreaker a b

No preference.

SameTiebreakerAcrossEras ∷ ∀ a b. TiebreakerView (BlockProtocol a) ~ TiebreakerView (BlockProtocol b) ⇒ AcrossEraTiebreaker a b

Two eras using the same TiebreakerView, so use the corresponding (identical) tiebreaker.

We use the ChainOrderConfig of the TiebreakerView 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.

acrossEraSelection ∷ ∀ (xs ∷ [Type]) (cfg ∷ TypeType) a. All SingleEraBlock xs ⇒ AcrossEraMode cfg a → NP cfg xs → Tails AcrossEraTiebreaker xs → NS WrapTiebreakerView xs → NS WrapTiebreakerView xs → a Source #