Skip to content
Permalink
Browse files

Add a TODO to add the proper network codecs to NodeNetwork

And then later to be used in some other top-level thing to stitch the
overall node together, reducing the opportunities for making mistaked
with providing different types or different codecs to the various
subsystems (e.g. storage vs network).
  • Loading branch information...
dcoutts committed Aug 13, 2019
1 parent 2fce7a2 commit 66787989ef6aa59bb0f6a9d7ff9912290494c61a
Showing with 49 additions and 1 deletion.
  1. +49 −1 ouroboros-consensus/src/Ouroboros/Consensus/NodeNetwork.hs
@@ -199,6 +199,53 @@ data ProtocolCodecs blk failure m
failure m bytesLTX
}

{-
TODO: add something like this here for real, taken from cardano-node.
-- | The real codecs
--
protocolCodecs :: RunNode blk
=> ProtocolCodecs blk CodecFailure m
ByteString ByteString ByteString
ByteString ByteString
protocolCodecs pInfoConfig =
ProtocolCodecs {
pcChainSyncCodec =
codecChainSync
(nodeEncodeHeader pInfoConfig)
(nodeDecodeHeader pInfoConfig)
encodePoint'
decodePoint'
, pcBlockFetchCodec =
codecBlockFetch
(nodeEncodeBlock pInfoConfig)
(nodeEncodeHeaderHash (Proxy :: Proxy blk))
(nodeDecodeBlock pInfoConfig)
(nodeDecodeHeaderHash (Proxy :: Proxy blk))
, pcTxSubmissionCodec =
codecTxSubmission
nodeEncodeGenTxId
nodeDecodeGenTxId
nodeEncodeGenTx
nodeDecodeGenTx
, pcLocalChainSyncCodec =
codecChainSync
(nodeEncodeBlock pInfoConfig)
(nodeDecodeBlock pInfoConfig)
encodePoint'
decodePoint'
, pcLocalTxSubmissionCodec =
codecLocalTxSubmission
nodeEncodeGenTx
nodeDecodeGenTx
(nodeEncodeApplyTxError (Proxy :: Proxy blk))
(nodeDecodeApplyTxError (Proxy :: Proxy blk))
}
-}

-- | Id codecs used in tests.
--
protocolCodecsId :: Monad m
@@ -208,7 +255,8 @@ protocolCodecsId :: Monad m
(AnyMessage (TxSubmission (GenTxId blk) (GenTx blk)))
(AnyMessage (ChainSync blk (Point blk)))
(AnyMessage (LocalTxSubmission (GenTx blk) (ApplyTxErr blk)))
protocolCodecsId = ProtocolCodecs {
protocolCodecsId =
ProtocolCodecs {
pcChainSyncCodec = codecChainSyncId
, pcBlockFetchCodec = codecBlockFetchId
, pcTxSubmissionCodec = codecTxSubmissionId

0 comments on commit 6678798

Please sign in to comment.
You can’t perform that action at this time.