Safe Haskell | None |
---|---|
Language | Haskell2010 |
Consensus modes. The node supports several different modes with different combinations of consensus protocols and ledger eras.
Synopsis
- data ColeMode
- data SophieMode
- data BccMode
- data ConsensusMode mode where
- data AnyConsensusMode where
- renderMode ∷ AnyConsensusMode → Text
- data ConsensusModeIsMultiEra mode where
- data EraInMode era mode where
- ColeEraInColeMode ∷ EraInMode ColeEra ColeMode
- SophieEraInSophieMode ∷ EraInMode SophieEra SophieMode
- ColeEraInBccMode ∷ EraInMode ColeEra BccMode
- SophieEraInBccMode ∷ EraInMode SophieEra BccMode
- EvieEraInBccMode ∷ EraInMode EvieEra BccMode
- JenEraInBccMode ∷ EraInMode JenEra BccMode
- AurumEraInBccMode ∷ EraInMode AurumEra BccMode
- eraInModeToEra ∷ EraInMode era mode → BccEra era
- anyEraInModeToAnyEra ∷ AnyEraInMode mode → AnyBccEra
- data AnyEraInMode mode where
- AnyEraInMode ∷ EraInMode era mode → AnyEraInMode mode
- toEraInMode ∷ BccEra era → ConsensusMode mode → Maybe (EraInMode era mode)
- data ConsensusModeParams mode where
- data AnyConsensusModeParams where
- newtype EpochSlots = EpochSlots {}
- type family ConsensusBlockForMode mode where ...
- type family ConsensusBlockForEra era where ...
- toConsensusEraIndex ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ EraInMode era mode → EraIndex xs
- fromConsensusEraIndex ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ ConsensusMode mode → EraIndex xs → AnyEraInMode mode
Consensus modes
The Cole-only consensus mode consists of only the Cole era.
This was used on the mainnet before the deployment of the multi-era
BccMode
. It is now of little practical use, though it illustrates
how a single-era consensus mode works. It may be sensible to remove this
at some stage.
data SophieMode Source #
The Sophie-only consensus mode consists of only the Sophie era.
This was used for the early Sophie testnets prior to the use of the
multi-era BccMode
. It is useful for setting up Sophie test networks
(e.g. for benchmarking) without having to go through the complication of the
hard fork from Cole to Sophie eras. It also shows how a single-era
consensus mode works. It may be replaced by other single-era modes in future.
data ConsensusMode mode where Source #
This GADT provides a value-level representation of all the consensus modes. This enables pattern matching on the era to allow them to be treated in a non-uniform way.
ColeMode ∷ ConsensusMode ColeMode | |
SophieMode ∷ ConsensusMode SophieMode | |
BccMode ∷ ConsensusMode BccMode |
Instances
Show (ConsensusMode mode) Source # | |
Defined in Bcc.Api.Modes |
data AnyConsensusMode where Source #
Instances
Show AnyConsensusMode Source # | |
Defined in Bcc.Api.Modes |
data ConsensusModeIsMultiEra mode where Source #
The subset of consensus modes that consist of multiple eras. Some features are not supported in single-era modes (for exact compatibility with not using the hard fork combinatior at all).
Instances
Show (ConsensusModeIsMultiEra mode) Source # | |
Defined in Bcc.Api.Modes |
The eras supported by each mode
data EraInMode era mode where Source #
A representation of which BccEra
s are included in each
ConsensusMode
.
eraInModeToEra ∷ EraInMode era mode → BccEra era Source #
anyEraInModeToAnyEra ∷ AnyEraInMode mode → AnyBccEra Source #
data AnyEraInMode mode where Source #
AnyEraInMode ∷ EraInMode era mode → AnyEraInMode mode |
Instances
Show (AnyEraInMode mode) Source # | |
Defined in Bcc.Api.Modes |
toEraInMode ∷ BccEra era → ConsensusMode mode → Maybe (EraInMode era mode) Source #
Connection paramaters for each mode
data ConsensusModeParams mode where Source #
The consensus-mode-specific parameters needed to connect to a local node that is using each consensus mode.
It is in fact only the Cole era that requires extra parameters, but this is
of course inherited by the BccMode
that uses the Cole era. The reason
this parameter is needed stems from unfortunate design decisions from the
legacy Cole era. The slots per epoch are needed to be able to decode
epoch boundary blocks from the Cole era.
It is possible in future that we may be able to eliminate this parameter by discovering it from the node during the initial handshake.
ColeModeParams ∷ EpochSlots → ConsensusModeParams ColeMode | |
SophieModeParams ∷ ConsensusModeParams SophieMode | |
BccModeParams ∷ EpochSlots → ConsensusModeParams BccMode |
Instances
Show (ConsensusModeParams mode) Source # | |
Defined in Bcc.Api.Modes |
data AnyConsensusModeParams where Source #
Instances
Show AnyConsensusModeParams Source # | |
Defined in Bcc.Api.Modes |
newtype EpochSlots #
Instances
Conversions to and from types in the consensus library
type family ConsensusBlockForMode mode where ... Source #
A closed type family that maps between the consensus mode (from this API) and the block type used by the consensus libraries.
ConsensusBlockForMode ColeMode = ColeBlockHFC | |
ConsensusBlockForMode SophieMode = SophieBlockHFC StandardSophie | |
ConsensusBlockForMode BccMode = BccBlock StandardCrypto |
type family ConsensusBlockForEra era where ... Source #
ConsensusBlockForEra ColeEra = ColeBlock | |
ConsensusBlockForEra SophieEra = SophieBlock StandardSophie | |
ConsensusBlockForEra EvieEra = SophieBlock StandardEvie | |
ConsensusBlockForEra JenEra = SophieBlock StandardJen | |
ConsensusBlockForEra AurumEra = SophieBlock StandardAurum |
toConsensusEraIndex ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ EraInMode era mode → EraIndex xs Source #
fromConsensusEraIndex ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ ConsensusMode mode → EraIndex xs → AnyEraInMode mode Source #