ouroboros-consensus-0.1.0.1: Consensus layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010

Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Synopsis

Conditions required by the HFC to support serialisation

class ( CanHardFork xs, All SerialiseConstraintsHFC xs, All ( Compose Show EraNodeToNodeVersion ) xs, All ( Compose Eq EraNodeToNodeVersion ) xs, All ( Compose Show EraNodeToClientVersion ) xs, All ( Compose Eq EraNodeToClientVersion ) xs, All ( EncodeDiskDepIx ( NestedCtxt Header )) xs, All ( DecodeDiskDepIx ( NestedCtxt Header )) xs, All HasBinaryBlockInfo xs) => SerialiseHFC xs where Source #

Conditions required by the HFC to provide serialisation

NOTE: Compatibility between HFC enabled and disabled:

  1. Node-to-node and node-to-client communication is versioned. When the HFC is disabled, we default to the instances for the first era, and so compatibility is preserved by construction.
  2. On-disk storage is not versioned, and here we make no attempt to be compatible between non-HFC and HFC deployments, except for blocks: we define two methods encodeDiskHfcBlock and decodeDiskHfcBlock which are used for on-disk serialisation of blocks. These methods have defaults which can and probably should be used for deployments that use the HFC from the get-go, but for deployments that only later change to use the HFC these functions can be overriden to provide an on-disk storage format for HFC blocks that is compatible with the on-disk storage of blocks from the first era.
  3. The converse is NOT supported. Deployments that use the HFC from the start should not use HardForkNodeToNodeDisabled and/or HardForkNodeToClientDisabled . Doing so would result in opposite compatibility problems: the on-disk block would include the HFC tag, but sending blocks with the HFC disabled suggests that that tag is unexpected. This would then lead to problems with binary streaming, and we do not currently provide any provisions to resolve these.

Minimal complete definition

Nothing

Distinguish first era from the rest

type family FirstEra (xs :: [ Type ]) where ... Source #

Equations

FirstEra (x ': xs) = x

type family LaterEra (xs :: [ Type ]) where ... Source #

Equations

LaterEra (x ': xs) = xs

notFirstEra Source #

Arguments

:: All SingleEraBlock xs
=> NS f xs

NS intended to be from a future era

-> NS SingleEraInfo xs

Used to construct FutureEraException

Versioning

data HardForkNodeToNodeVersion xs where Source #

Constructors

HardForkNodeToNodeDisabled :: BlockNodeToNodeVersion x -> HardForkNodeToNodeVersion (x ': xs)

Disable the HFC

This means that only the first era ( x ) is supported, and moreover, is compatible with serialisation used if the HFC would not be present at all.

HardForkNodeToNodeEnabled :: HardForkSpecificNodeToNodeVersion -> NP EraNodeToNodeVersion xs -> HardForkNodeToNodeVersion xs

Enable the HFC

Each era can be enabled or disabled individually by passing EraNodeToNodeDisabled as its configuration, but serialised values will always include tags inserted by the HFC to distinguish one era from another. We also version the hard-fork specific parts with HardForkSpecificNodeToNodeVersion .

data HardForkSpecificNodeToClientVersion Source #

Versioning of the specific additions made by the HFC to the NodeToClient protocols, e.g., the era tag or the hard-fork specific queries.

Instances

Instances details
Bounded HardForkSpecificNodeToClientVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Enum HardForkSpecificNodeToClientVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Eq HardForkSpecificNodeToClientVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Ord HardForkSpecificNodeToClientVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Show HardForkSpecificNodeToClientVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

data HardForkSpecificNodeToNodeVersion Source #

Versioning of the specific additions made by the HFC to the NodeToNode protocols, e.g., the era tag.

Instances

Instances details
Bounded HardForkSpecificNodeToNodeVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Enum HardForkSpecificNodeToNodeVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Eq HardForkSpecificNodeToNodeVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Ord HardForkSpecificNodeToNodeVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Show HardForkSpecificNodeToNodeVersion Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common

Dealing with annotations

data AnnDecoder f blk Source #

Constructors

AnnDecoder

Fields

Serialisation of telescopes

Serialisation of sums

Dependent serialisation

MismatchEraInfo

Distributive properties

Deriving-via support for tests

newtype SerialiseNS f xs Source #

Used for deriving via

Example

deriving via SerialiseNS Header SomeEras
         instance Serialise (Header SomeSecond)

Constructors

SerialiseNS

Fields

Orphan instances