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

Ouroboros.Consensus.Cardano.Node

Synopsis

Documentation

type CardanoHardForkConstraints c = (PraosCrypto c, PraosCrypto c, TranslateProto (TPraos c) (Praos c), ShelleyCompatible (TPraos c) (ShelleyEra c), LedgerSupportsProtocol (ShelleyBlock (TPraos c) (ShelleyEra c)), ShelleyCompatible (TPraos c) (AllegraEra c), LedgerSupportsProtocol (ShelleyBlock (TPraos c) (AllegraEra c)), ShelleyCompatible (TPraos c) (MaryEra c), LedgerSupportsProtocol (ShelleyBlock (TPraos c) (MaryEra c)), ShelleyCompatible (TPraos c) (AlonzoEra c), LedgerSupportsProtocol (ShelleyBlock (TPraos c) (AlonzoEra c)), ShelleyCompatible (Praos c) (BabbageEra c), LedgerSupportsProtocol (ShelleyBlock (Praos c) (BabbageEra c)), ShelleyCompatible (Praos c) (ConwayEra c), LedgerSupportsProtocol (ShelleyBlock (Praos c) (ConwayEra c)), HASH c ~ Blake2b_256, ADDRHASH c ~ Blake2b_224, DSIGN c ~ Ed25519DSIGN) Source #

newtype MaxMajorProtVer #

Constructors

MaxMajorProtVer 

Fields

Instances

Instances details
Generic MaxMajorProtVer 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

Associated Types

type Rep MaxMajorProtVer :: Type -> Type Source #

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

Methods

noThunks :: Context -> MaxMajorProtVer -> IO (Maybe ThunkInfo)

wNoThunks :: Context -> MaxMajorProtVer -> IO (Maybe ThunkInfo)

showTypeOf :: Proxy MaxMajorProtVer -> String

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.6.0.0-9L9Rwb3KvaS6sYVJ3OHbE2" 'True) (C1 ('MetaCons "MaxMajorProtVer" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMaxMajorProtVer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version)))

data family ProtocolParams blk #

Instances

Instances details
data ProtocolParams ByronBlock Source #

Parameters needed to run Byron

Instance details

Defined in Ouroboros.Consensus.Byron.Node

data ProtocolParams (CardanoBlock c) Source #

Parameters needed to run Cardano.

Instance details

Defined in Ouroboros.Consensus.Cardano.Node

data ProtocolParams (ShelleyBlock (Praos c) (BabbageEra c)) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Node.Praos

data ProtocolParams (ShelleyBlock (Praos c) (ConwayEra c)) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Node.Praos

data ProtocolParams (ShelleyBlock (TPraos c) (AllegraEra c)) Source #

Parameters needed to run Allegra

Instance details

Defined in Ouroboros.Consensus.Shelley.Node.TPraos

data ProtocolParams (ShelleyBlock (TPraos c) (AlonzoEra c)) Source #

Parameters needed to run Alonzo

Instance details

Defined in Ouroboros.Consensus.Shelley.Node.TPraos

data ProtocolParams (ShelleyBlock (TPraos c) (MaryEra c)) Source #

Parameters needed to run Mary

Instance details

Defined in Ouroboros.Consensus.Shelley.Node.TPraos

data ProtocolParams (ShelleyBlock (TPraos c) (ShelleyEra c)) Source #

Parameters needed to run Shelley

Instance details

Defined in Ouroboros.Consensus.Shelley.Node.TPraos

data TriggerHardFork #

Instances

Instances details
Generic TriggerHardFork 
Instance details

Defined in Ouroboros.Consensus.HardFork.Simple

Associated Types

type Rep TriggerHardFork :: Type -> Type Source #

Show TriggerHardFork 
Instance details

Defined in Ouroboros.Consensus.HardFork.Simple

NoThunks TriggerHardFork 
Instance details

Defined in Ouroboros.Consensus.HardFork.Simple

Methods

noThunks :: Context -> TriggerHardFork -> IO (Maybe ThunkInfo)

wNoThunks :: Context -> TriggerHardFork -> IO (Maybe ThunkInfo)

showTypeOf :: Proxy TriggerHardFork -> String

type Rep TriggerHardFork 
Instance details

Defined in Ouroboros.Consensus.HardFork.Simple

type Rep TriggerHardFork = D1 ('MetaData "TriggerHardFork" "Ouroboros.Consensus.HardFork.Simple" "ouroboros-consensus-0.14.0.0-121Znn1OCbJFCod8haNyF" 'False) (C1 ('MetaCons "TriggerHardForkAtVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word16)) :+: (C1 ('MetaCons "TriggerHardForkAtEpoch" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 EpochNo)) :+: C1 ('MetaCons "TriggerHardForkNotDuringThisExecution" 'PrefixI 'False) (U1 :: Type -> Type)))

protocolClientInfoCardano :: forall c. EpochSlots -> ProtocolClientInfo (CardanoBlock c) Source #

protocolInfoCardano :: forall 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 ShelleyGenesis can contain initial staking and funds. These are registered in the initial ledger state 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, the initial staking and funds must be empty.

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

SupportedNetworkProtocolVersion

pattern CardanoNodeToClientVersion1 :: BlockNodeToClientVersion (CardanoBlock c) Source #

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

pattern CardanoNodeToClientVersion10 :: BlockNodeToClientVersion (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 CardanoNodeToClientVersion11 :: BlockNodeToClientVersion (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 CardanoNodeToClientVersion12 :: BlockNodeToClientVersion (CardanoBlock c) Source #

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

pattern CardanoNodeToClientVersion2 :: BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled and the Shelley era enabled.

pattern CardanoNodeToClientVersion3 :: BlockNodeToClientVersion (CardanoBlock c) Source #

The hard fork enabled and the Shelley era enabled, but using ShelleyNodeToClientVersion2 and HardForkSpecificNodeToClientVersion2.

pattern CardanoNodeToClientVersion4 :: BlockNodeToClientVersion (CardanoBlock c) Source #

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

We don't bother with ShelleyNodeToClientVersion1 and HardForkSpecificNodeToClientVersion1.

pattern CardanoNodeToClientVersion5 :: BlockNodeToClientVersion (CardanoBlock c) Source #

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

We don't bother with ShelleyNodeToClientVersion1.

pattern CardanoNodeToClientVersion6 :: BlockNodeToClientVersion (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 CardanoNodeToClientVersion7 :: BlockNodeToClientVersion (CardanoBlock c) Source #

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

pattern CardanoNodeToClientVersion8 :: BlockNodeToClientVersion (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 CardanoNodeToClientVersion9 :: BlockNodeToClientVersion (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 CardanoNodeToNodeVersion1 :: BlockNodeToNodeVersion (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 CardanoNodeToNodeVersion2 :: BlockNodeToNodeVersion (CardanoBlock c) Source #

The hard fork enabled with the latest Byron version and the Shelley era enabled.

pattern CardanoNodeToNodeVersion3 :: BlockNodeToNodeVersion (CardanoBlock c) Source #

The hard fork enabled with the latest Byron version, the Shelley and Allegra eras enabled.

pattern CardanoNodeToNodeVersion4 :: BlockNodeToNodeVersion (CardanoBlock c) Source #

The hard fork enabled with the latest Byron version, the Shelley, Allegra, and Mary eras enabled.

pattern CardanoNodeToNodeVersion5 :: BlockNodeToNodeVersion (CardanoBlock c) Source #

The hard fork enabled with the latest Byron version, the Shelley, Allegra, Mary and Alonzo eras enabled.

pattern CardanoNodeToNodeVersion6 :: BlockNodeToNodeVersion (CardanoBlock c) Source #

The hard fork enabled with the latest Byron version, the Shelley, Allegra, Mary, Alonzo and Babbage eras enabled.

pattern CardanoNodeToNodeVersion7 :: BlockNodeToNodeVersion (CardanoBlock c) Source #

The hard fork enabled with the latest Byron version, the Shelley, Allegra, Mary, Alonzo, Babbage and Conway eras enabled.

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/input-output-hk/ouroboros-network/pull/1175#issuecomment-558147194

Instance details

Methods

encodeDiskHfcBlock :: CodecConfig (HardForkBlock (CardanoEras c)) -> HardForkBlock (CardanoEras c) -> Encoding

decodeDiskHfcBlock :: CodecConfig (HardForkBlock (CardanoEras c)) -> forall s. Decoder s (ByteString -> HardForkBlock (CardanoEras c))

reconstructHfcPrefixLen :: proxy (Header (HardForkBlock (CardanoEras c))) -> PrefixLen

reconstructHfcNestedCtxt :: proxy (Header (HardForkBlock (CardanoEras c))) -> ShortByteString -> SizeInBytes -> SomeSecond (NestedCtxt Header) (HardForkBlock (CardanoEras c))

getHfcBinaryBlockInfo :: HardForkBlock (CardanoEras c) -> BinaryBlockInfo

estimateHfcBlockSize :: Header (HardForkBlock (CardanoEras c)) -> SizeInBytes

CardanoHardForkConstraints c => SupportedNetworkProtocolVersion (CardanoBlock c) Source # 
Instance details

Methods

supportedNodeToNodeVersions :: Proxy (CardanoBlock c) -> Map NodeToNodeVersion (BlockNodeToNodeVersion (CardanoBlock c))

supportedNodeToClientVersions :: Proxy (CardanoBlock c) -> Map NodeToClientVersion (BlockNodeToClientVersion (CardanoBlock c))

latestReleasedNodeVersion :: Proxy (CardanoBlock c) -> (Maybe NodeToNodeVersion, Maybe NodeToClientVersion)