Safe Haskell | None |
---|---|
Language | Haskell2010 |
Serialisation support for the HFC
Synopsis
-
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
- encodeDiskHfcBlock :: CodecConfig ( HardForkBlock xs) -> HardForkBlock xs -> Encoding
- decodeDiskHfcBlock :: CodecConfig ( HardForkBlock xs) -> forall 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
- class ( SingleEraBlock blk, SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk, SerialiseNodeToClientConstraints blk, HasNetworkProtocolVersion blk) => SerialiseConstraintsHFC blk
- data EraNodeToClientVersion blk
- data EraNodeToNodeVersion blk
- data HardForkNodeToClientVersion xs where
- data HardForkNodeToNodeVersion xs where
- data HardForkSpecificNodeToClientVersion
- data HardForkSpecificNodeToNodeVersion = HardForkSpecificNodeToNodeVersion1
- isHardForkNodeToNodeEnabled :: HardForkNodeToNodeVersion xs -> Bool
- isHardForkNodeToClientEnabled :: HardForkNodeToClientVersion xs -> Bool
Documentation
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:
- 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) -> forall 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
.
class ( SingleEraBlock blk, SerialiseDiskConstraints blk, SerialiseNodeToNodeConstraints blk, SerialiseNodeToClientConstraints blk, HasNetworkProtocolVersion blk) => SerialiseConstraintsHFC blk Source #
data EraNodeToClientVersion blk Source #
Instances
Eq ( BlockNodeToClientVersion blk) => Eq ( EraNodeToClientVersion blk) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common (==) :: EraNodeToClientVersion blk -> EraNodeToClientVersion blk -> Bool Source # (/=) :: EraNodeToClientVersion blk -> EraNodeToClientVersion blk -> Bool Source # |
|
Show ( BlockNodeToClientVersion blk) => Show ( EraNodeToClientVersion blk) Source # | |
data EraNodeToNodeVersion blk Source #
Instances
Eq ( BlockNodeToNodeVersion blk) => Eq ( EraNodeToNodeVersion blk) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common (==) :: EraNodeToNodeVersion blk -> EraNodeToNodeVersion blk -> Bool Source # (/=) :: EraNodeToNodeVersion blk -> EraNodeToNodeVersion blk -> Bool Source # |
|
Show ( BlockNodeToNodeVersion blk) => Show ( EraNodeToNodeVersion blk) Source # | |
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 => Eq ( HardForkNodeToClientVersion xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common (==) :: HardForkNodeToClientVersion xs -> HardForkNodeToClientVersion xs -> Bool Source # (/=) :: HardForkNodeToClientVersion xs -> HardForkNodeToClientVersion xs -> Bool Source # |
|
SerialiseHFC xs => Show ( 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 EraNodeToNodeVersion xs -> HardForkNodeToNodeVersion xs |
Enable the HFC
Each era can be enabled or disabled individually by passing
|
Instances
SerialiseHFC xs => Eq ( HardForkNodeToNodeVersion xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.Common (==) :: HardForkNodeToNodeVersion xs -> HardForkNodeToNodeVersion xs -> Bool Source # (/=) :: HardForkNodeToNodeVersion xs -> HardForkNodeToNodeVersion xs -> Bool Source # |
|
SerialiseHFC xs => Show ( 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
|
Instances
data HardForkSpecificNodeToNodeVersion Source #
Versioning of the specific additions made by the HFC to the
NodeToNode
protocols, e.g., the era tag.