cardano-api-1.36.0
Safe HaskellNone
LanguageHaskell2010

Cardano.Api.Modes

Description

Consensus modes. The node supports several different modes with different combinations of consensus protocols and ledger eras.

Synopsis

Consensus modes

data ByronMode Source #

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.

Instances

Instances details
FromJSON (EraInMode ByronEra ByronMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode ByronEra ByronMode) #

parseJSONList ∷ Value → Parser [EraInMode ByronEra ByronMode] #

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

Instances details
FromJSON (EraInMode ShelleyEra ShelleyMode) Source # 
Instance details

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

Instances details
FromJSON (EraInMode BabbageEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode BabbageEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode BabbageEra CardanoMode] #

FromJSON (EraInMode AlonzoEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode AlonzoEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode AlonzoEra CardanoMode] #

FromJSON (EraInMode MaryEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode MaryEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode MaryEra CardanoMode] #

FromJSON (EraInMode AllegraEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode AllegraEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode AllegraEra CardanoMode] #

FromJSON (EraInMode ShelleyEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode ShelleyEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode ShelleyEra CardanoMode] #

FromJSON (EraInMode ByronEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode ByronEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode ByronEra CardanoMode] #

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.

Instances

Instances details
Show (ConsensusMode mode) Source # 
Instance details

Defined in Cardano.Api.Modes

data AnyConsensusMode where Source #

Instances

Instances details
Show AnyConsensusMode Source # 
Instance details

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).

Instances

Instances details
Show (ConsensusModeIsMultiEra mode) Source # 
Instance details

Defined in Cardano.Api.Modes

The eras supported by each mode

data EraInMode era mode where Source #

A representation of which CardanoEras are included in each ConsensusMode.

Instances

Instances details
Eq (EraInMode era mode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

(==)EraInMode era mode → EraInMode era mode → Bool Source #

(/=)EraInMode era mode → EraInMode era mode → Bool Source #

Show (EraInMode era mode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

showsPrecIntEraInMode era mode → ShowS Source #

showEraInMode era mode → String Source #

showList ∷ [EraInMode era mode] → ShowS Source #

FromJSON (EraInMode BabbageEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode BabbageEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode BabbageEra CardanoMode] #

FromJSON (EraInMode AlonzoEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode AlonzoEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode AlonzoEra CardanoMode] #

FromJSON (EraInMode MaryEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode MaryEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode MaryEra CardanoMode] #

FromJSON (EraInMode AllegraEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode AllegraEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode AllegraEra CardanoMode] #

FromJSON (EraInMode ShelleyEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode ShelleyEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode ShelleyEra CardanoMode] #

FromJSON (EraInMode ShelleyEra ShelleyMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode ShelleyEra ShelleyMode) #

parseJSONList ∷ Value → Parser [EraInMode ShelleyEra ShelleyMode] #

FromJSON (EraInMode ByronEra CardanoMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode ByronEra CardanoMode) #

parseJSONList ∷ Value → Parser [EraInMode ByronEra CardanoMode] #

FromJSON (EraInMode ByronEra ByronMode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

parseJSON ∷ Value → Parser (EraInMode ByronEra ByronMode) #

parseJSONList ∷ Value → Parser [EraInMode ByronEra ByronMode] #

ToJSON (EraInMode era mode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

toJSONEraInMode era mode → Value #

toEncodingEraInMode era mode → Encoding #

toJSONList ∷ [EraInMode era mode] → Value #

toEncodingList ∷ [EraInMode era mode] → Encoding #

data AnyEraInMode mode where Source #

Constructors

AnyEraInModeEraInMode era mode → AnyEraInMode mode 

Instances

Instances details
Show (AnyEraInMode mode) Source # 
Instance details

Defined in Cardano.Api.Modes

Methods

showsPrecIntAnyEraInMode mode → ShowS Source #

showAnyEraInMode mode → String Source #

showList ∷ [AnyEraInMode mode] → ShowS Source #

toEraInModeCardanoEra 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 

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 

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.

Instances

Instances details
Show (ConsensusModeParams mode) Source # 
Instance details

Defined in Cardano.Api.Modes

newtype EpochSlots #

Constructors

EpochSlots 

Fields

Instances

Instances details
Eq EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Data EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Methods

gfoldl ∷ (∀ d b. Data d ⇒ c (d → b) → d → c b) → (∀ g. g → c g) → EpochSlots → c EpochSlots Source #

gunfold ∷ (∀ b r. Data b ⇒ c (b → r) → c r) → (∀ r. r → c r) → Constr → c EpochSlots Source #

toConstrEpochSlotsConstr Source #

dataTypeOfEpochSlotsDataType Source #

dataCast1Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c EpochSlots) Source #

dataCast2Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c EpochSlots) Source #

gmapT ∷ (∀ b. Data b ⇒ b → b) → EpochSlotsEpochSlots Source #

gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → EpochSlots → r Source #

gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → EpochSlots → r Source #

gmapQ ∷ (∀ d. Data d ⇒ d → u) → EpochSlots → [u] Source #

gmapQiInt → (∀ d. Data d ⇒ d → u) → EpochSlots → u Source #

gmapMMonad m ⇒ (∀ d. Data d ⇒ d → m d) → EpochSlots → m EpochSlots Source #

gmapMpMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → EpochSlots → m EpochSlots Source #

gmapMoMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → EpochSlots → m EpochSlots Source #

Ord EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Read EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Show EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Generic EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Associated Types

type Rep EpochSlotsTypeType Source #

Buildable EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Methods

buildEpochSlotsBuilder

NoThunks EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Methods

noThunks ∷ Context → EpochSlotsIO (Maybe ThunkInfo)

wNoThunks ∷ Context → EpochSlotsIO (Maybe ThunkInfo)

showTypeOfProxy EpochSlotsString

FromCBOR EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Methods

fromCBOR ∷ Decoder s EpochSlots #

labelProxy EpochSlotsText #

ToCBOR EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Methods

toCBOREpochSlots → Encoding #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy EpochSlots → Size #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [EpochSlots] → Size #

type Rep EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

type Rep EpochSlots = D1 ('MetaData "EpochSlots" "Cardano.Chain.Slotting.EpochSlots" "cardano-ledger-byron-0.1.0.0-d8c725501e9f3ab4d70acf31dcc2151383916faf377ba3009f882d2c64c2d761" 'True) (C1 ('MetaCons "EpochSlots" 'PrefixI 'True) (S1 ('MetaSel ('Just "unEpochSlots") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

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 

toConsensusEraIndexConsensusBlockForMode mode ~ HardForkBlock xs ⇒ EraInMode era mode → EraIndex xs Source #

fromConsensusEraIndexConsensusBlockForMode mode ~ HardForkBlock xs ⇒ ConsensusMode mode → EraIndex xs → AnyEraInMode mode Source #