ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Node.Serialisation

Description

Serialisation for sending things across the network.

We separate NodeToNode from NodeToClient to be very explicit about what gets sent where.

Unlike in Ouroboros.Consensus.Storage.Serialisation, we don't separate the encoder from the decoder, because the reasons don't apply: we always need both directions and we don't have access to the bytestrings that could be used for the annotations (we use CBOR-in-CBOR in those cases).

Synopsis

Documentation

class SerialiseNodeToClient blk a where Source #

Serialise a type a so that it can be sent across the network via node-to-client protocol.

Minimal complete definition

Nothing

Methods

encodeNodeToClientCodecConfig blk → BlockNodeToClientVersion blk → a → Encoding Source #

default encodeNodeToClientSerialise a ⇒ CodecConfig blk → BlockNodeToClientVersion blk → a → Encoding Source #

decodeNodeToClientCodecConfig blk → BlockNodeToClientVersion blk → ∀ s. Decoder s a Source #

default decodeNodeToClientSerialise a ⇒ CodecConfig blk → BlockNodeToClientVersion blk → ∀ s. Decoder s a Source #

Instances

Instances details
SerialiseNodeToClient blk (ApplyTxErr blk) ⇒ SerialiseNodeToClient blk (WrapApplyTxErr blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Serialisation

SerialiseNodeToClient blk (GenTxId blk) ⇒ SerialiseNodeToClient blk (WrapGenTxId blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Serialisation

Methods

encodeNodeToClientCodecConfig blk → BlockNodeToClientVersion blk → WrapGenTxId blk → Encoding Source #

decodeNodeToClientCodecConfig blk → BlockNodeToClientVersion blk → ∀ s. Decoder s (WrapGenTxId blk) Source #

SerialiseNodeToClient blk blk ⇒ SerialiseNodeToClient blk (I blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Serialisation

Methods

encodeNodeToClientCodecConfig blk → BlockNodeToClientVersion blk → I blk → Encoding Source #

decodeNodeToClientCodecConfig blk → BlockNodeToClientVersion blk → ∀ s. Decoder s (I blk) Source #

SerialiseHFC xs ⇒ SerialiseNodeToClient (HardForkBlock xs) SlotNo Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToClient (HardForkBlock xs) (HardForkApplyTxErr xs) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToClient (HardForkBlock xs) (GenTxId (HardForkBlock xs)) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToClient (HardForkBlock xs) (GenTx (HardForkBlock xs)) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToClient (HardForkBlock xs) (Serialised (HardForkBlock xs)) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToClient (HardForkBlock xs) (HardForkBlock xs) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToClient (HardForkBlock xs) (SomeSecond BlockQuery (HardForkBlock xs)) Source # 
Instance details

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

class SerialiseNodeToNode blk a where Source #

Serialise a type a so that it can be sent across network via a node-to-node protocol.

Minimal complete definition

Nothing

Methods

encodeNodeToNodeCodecConfig blk → BlockNodeToNodeVersion blk → a → Encoding Source #

default encodeNodeToNodeSerialise a ⇒ CodecConfig blk → BlockNodeToNodeVersion blk → a → Encoding Source #

decodeNodeToNodeCodecConfig blk → BlockNodeToNodeVersion blk → ∀ s. Decoder s a Source #

default decodeNodeToNodeSerialise a ⇒ CodecConfig blk → BlockNodeToNodeVersion blk → ∀ s. Decoder s a Source #

Instances

Instances details
SerialiseNodeToNode blk (GenTxId blk) ⇒ SerialiseNodeToNode blk (WrapGenTxId blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Serialisation

Methods

encodeNodeToNodeCodecConfig blk → BlockNodeToNodeVersion blk → WrapGenTxId blk → Encoding Source #

decodeNodeToNodeCodecConfig blk → BlockNodeToNodeVersion blk → ∀ s. Decoder s (WrapGenTxId blk) Source #

SerialiseNodeToNode blk blk ⇒ SerialiseNodeToNode blk (I blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Serialisation

Methods

encodeNodeToNodeCodecConfig blk → BlockNodeToNodeVersion blk → I blk → Encoding Source #

decodeNodeToNodeCodecConfig blk → BlockNodeToNodeVersion blk → ∀ s. Decoder s (I blk) Source #

SerialiseHFC xs ⇒ SerialiseNodeToNode (HardForkBlock xs) (GenTxId (HardForkBlock xs)) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToNode (HardForkBlock xs) (GenTx (HardForkBlock xs)) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToNode (HardForkBlock xs) (SerialisedHeader (HardForkBlock xs)) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToNode (HardForkBlock xs) (Serialised (HardForkBlock xs)) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToNode (HardForkBlock xs) (Header (HardForkBlock xs)) Source # 
Instance details

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

SerialiseHFC xs ⇒ SerialiseNodeToNode (HardForkBlock xs) (HardForkBlock xs) Source # 
Instance details

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

class SerialiseResult blk query where Source #

How to serialise the result of the result of a query.

The LocalStateQuery protocol is a node-to-client protocol, hence the NodeToClientVersion argument.

Methods

encodeResult ∷ ∀ result. CodecConfig blk → BlockNodeToClientVersion blk → query result → result → Encoding Source #

decodeResult ∷ ∀ result. CodecConfig blk → BlockNodeToClientVersion blk → query result → ∀ s. Decoder s result Source #

Instances

Instances details
(SerialiseResult blk (BlockQuery blk), Serialise (HeaderHash blk)) ⇒ SerialiseResult blk (Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

encodeResultCodecConfig blk → BlockNodeToClientVersion blk → Query blk result → result → Encoding Source #

decodeResultCodecConfig blk → BlockNodeToClientVersion blk → Query blk result → ∀ s. Decoder s result Source #

SerialiseHFC xs ⇒ SerialiseResult (HardForkBlock xs) (BlockQuery (HardForkBlock xs)) Source # 
Instance details

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

Methods

encodeResultCodecConfig (HardForkBlock xs) → BlockNodeToClientVersion (HardForkBlock xs) → BlockQuery (HardForkBlock xs) result → result → Encoding Source #

decodeResultCodecConfig (HardForkBlock xs) → BlockNodeToClientVersion (HardForkBlock xs) → BlockQuery (HardForkBlock xs) result → ∀ s. Decoder s result Source #

Defaults

defaultEncodeCBORinCBORSerialise a ⇒ a → Encoding Source #

Uses the Serialise instance, but wraps it in CBOR-in-CBOR.

Use this for the SerialiseNodeToNode and/or SerialiseNodeToClient instance of blk and/or Header blk, which require CBOR-in-CBOR to be compatible with the corresponding Serialised instance.

Re-exported for convenience

data Some (f ∷ k → Type) where Source #

Constructors

Some ∷ ∀ k (f ∷ k → Type) (a ∷ k). f a → Some f 

Instances

Instances details
Serialise (Some QueryAnytime) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

Methods

encodeSome QueryAnytime → Encoding #

decode ∷ Decoder s (Some QueryAnytime) #

encodeList ∷ [Some QueryAnytime] → Encoding #

decodeList ∷ Decoder s [Some QueryAnytime] #