Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Serialisation support for the HFC
Synopsis
- data EraNodeToClientVersion blk
- data HardForkNodeToClientVersion xs where
- data HardForkNodeToNodeVersion xs where
- data HardForkSpecificNodeToClientVersion
- data HardForkSpecificNodeToNodeVersion = HardForkSpecificNodeToNodeVersion1
- class (SingleEraBlock blk, SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk, SerialiseNodeToClientConstraints blk, HasNetworkProtocolVersion blk) ⇒ SerialiseConstraintsHFC blk
- class (CanHardFork xs, All SerialiseConstraintsHFC xs, All (Compose Show EraNodeToClientVersion) xs, All (Compose Eq EraNodeToClientVersion) xs, All (Compose Show WrapNodeToNodeVersion) xs, All (Compose Eq WrapNodeToNodeVersion) xs, All (EncodeDiskDepIx (NestedCtxt Header)) xs, All (DecodeDiskDepIx (NestedCtxt Header)) xs, All HasBinaryBlockInfo xs) ⇒ SerialiseHFC xs where
- encodeDiskHfcBlock ∷ CodecConfig (HardForkBlock xs) → HardForkBlock xs → Encoding
- decodeDiskHfcBlock ∷ CodecConfig (HardForkBlock xs) → ∀ s. Decoder s (ByteString → HardForkBlock xs)
- reconstructHfcPrefixLen ∷ proxy (Header (HardForkBlock xs)) → PrefixLen
- reconstructHfcNestedCtxt ∷ proxy (Header (HardForkBlock xs)) → ShortByteString → SizeInBytes → SomeSecond (NestedCtxt Header) (HardForkBlock xs)
- getHfcBinaryBlockInfo ∷ HardForkBlock xs → BinaryBlockInfo
- estimateHfcBlockSize ∷ Header (HardForkBlock xs) → SizeInBytes
- isHardForkNodeToClientEnabled ∷ HardForkNodeToClientVersion xs → Bool
- isHardForkNodeToNodeEnabled ∷ HardForkNodeToNodeVersion xs → Bool
Documentation
data EraNodeToClientVersion blk Source #
Instances
Show (BlockNodeToClientVersion blk) ⇒ Show (EraNodeToClientVersion blk) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common showsPrec ∷ Int → EraNodeToClientVersion blk → ShowS # show ∷ EraNodeToClientVersion blk → String # showList ∷ [EraNodeToClientVersion blk] → ShowS # | |
Eq (BlockNodeToClientVersion blk) ⇒ Eq (EraNodeToClientVersion blk) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common (==) ∷ EraNodeToClientVersion blk → EraNodeToClientVersion blk → Bool # (/=) ∷ EraNodeToClientVersion blk → EraNodeToClientVersion blk → Bool # |
data HardForkNodeToClientVersion xs where Source #
HardForkNodeToClientDisabled ∷ BlockNodeToClientVersion x → HardForkNodeToClientVersion (x ': xs) | Disable the HFC |
HardForkNodeToClientEnabled ∷ HardForkSpecificNodeToClientVersion → NP EraNodeToClientVersion xs → HardForkNodeToClientVersion xs | Enable the HFC |
Instances
SerialiseHFC xs ⇒ Show (HardForkNodeToClientVersion xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common showsPrec ∷ Int → HardForkNodeToClientVersion xs → ShowS # show ∷ HardForkNodeToClientVersion xs → String # showList ∷ [HardForkNodeToClientVersion xs] → ShowS # | |
SerialiseHFC xs ⇒ Eq (HardForkNodeToClientVersion xs) Source # | |
data HardForkNodeToNodeVersion xs where Source #
HardForkNodeToNodeDisabled ∷ BlockNodeToNodeVersion x → HardForkNodeToNodeVersion (x ': xs) | Disable the HFC This means that only the first era ( |
HardForkNodeToNodeEnabled ∷ HardForkSpecificNodeToNodeVersion → NP WrapNodeToNodeVersion xs → HardForkNodeToNodeVersion xs | Enable the HFC Serialised values will always include tags inserted by the HFC to
distinguish one era from another. We version the hard-fork specific parts
with |
Instances
SerialiseHFC xs ⇒ Show (HardForkNodeToNodeVersion xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common showsPrec ∷ Int → HardForkNodeToNodeVersion xs → ShowS # show ∷ HardForkNodeToNodeVersion xs → String # showList ∷ [HardForkNodeToNodeVersion xs] → ShowS # | |
SerialiseHFC xs ⇒ Eq (HardForkNodeToNodeVersion xs) Source # | |
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.
HardForkSpecificNodeToClientVersion1 | |
HardForkSpecificNodeToClientVersion2 | Enable the |
HardForkSpecificNodeToClientVersion3 | Include the Genesis window in |
Instances
data HardForkSpecificNodeToNodeVersion Source #
Versioning of the specific additions made by the HFC to the NodeToNode
protocols, e.g., the era tag.
Instances
class (SingleEraBlock blk, SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk, SerialiseNodeToClientConstraints blk, HasNetworkProtocolVersion blk) ⇒ SerialiseConstraintsHFC blk Source #
class (CanHardFork xs, All SerialiseConstraintsHFC xs, All (Compose Show EraNodeToClientVersion) xs, All (Compose Eq EraNodeToClientVersion) xs, All (Compose Show WrapNodeToNodeVersion) xs, All (Compose Eq WrapNodeToNodeVersion) 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:
- 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.
- 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
anddecodeDiskHfcBlock
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. - The converse is NOT supported. Deployments that use the HFC from the start
should not use
HardForkNodeToNodeDisabled
and/orHardForkNodeToClientDisabled
. 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.
Nothing
encodeDiskHfcBlock ∷ CodecConfig (HardForkBlock xs) → HardForkBlock xs → Encoding Source #
decodeDiskHfcBlock ∷ CodecConfig (HardForkBlock xs) → ∀ s. Decoder s (ByteString → HardForkBlock xs) Source #
reconstructHfcPrefixLen ∷ proxy (Header (HardForkBlock xs)) → PrefixLen Source #
Used as the implementation of reconstructPrefixLen
for
HardForkBlock
.
reconstructHfcNestedCtxt Source #
∷ proxy (Header (HardForkBlock xs)) | |
→ ShortByteString | First bytes ( |
→ SizeInBytes | Block size |
→ SomeSecond (NestedCtxt Header) (HardForkBlock xs) |
Used as the implementation of reconstructNestedCtxt
for
HardForkBlock
.
getHfcBinaryBlockInfo ∷ HardForkBlock xs → BinaryBlockInfo Source #
Used as the implementation of getBinaryBlockInfo
for
HardForkBlock
.
estimateHfcBlockSize ∷ Header (HardForkBlock xs) → SizeInBytes Source #
Used as the implementation of estimateBlockSize
for HardForkBlock
.