ouroboros-consensus-cardano-0.20.0.0: The instantation of the Ouroboros consensus layer used by Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Cardano.Node

Synopsis

Documentation

data CardanoHardForkTrigger blk Source #

When to trigger a hard fork to a Cardano era.

Constructors

CardanoTriggerHardForkAtDefaultVersion

Trigger the hard fork when the ledger protocol version is updated to the default for that era (eraProtVerLow @(ShelleyBlockLedgerEra blk)). Also see TriggerHardForkAtVersion.

CardanoTriggerHardForkAtEpoch EpochNo

Trigger the hard fork at the given epoch. For testing only. Also see TriggerHardForkAtEpoch.

Instances

Instances details
Show (CardanoHardForkTrigger blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Cardano.Node

data CardanoProtocolParams c Source #

Parameters needed to run Cardano.

On the relation between cardanoHardForkTriggers and cardanoProtocolVersion:

The cardanoHardForkTriggers can mention ledger protocol version versions at which the hard fork will occur. In principle there is no relation between the versions mentioned in cardanoProtocolVerson (if any) and cardanoHardForkTriggers, however their relationship might indicate experimental eras or intra-era hard forks. For instance if the last era in the CardanoHardForkTriggers is set to 9 0, ie:

... :* TriggerHardForkAtVersion (ProtVer (SL.natVersion @9) 0)

Setting cardanoProtocolVersion to ProtVer (SL.natVersion 8) 0 will mark that last era as experimental because the obsolete node checks determine that the highest version we support is 8 0@.

If, on the other hand, we would set cardanoProtocolVersion to ProtVer (SL.natVersion 10) 0, this indicates that the node is ready to perform an intra-era hardfork (from version 9 to version 10@).

Constructors

CardanoProtocolParams 

Fields

newtype MaxMajorProtVer Source #

The maximum major protocol version.

This refers to the largest ledger version that this node supports.

Once the ledger protocol version (as reported by the ledger state) exceeds this version we will consider all blocks invalid. This is called the "obsolete node check" (see the ObsoleteNode error constructor).

Major ledger protocol versions are used to trigger both intra and inter era hard forks, which can potentially change the set of ledger rules that are applied.

Minor ledger protocol versions were intended to signal soft forks but they're currently unused, and they're irrelevant for the consensus logic.

For Cardano mainnet, the Shelley era has major protocol version 2. For more details, see this table

Constructors

MaxMajorProtVer 

Instances

Instances details
Generic MaxMajorProtVer 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

Associated Types

type Rep MaxMajorProtVerTypeType #

Show MaxMajorProtVer 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

Eq MaxMajorProtVer 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

NoThunks MaxMajorProtVer 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

type Rep MaxMajorProtVer 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

type Rep MaxMajorProtVer = D1 ('MetaData "MaxMajorProtVer" "Ouroboros.Consensus.Protocol.Praos.Common" "ouroboros-consensus-protocol-0.9.0.2-inplace" 'True) (C1 ('MetaCons "MaxMajorProtVer" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMaxMajorProtVer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version)))

data TriggerHardFork Source #

The trigger condition that will cause the hard fork transition.

This type is only intended for use as part of a LedgerCfg, which means it is "static": it cannot change during an execution of the node process.

Constructors

TriggerHardForkAtVersion !Word16

Trigger the transition when the on-chain protocol major version (from the ledger state) reaches this number.

Note: The HFC logic does not require the trigger version for one era to be the successor of the trigger version for the previous era.

TriggerHardForkAtEpoch !EpochNo

For testing only, trigger the transition at a specific hard-coded epoch, irrespective of the ledger state.

TriggerHardForkNotDuringThisExecution

Ledger states in this era cannot determine when the hard fork transition will happen.

It's crucial to note that this option does not imply that "the era will never end". Instead, the era cannot end within this node process before it restarts with different software and/or configuration for this era.

Instances

Instances details
Generic TriggerHardFork 
Instance details

Defined in Ouroboros.Consensus.HardFork.Simple

Associated Types

type Rep TriggerHardForkTypeType #

Show TriggerHardFork 
Instance details

Defined in Ouroboros.Consensus.HardFork.Simple

NoThunks TriggerHardFork 
Instance details

Defined in Ouroboros.Consensus.HardFork.Simple

type Rep TriggerHardFork 
Instance details

Defined in Ouroboros.Consensus.HardFork.Simple

type Rep TriggerHardFork = D1 ('MetaData "TriggerHardFork" "Ouroboros.Consensus.HardFork.Simple" "ouroboros-consensus-0.21.0.0-inplace" 'False) (C1 ('MetaCons "TriggerHardForkAtVersion" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :+: (C1 ('MetaCons "TriggerHardForkAtEpoch" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 EpochNo)) :+: C1 ('MetaCons "TriggerHardForkNotDuringThisExecution" 'PrefixI 'False) (U1TypeType)))

protocolInfoCardano ∷ ∀ c m. (IOLike m, CardanoHardForkConstraints c) ⇒ CardanoProtocolParams c → (ProtocolInfo (CardanoBlock c), m [BlockForging m (CardanoBlock c)]) Source #

Create a ProtocolInfo for CardanoBlock

NOTE: For testing and benchmarking purposes, the genesis config can contain certain data to be registered in the initial ledger state, like initial staking and funds. These are registered only if the given CardanoHardForkTriggers tell us to skip the Byron era and hard fork directly to Shelley or a later era by using TestXHardForkAtEpoch 0. When gNetworkId == Mainnet, no such data must be present.

PRECONDITION: only a single set of Shelley credentials is allowed when used for mainnet (check against gNetworkId == Mainnet).

SupportedNetworkProtocolVersion

pattern CardanoNodeToClientVersion1BlockNodeToClientVersion (CardanoBlock c) Source #

We support the sole Byron version with the hard fork disabled.

pattern CardanoNodeToClientVersion10BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage eras enabled Using ShelleyNodeToClientVersion6 for the Shelley-based eras, which enables new queries.

pattern CardanoNodeToClientVersion11BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage eras enabled, using ShelleyNodeToClientVersion7 for the Shelley-based eras, which enables new queries.

pattern CardanoNodeToClientVersion12BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage and Conway eras enabled, using ShelleyNodeToClientVersion8 for the Shelley-based eras.

pattern CardanoNodeToClientVersion13BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage and Conway eras enabled, using ShelleyNodeToClientVersion9 for the Shelley-based eras.

pattern CardanoNodeToClientVersion14BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage and Conway eras enabled, using ShelleyNodeToClientVersion10 for the Shelley-based eras.

pattern CardanoNodeToClientVersion15BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage and Conway eras enabled, using ShelleyNodeToClientVersion11 for the Shelley-based eras.

pattern CardanoNodeToClientVersion2BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled and the Shelley era enabled.

pattern CardanoNodeToClientVersion4BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley and Allegra eras enabled.

We don't bother with ShelleyNodeToClientVersion1 and HardForkSpecificNodeToClientVersion1.

pattern CardanoNodeToClientVersion5BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, and Mary eras enabled.

We don't bother with ShelleyNodeToClientVersion1.

pattern CardanoNodeToClientVersion6BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, and Mary eras enabled, but using ShelleyNodeToClientVersion3 for the Shelley-based eras , which enables new queries.

pattern CardanoNodeToClientVersion7BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary and Alonzo eras enabled

pattern CardanoNodeToClientVersion8BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary and Alonzo eras enabled Using ShelleyNodeToClientVersion5 for the Shelley-based eras , which enables new queries.

pattern CardanoNodeToClientVersion9BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage eras enabled Using ShelleyNodeToClientVersion5 for the Shelley-based eras, which enables new queries.

pattern CardanoNodeToNodeVersion1BlockNodeToNodeVersion (CardanoBlock c) Source #

We support only Byron V1 with the hard fork disabled, as no other versions have been released before the hard fork

pattern CardanoNodeToNodeVersion2BlockNodeToNodeVersion (CardanoBlock c) Source #

The hard fork enabled using the latest version of Byron and Shelley for each Byron and Shelley era.

Orphan instances

SerialiseConstraintsHFC ByronBlock Source # 
Instance details

CardanoHardForkConstraints c ⇒ SerialiseHFC (CardanoEras c) Source #

Important: we need to maintain binary compatibility with Byron blocks, as they are already stored on disk.

We also want to be able to efficiently detect (without having to peek far ahead) whether we're dealing with a Byron or Shelley block, so that we can invoke the right decoder. We plan to have a few more hard forks after Shelley (Goguen, Basho, Voltaire), so we want a future-proof envelope for distinguishing the different block types, i.e., a byte indicating the era.

Byron does not provide such an envelope. However, a Byron block is a CBOR 2-tuple with the first element being a tag (Word: 0 = EBB; 1 = regular block) and the second being the payload. We can easily extend this encoding format with support for Shelley, Goguen, etc.

We encode a CardanoBlock as the same CBOR 2-tuple as a Byron block, but we use the tags after 1 for the hard forks after Byron:

  1. Byron EBB
  2. Byron regular block
  3. Shelley block
  4. Allegra block
  5. Mary block
  6. Goguen block
  7. etc.

For more details, see: https://github.com/IntersectMBO/ouroboros-network/pull/1175#issuecomment-558147194

Instance details

CardanoHardForkConstraints c ⇒ SupportedNetworkProtocolVersion (CardanoBlock c) Source # 
Instance details