Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Cardano.Api.Modes
Description
Consensus modes. The node supports several different modes with different combinations of consensus protocols and ledger eras.
Synopsis
- data ByronMode
- data ShelleyMode
- data CardanoMode
- data ConsensusMode mode where
- data AnyConsensusMode where
- renderMode ∷ AnyConsensusMode → Text
- data ConsensusModeIsMultiEra mode where
- data EraInMode era mode where
- ByronEraInByronMode ∷ EraInMode ByronEra ByronMode
- ShelleyEraInShelleyMode ∷ EraInMode ShelleyEra ShelleyMode
- ByronEraInCardanoMode ∷ EraInMode ByronEra CardanoMode
- ShelleyEraInCardanoMode ∷ EraInMode ShelleyEra CardanoMode
- AllegraEraInCardanoMode ∷ EraInMode AllegraEra CardanoMode
- MaryEraInCardanoMode ∷ EraInMode MaryEra CardanoMode
- AlonzoEraInCardanoMode ∷ EraInMode AlonzoEra CardanoMode
- BabbageEraInCardanoMode ∷ EraInMode BabbageEra CardanoMode
- ConwayEraInCardanoMode ∷ EraInMode ConwayEra CardanoMode
- eraInModeToEra ∷ EraInMode era mode → CardanoEra era
- anyEraInModeToAnyEra ∷ AnyEraInMode mode → AnyCardanoEra
- data AnyEraInMode mode where
- AnyEraInMode ∷ EraInMode era mode → AnyEraInMode mode
- toEraInMode ∷ CardanoEra era → ConsensusMode mode → Maybe (EraInMode era mode)
- type family ConsensusProtocol era where ...
- type family ChainDepStateProtocol era where ...
- data ConsensusModeParams mode where
- data AnyConsensusModeParams where
- newtype EpochSlots = EpochSlots {}
- type family ConsensusCryptoForBlock block where ...
- 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 Byron-only consensus mode consists of only the Byron era.
This was used on the mainnet before the deployment of the multi-era
CardanoMode
. 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 ShelleyMode Source #
The Shelley-only consensus mode consists of only the Shelley era.
This was used for the early Shelley testnets prior to the use of the
multi-era CardanoMode
. It is useful for setting up Shelley test networks
(e.g. for benchmarking) without having to go through the complication of the
hard fork from Byron to Shelley eras. It also shows how a single-era
consensus mode works. It may be replaced by other single-era modes in future.
Instances
FromJSON (EraInMode ShelleyEra ShelleyMode) Source # | |
Defined in Cardano.Api.Modes Methods parseJSON ∷ Value → Parser (EraInMode ShelleyEra ShelleyMode) # parseJSONList ∷ Value → Parser [EraInMode ShelleyEra ShelleyMode] # |
data CardanoMode Source #
The Cardano consensus mode consists of all the eras currently in use on
the Cardano mainnet. This is currently: the ByronEra
; ShelleyEra
,
AllegraEra
and MaryEra
, in that order.
This mode will be extended with new eras as the Cardano mainnet develops.
Instances
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.
Constructors
ByronMode ∷ ConsensusMode ByronMode | |
ShelleyMode ∷ ConsensusMode ShelleyMode | |
CardanoMode ∷ ConsensusMode CardanoMode |
Instances
Show (ConsensusMode mode) Source # | |
Defined in Cardano.Api.Modes |
data AnyConsensusMode where Source #
Constructors
AnyConsensusMode ∷ ConsensusMode mode → AnyConsensusMode |
Instances
Show AnyConsensusMode Source # | |
Defined in Cardano.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 without using the hard fork combination at all).
Constructors
CardanoModeIsMultiEra ∷ ConsensusModeIsMultiEra CardanoMode |
Instances
Show (ConsensusModeIsMultiEra mode) Source # | |
Defined in Cardano.Api.Modes |
The eras supported by each mode
data EraInMode era mode where Source #
A representation of which CardanoEra
s are included in each
ConsensusMode
.
Constructors
Instances
eraInModeToEra ∷ EraInMode era mode → CardanoEra era Source #
anyEraInModeToAnyEra ∷ AnyEraInMode mode → AnyCardanoEra Source #
data AnyEraInMode mode where Source #
Constructors
AnyEraInMode ∷ EraInMode era mode → AnyEraInMode mode |
Instances
Show (AnyEraInMode mode) Source # | |
Defined in Cardano.Api.Modes |
toEraInMode ∷ CardanoEra era → ConsensusMode mode → Maybe (EraInMode era mode) Source #
The protocols supported in each era
type family ConsensusProtocol era where ... Source #
Equations
ConsensusProtocol ShelleyEra = TPraos StandardCrypto | |
ConsensusProtocol AllegraEra = TPraos StandardCrypto | |
ConsensusProtocol MaryEra = TPraos StandardCrypto | |
ConsensusProtocol AlonzoEra = TPraos StandardCrypto | |
ConsensusProtocol BabbageEra = Praos StandardCrypto | |
ConsensusProtocol ConwayEra = Praos StandardCrypto |
type family ChainDepStateProtocol era where ... Source #
Equations
ChainDepStateProtocol ShelleyEra = TPraosState StandardCrypto | |
ChainDepStateProtocol AllegraEra = TPraosState StandardCrypto | |
ChainDepStateProtocol MaryEra = TPraosState StandardCrypto | |
ChainDepStateProtocol AlonzoEra = TPraosState StandardCrypto | |
ChainDepStateProtocol BabbageEra = PraosState StandardCrypto | |
ChainDepStateProtocol ConwayEra = PraosState StandardCrypto |
Connection parameters 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 Byron era that requires extra parameters, but this is
of course inherited by the CardanoMode
that uses the Byron era. The reason
this parameter is needed stems from unfortunate design decisions from the
legacy Byron era. The slots per epoch are needed to be able to decode
epoch boundary blocks from the Byron 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.
Constructors
ByronModeParams ∷ EpochSlots → ConsensusModeParams ByronMode | |
ShelleyModeParams ∷ ConsensusModeParams ShelleyMode | |
CardanoModeParams ∷ EpochSlots → ConsensusModeParams CardanoMode |
Instances
Show (ConsensusModeParams mode) Source # | |
Defined in Cardano.Api.Modes |
data AnyConsensusModeParams where Source #
Constructors
AnyConsensusModeParams ∷ ConsensusModeParams mode → AnyConsensusModeParams |
Instances
Show AnyConsensusModeParams Source # | |
Defined in Cardano.Api.Modes |
newtype EpochSlots #
Constructors
EpochSlots | |
Fields |
Instances
Conversions to and from types in the consensus library
type family ConsensusCryptoForBlock block where ... Source #
Equations
ConsensusCryptoForBlock ByronBlockHFC = StandardCrypto | |
ConsensusCryptoForBlock (ShelleyBlockHFC (TPraos StandardCrypto) StandardShelley) = StandardShelley | |
ConsensusCryptoForBlock (CardanoBlock StandardCrypto) = StandardCrypto |
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.
Equations
ConsensusBlockForMode ByronMode = ByronBlockHFC | |
ConsensusBlockForMode ShelleyMode = ShelleyBlockHFC (TPraos StandardCrypto) StandardShelley | |
ConsensusBlockForMode CardanoMode = CardanoBlock StandardCrypto |
type family ConsensusBlockForEra era where ... Source #
Equations
ConsensusBlockForEra ByronEra = ByronBlock | |
ConsensusBlockForEra ShelleyEra = StandardShelleyBlock | |
ConsensusBlockForEra AllegraEra = StandardAllegraBlock | |
ConsensusBlockForEra MaryEra = StandardMaryBlock | |
ConsensusBlockForEra AlonzoEra = StandardAlonzoBlock | |
ConsensusBlockForEra BabbageEra = StandardBabbageBlock | |
ConsensusBlockForEra ConwayEra = StandardConwayBlock |
toConsensusEraIndex ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ EraInMode era mode → EraIndex xs Source #
fromConsensusEraIndex ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ ConsensusMode mode → EraIndex xs → AnyEraInMode mode Source #