Skip to content

Commit

Permalink
Adjust RunNode's CBOR decoders to provide the input bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrBliss committed Aug 14, 2019
1 parent fbd820d commit ff25c99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -12,6 +12,7 @@ module Ouroboros.Consensus.Node.Run.Abstract
import Codec.CBOR.Decoding (Decoder)
import Codec.CBOR.Encoding (Encoding)
import Crypto.Random (MonadRandom)
import qualified Data.ByteString.Lazy as Lazy
import Data.Proxy (Proxy)

import Ouroboros.Network.Block (BlockNo, ChainHash (..), HeaderHash,
Expand Down Expand Up @@ -59,8 +60,8 @@ class (ProtocolLedgerView blk, ApplyTx blk) => RunNode blk where
nodeEncodeApplyTxError :: Proxy blk -> ApplyTxErr blk -> Encoding

-- Decoders
nodeDecodeHeader :: forall s. NodeConfig (BlockProtocol blk) -> Decoder s (Header blk)
nodeDecodeBlock :: forall s. NodeConfig (BlockProtocol blk) -> Decoder s blk
nodeDecodeHeader :: forall s. NodeConfig (BlockProtocol blk) -> Decoder s (Lazy.ByteString -> Header blk)
nodeDecodeBlock :: forall s. NodeConfig (BlockProtocol blk) -> Decoder s (Lazy.ByteString -> blk)
nodeDecodeGenTx :: forall s. Decoder s (GenTx blk)
nodeDecodeGenTxId :: forall s. Decoder s (GenTxId blk)
nodeDecodeHeaderHash :: forall s. Proxy blk -> Decoder s (HeaderHash blk)
Expand Down
4 changes: 2 additions & 2 deletions ouroboros-consensus/src/Ouroboros/Consensus/Node/Run/Mock.hs
Expand Up @@ -54,8 +54,8 @@ instance ( ProtocolLedgerView (SimpleBlock SimpleMockCrypto ext)
nodeEncodeChainState = const encode
nodeEncodeApplyTxError = const encode

nodeDecodeBlock = const decode
nodeDecodeHeader = const decode
nodeDecodeBlock = const (const <$> decode)
nodeDecodeHeader = const (const <$> decode)
nodeDecodeGenTx = decode
nodeDecodeGenTxId = decode
nodeDecodeHeaderHash = const decode
Expand Down

0 comments on commit ff25c99

Please sign in to comment.