{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UndecidableInstances #-}

{-# OPTIONS_GHC -Wno-orphans  #-}

module Cardano.Node.Tracing.Tracers.NodeToNode
  (
    severityTChainSyncNode
  , namesForTChainSyncNode

  , severityTChainSyncSerialised
  , namesForTChainSyncSerialised

  , severityTBlockFetch
  , namesForTBlockFetch
  , docTBlockFetch

  , severityTBlockFetchSerialised
  , namesForTBlockFetchSerialised

  , severityTxSubmissionNode
  , namesForTxSubmissionNode
  , docTTxSubmissionNode

  , severityTxSubmission2Node
  , namesForTxSubmission2Node
  , docTTxSubmission2Node
  ) where

import           Cardano.Logging
import           Cardano.Prelude hiding (Show, show)
import           Data.Aeson (Value (String), toJSON, (.=))
import           Data.Text (pack)
import           Network.TypedProtocol.Codec (AnyMessageAndAgency (..))
import           Text.Show

import           Cardano.Node.Queries (ConvertTxId)
import           Cardano.Node.Tracing.Render (renderHeaderHash, renderTxIdForDetails)

import           Ouroboros.Consensus.Block (ConvertRawHash, GetHeader, HasHeader, Header,
                   StandardHash, getHeader)
import           Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, GenTxId, HasTxId, HasTxs,
                   LedgerSupportsMempool, extractTxs, txId)
import           Ouroboros.Consensus.Node.Run (SerialiseNodeToNodeConstraints, estimateBlockSize)
import           Ouroboros.Consensus.Storage.Serialisation (SerialisedHeader)

import           Ouroboros.Network.Block (Point, Serialised, Tip, blockHash)
import qualified Ouroboros.Network.BlockFetch.ClientState as BlockFetch
import           Ouroboros.Network.Driver.Simple (TraceSendRecv (..))
import           Ouroboros.Network.Protocol.BlockFetch.Type (BlockFetch (..), Message (..))
import           Ouroboros.Network.Protocol.ChainSync.Type as ChainSync
import qualified Ouroboros.Network.Protocol.TxSubmission2.Type as STX
import qualified Ouroboros.Network.Protocol.TxSubmission2.Type as TXS

--------------------------------------------------------------------------------
-- ChainSync Tracer
--------------------------------------------------------------------------------

severityTChainSyncNode :: BlockFetch.TraceLabelPeer peer (TraceSendRecv
    (ChainSync (Header blk) (Point blk) (Tip blk))) -> SeverityS
severityTChainSyncNode :: TraceLabelPeer
  peer (TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk)))
-> SeverityS
severityTChainSyncNode (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk))
v) = TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk))
-> SeverityS
forall header point tip.
TraceSendRecv (ChainSync header point tip) -> SeverityS
severityTChainSync' TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk))
v
  where
    severityTChainSync' :: TraceSendRecv (ChainSync header point tip) -> SeverityS
severityTChainSync' (TraceSendMsg AnyMessageAndAgency (ChainSync header point tip)
msg) = AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
forall header point tip.
AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
severityTChainSync'' AnyMessageAndAgency (ChainSync header point tip)
msg
    severityTChainSync' (TraceRecvMsg AnyMessageAndAgency (ChainSync header point tip)
msg) = AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
forall header point tip.
AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
severityTChainSync'' AnyMessageAndAgency (ChainSync header point tip)
msg

    severityTChainSync'' :: AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
severityTChainSync'' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (ChainSync header point tip) st st'
msg) = Message (ChainSync header point tip) st st' -> SeverityS
forall header point tip (from :: ChainSync header point tip)
       (to :: ChainSync header point tip).
Message (ChainSync header point tip) from to -> SeverityS
severityTChainSync''' Message (ChainSync header point tip) st st'
msg

    severityTChainSync''' :: Message
                                     (ChainSync header point tip) from to
                                   -> SeverityS
    severityTChainSync''' :: Message (ChainSync header point tip) from to -> SeverityS
severityTChainSync''' MsgRequestNext {}       = SeverityS
Info
    severityTChainSync''' MsgAwaitReply {}        = SeverityS
Info
    severityTChainSync''' MsgRollForward {}       = SeverityS
Info
    severityTChainSync''' MsgRollBackward {}      = SeverityS
Info
    severityTChainSync''' MsgFindIntersect {}     = SeverityS
Info
    severityTChainSync''' MsgIntersectFound {}    = SeverityS
Info
    severityTChainSync''' MsgIntersectNotFound {} = SeverityS
Info
    severityTChainSync''' MsgDone {}              = SeverityS
Info

namesForTChainSyncNode :: BlockFetch.TraceLabelPeer peer (TraceSendRecv
    (ChainSync (Header blk) (Point blk) (Tip blk))) -> [Text]
namesForTChainSyncNode :: TraceLabelPeer
  peer (TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk)))
-> [Text]
namesForTChainSyncNode (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk))
v) = Text
"NodeToNode" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk))
-> [Text]
forall header point tip.
TraceSendRecv (ChainSync header point tip) -> [Text]
namesTChainSync TraceSendRecv (ChainSync (Header blk) (Point blk) (Tip blk))
v
  where

    namesTChainSync :: TraceSendRecv (ChainSync header point tip) -> [Text]
namesTChainSync (TraceSendMsg AnyMessageAndAgency (ChainSync header point tip)
msg) = Text
"Send" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (ChainSync header point tip) -> [Text]
forall header point tip.
AnyMessageAndAgency (ChainSync header point tip) -> [Text]
namesTChainSync' AnyMessageAndAgency (ChainSync header point tip)
msg
    namesTChainSync (TraceRecvMsg AnyMessageAndAgency (ChainSync header point tip)
msg) = Text
"Receive" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (ChainSync header point tip) -> [Text]
forall header point tip.
AnyMessageAndAgency (ChainSync header point tip) -> [Text]
namesTChainSync' AnyMessageAndAgency (ChainSync header point tip)
msg

    namesTChainSync' :: AnyMessageAndAgency (ChainSync header point tip) -> [Text]
namesTChainSync' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (ChainSync header point tip) st st'
msg) = Message (ChainSync header point tip) st st' -> [Text]
forall header point tip (from :: ChainSync header point tip)
       (to :: ChainSync header point tip).
Message (ChainSync header point tip) from to -> [Text]
namesTChainSync'' Message (ChainSync header point tip) st st'
msg

    namesTChainSync'' :: Message (ChainSync header point tip) from to
                               -> [Text]
    namesTChainSync'' :: Message (ChainSync header point tip) from to -> [Text]
namesTChainSync'' MsgRequestNext {}       = [Text
"RequestNext"]
    namesTChainSync'' MsgAwaitReply {}        = [Text
"AwaitReply"]
    namesTChainSync'' MsgRollForward {}       = [Text
"RollForward"]
    namesTChainSync'' MsgRollBackward {}      = [Text
"RollBackward"]
    namesTChainSync'' MsgFindIntersect {}     = [Text
"FindIntersect"]
    namesTChainSync'' MsgIntersectFound {}    = [Text
"IntersectFound"]
    namesTChainSync'' MsgIntersectNotFound {} = [Text
"IntersectNotFound"]
    namesTChainSync'' MsgDone {}              = [Text
"Done"]

--------------------------------------------------------------------------------
-- ChainSyncSerialised Tracer
--------------------------------------------------------------------------------

severityTChainSyncSerialised :: BlockFetch.TraceLabelPeer peer (TraceSendRecv
    (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))) -> SeverityS
severityTChainSyncSerialised :: TraceLabelPeer
  peer
  (TraceSendRecv
     (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk)))
-> SeverityS
severityTChainSyncSerialised (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv
  (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))
v) = TraceSendRecv
  (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))
-> SeverityS
forall header point tip.
TraceSendRecv (ChainSync header point tip) -> SeverityS
severityTChainSync' TraceSendRecv
  (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))
v
  where
    severityTChainSync' :: TraceSendRecv (ChainSync header point tip) -> SeverityS
severityTChainSync' (TraceSendMsg AnyMessageAndAgency (ChainSync header point tip)
msg) = AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
forall header point tip.
AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
severityTChainSync'' AnyMessageAndAgency (ChainSync header point tip)
msg
    severityTChainSync' (TraceRecvMsg AnyMessageAndAgency (ChainSync header point tip)
msg) = AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
forall header point tip.
AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
severityTChainSync'' AnyMessageAndAgency (ChainSync header point tip)
msg

    severityTChainSync'' :: AnyMessageAndAgency (ChainSync header point tip) -> SeverityS
severityTChainSync'' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (ChainSync header point tip) st st'
msg) = Message (ChainSync header point tip) st st' -> SeverityS
forall header point tip (from :: ChainSync header point tip)
       (to :: ChainSync header point tip).
Message (ChainSync header point tip) from to -> SeverityS
severityTChainSync''' Message (ChainSync header point tip) st st'
msg

    severityTChainSync''' :: Message
                                     (ChainSync header point tip) from to
                                   -> SeverityS
    severityTChainSync''' :: Message (ChainSync header point tip) from to -> SeverityS
severityTChainSync''' MsgRequestNext {}       = SeverityS
Info
    severityTChainSync''' MsgAwaitReply {}        = SeverityS
Info
    severityTChainSync''' MsgRollForward {}       = SeverityS
Info
    severityTChainSync''' MsgRollBackward {}      = SeverityS
Info
    severityTChainSync''' MsgFindIntersect {}     = SeverityS
Info
    severityTChainSync''' MsgIntersectFound {}    = SeverityS
Info
    severityTChainSync''' MsgIntersectNotFound {} = SeverityS
Info
    severityTChainSync''' MsgDone {}              = SeverityS
Info

namesForTChainSyncSerialised :: BlockFetch.TraceLabelPeer peer (TraceSendRecv
    (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))) -> [Text]
namesForTChainSyncSerialised :: TraceLabelPeer
  peer
  (TraceSendRecv
     (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk)))
-> [Text]
namesForTChainSyncSerialised (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv
  (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))
v) =
  Text
"NodeToNode" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: TraceSendRecv
  (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))
-> [Text]
forall header point tip.
TraceSendRecv (ChainSync header point tip) -> [Text]
namesTChainSync TraceSendRecv
  (ChainSync (SerialisedHeader blk) (Point blk) (Tip blk))
v
  where
    namesTChainSync :: TraceSendRecv (ChainSync header point tip) -> [Text]
namesTChainSync (TraceSendMsg AnyMessageAndAgency (ChainSync header point tip)
msg) = Text
"Send" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (ChainSync header point tip) -> [Text]
forall header point tip.
AnyMessageAndAgency (ChainSync header point tip) -> [Text]
namesTChainSync' AnyMessageAndAgency (ChainSync header point tip)
msg
    namesTChainSync (TraceRecvMsg AnyMessageAndAgency (ChainSync header point tip)
msg) = Text
"Receive" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (ChainSync header point tip) -> [Text]
forall header point tip.
AnyMessageAndAgency (ChainSync header point tip) -> [Text]
namesTChainSync' AnyMessageAndAgency (ChainSync header point tip)
msg

    namesTChainSync' :: AnyMessageAndAgency (ChainSync header point tip) -> [Text]
namesTChainSync' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (ChainSync header point tip) st st'
msg) = Message (ChainSync header point tip) st st' -> [Text]
forall header point tip (from :: ChainSync header point tip)
       (to :: ChainSync header point tip).
Message (ChainSync header point tip) from to -> [Text]
namesTChainSync'' Message (ChainSync header point tip) st st'
msg

    namesTChainSync'' :: Message (ChainSync header point tip) from to
                               -> [Text]
    namesTChainSync'' :: Message (ChainSync header point tip) from to -> [Text]
namesTChainSync'' MsgRequestNext {}       = [Text
"RequestNext"]
    namesTChainSync'' MsgAwaitReply {}        = [Text
"AwaitReply"]
    namesTChainSync'' MsgRollForward {}       = [Text
"RollForward"]
    namesTChainSync'' MsgRollBackward {}      = [Text
"RollBackward"]
    namesTChainSync'' MsgFindIntersect {}     = [Text
"FindIntersect"]
    namesTChainSync'' MsgIntersectFound {}    = [Text
"IntersectFound"]
    namesTChainSync'' MsgIntersectNotFound {} = [Text
"IntersectNotFound"]
    namesTChainSync'' MsgDone {}              = [Text
"Done"]

--------------------------------------------------------------------------------
-- BlockFetch Tracer
--------------------------------------------------------------------------------

severityTBlockFetch :: BlockFetch.TraceLabelPeer peer
  (TraceSendRecv (BlockFetch blk (Point blk))) -> SeverityS
severityTBlockFetch :: TraceLabelPeer peer (TraceSendRecv (BlockFetch blk (Point blk)))
-> SeverityS
severityTBlockFetch (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (BlockFetch blk (Point blk))
v) = TraceSendRecv (BlockFetch blk (Point blk)) -> SeverityS
forall x blk. TraceSendRecv (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch' TraceSendRecv (BlockFetch blk (Point blk))
v
  where
    severityTBlockFetch' :: TraceSendRecv (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch' (TraceSendMsg AnyMessageAndAgency (BlockFetch x (Point blk))
msg) = AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
forall x blk.
AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch'' AnyMessageAndAgency (BlockFetch x (Point blk))
msg
    severityTBlockFetch' (TraceRecvMsg AnyMessageAndAgency (BlockFetch x (Point blk))
msg) = AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
forall x blk.
AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch'' AnyMessageAndAgency (BlockFetch x (Point blk))
msg

    severityTBlockFetch'' :: AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch'' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (BlockFetch x (Point blk)) st st'
msg) = Message (BlockFetch x (Point blk)) st st' -> SeverityS
forall x blk (from :: BlockFetch x (Point blk))
       (to :: BlockFetch x (Point blk)).
Message (BlockFetch x (Point blk)) from to -> SeverityS
severityTBlockFetch''' Message (BlockFetch x (Point blk)) st st'
msg

    severityTBlockFetch''' :: Message (BlockFetch x (Point blk)) from to
                                   -> SeverityS
    severityTBlockFetch''' :: Message (BlockFetch x (Point blk)) from to -> SeverityS
severityTBlockFetch''' MsgRequestRange {} = SeverityS
Info
    severityTBlockFetch''' MsgStartBatch {}   = SeverityS
Info
    severityTBlockFetch''' MsgNoBlocks {}     = SeverityS
Info
    severityTBlockFetch''' MsgBlock {}        = SeverityS
Info
    severityTBlockFetch''' MsgBatchDone {}    = SeverityS
Info
    severityTBlockFetch''' MsgClientDone {}   = SeverityS
Info

namesForTBlockFetch :: BlockFetch.TraceLabelPeer peer
  (TraceSendRecv (BlockFetch blk (Point blk))) -> [Text]
namesForTBlockFetch :: TraceLabelPeer peer (TraceSendRecv (BlockFetch blk (Point blk)))
-> [Text]
namesForTBlockFetch (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (BlockFetch blk (Point blk))
v) =
  Text
"NodeToNode" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: TraceSendRecv (BlockFetch blk (Point blk)) -> [Text]
forall x blk. TraceSendRecv (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch TraceSendRecv (BlockFetch blk (Point blk))
v
  where
    namesTBlockFetch :: TraceSendRecv (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch (TraceSendMsg AnyMessageAndAgency (BlockFetch x (Point blk))
msg) = Text
"Send" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
forall x blk.
AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch' AnyMessageAndAgency (BlockFetch x (Point blk))
msg
    namesTBlockFetch (TraceRecvMsg AnyMessageAndAgency (BlockFetch x (Point blk))
msg) = Text
"Receive" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
forall x blk.
AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch' AnyMessageAndAgency (BlockFetch x (Point blk))
msg

    namesTBlockFetch' :: AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (BlockFetch x (Point blk)) st st'
msg) = Message (BlockFetch x (Point blk)) st st' -> [Text]
forall x blk (from :: BlockFetch x (Point blk))
       (to :: BlockFetch x (Point blk)).
Message (BlockFetch x (Point blk)) from to -> [Text]
namesTBlockFetch'' Message (BlockFetch x (Point blk)) st st'
msg

    namesTBlockFetch'' :: Message (BlockFetch x (Point blk)) from to
                               -> [Text]
    namesTBlockFetch'' :: Message (BlockFetch x (Point blk)) from to -> [Text]
namesTBlockFetch'' MsgRequestRange {} = [Text
"RequestRange"]
    namesTBlockFetch'' MsgStartBatch {}   = [Text
"StartBatch"]
    namesTBlockFetch'' MsgNoBlocks {}     = [Text
"NoBlocks"]
    namesTBlockFetch'' MsgBlock {}        = [Text
"Block"]
    namesTBlockFetch'' MsgBatchDone {}    = [Text
"BatchDone"]
    namesTBlockFetch'' MsgClientDone {}   = [Text
"ClientDone"]

instance ( ConvertTxId blk
         , ConvertRawHash blk
         , HasHeader blk
         , GetHeader blk
         , HasTxId (GenTx blk)
         , SerialiseNodeToNodeConstraints blk
         , HasTxs blk
         , LedgerSupportsMempool blk
         )
      => LogFormatting (AnyMessageAndAgency (BlockFetch blk (Point blk))) where
  forMachine :: DetailLevel
-> AnyMessageAndAgency (BlockFetch blk (Point blk)) -> Object
forMachine DetailLevel
DMinimal (AnyMessageAndAgency PeerHasAgency pr st
stok (MsgBlock blk)) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgBlock"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             , Key
"blockHash" Key -> Text -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Proxy blk -> HeaderHash blk -> Text
forall blk (proxy :: * -> *).
ConvertRawHash blk =>
proxy blk -> HeaderHash blk -> Text
renderHeaderHash (Proxy blk
forall k (t :: k). Proxy t
Proxy @blk) (block1 -> HeaderHash block1
forall b. HasHeader b => b -> HeaderHash b
blockHash block1
blk)
             , Key
"blockSize" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= SizeInBytes -> Value
forall a. ToJSON a => a -> Value
toJSON (Header block1 -> SizeInBytes
forall blk.
SerialiseNodeToNodeConstraints blk =>
Header blk -> SizeInBytes
estimateBlockSize (block1 -> Header block1
forall blk. GetHeader blk => blk -> Header blk
getHeader block1
blk))
             ]

  forMachine DetailLevel
dtal (AnyMessageAndAgency PeerHasAgency pr st
stok (MsgBlock blk)) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgBlock"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             , Key
"blockHash" Key -> Text -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Proxy blk -> HeaderHash blk -> Text
forall blk (proxy :: * -> *).
ConvertRawHash blk =>
proxy blk -> HeaderHash blk -> Text
renderHeaderHash (Proxy blk
forall k (t :: k). Proxy t
Proxy @blk) (block1 -> HeaderHash block1
forall b. HasHeader b => b -> HeaderHash b
blockHash block1
blk)
             , Key
"blockSize" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= SizeInBytes -> Value
forall a. ToJSON a => a -> Value
toJSON (Header block1 -> SizeInBytes
forall blk.
SerialiseNodeToNodeConstraints blk =>
Header blk -> SizeInBytes
estimateBlockSize (block1 -> Header block1
forall blk. GetHeader blk => blk -> Header blk
getHeader block1
blk))
             , Key
"txIds" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= [Value] -> Value
forall a. ToJSON a => a -> Value
toJSON (GenTx blk -> Value
presentTx (GenTx blk -> Value) -> [GenTx blk] -> [Value]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> block1 -> [GenTx block1]
forall blk. HasTxs blk => blk -> [GenTx blk]
extractTxs block1
blk)
             ]
      where
        presentTx :: GenTx blk -> Value
        presentTx :: GenTx blk -> Value
presentTx =  Text -> Value
String (Text -> Value) -> (GenTx blk -> Text) -> GenTx blk -> Value
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. DetailLevel -> TxId (GenTx blk) -> Text
forall blk.
ConvertTxId blk =>
DetailLevel -> TxId (GenTx blk) -> Text
renderTxIdForDetails DetailLevel
dtal (TxId (GenTx blk) -> Text)
-> (GenTx blk -> TxId (GenTx blk)) -> GenTx blk -> Text
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. GenTx blk -> TxId (GenTx blk)
forall tx. HasTxId tx => tx -> TxId tx
txId

  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgRequestRange{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgRequestRange"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]
  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgStartBatch{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgStartBatch"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]
  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgNoBlocks{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgNoBlocks"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]
  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgBatchDone{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgBatchDone"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]
  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgClientDone{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgClientDone"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]

docTBlockFetch :: Documented
     (BlockFetch.TraceLabelPeer peer
      (TraceSendRecv
        (BlockFetch x (Point blk))))
docTBlockFetch :: Documented
  (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
docTBlockFetch =
  [Text]
-> Documented
     (TraceLabelPeer Any (TraceSendRecv (BlockFetch Any (Point Any))))
-> Documented
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a b. [Text] -> Documented a -> Documented b
addDocumentedNamespace  [Text
"NodeToNode", Text
"Send"] Documented
  (TraceLabelPeer Any (TraceSendRecv (BlockFetch Any (Point Any))))
forall peer x blk.
Documented
  (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
docTBlockFetch'
  Documented
  (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
-> Documented
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
-> Documented
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a. Documented a -> Documented a -> Documented a
`addDocs` [Text]
-> Documented
     (TraceLabelPeer Any (TraceSendRecv (BlockFetch Any (Point Any))))
-> Documented
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a b. [Text] -> Documented a -> Documented b
addDocumentedNamespace  [Text
"NodeToNode", Text
"Recieve"] Documented
  (TraceLabelPeer Any (TraceSendRecv (BlockFetch Any (Point Any))))
forall peer x blk.
Documented
  (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
docTBlockFetch'

docTBlockFetch' :: Documented
      (BlockFetch.TraceLabelPeer peer
       (TraceSendRecv
         (BlockFetch x (Point blk))))
docTBlockFetch' :: Documented
  (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
docTBlockFetch' = [DocMsg
   (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))]
-> Documented
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a. [DocMsg a] -> Documented a
Documented [
      [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"RequestRange"]
        []
        Text
"Request range of blocks."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"StartBatch"]
        []
        Text
"Start block streaming."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"NoBlocks"]
        []
        Text
"Respond that there are no blocks."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"Block"]
        []
        Text
"Stream a single block."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"BatchDone"]
        []
        Text
"End of block streaming."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer peer (TraceSendRecv (BlockFetch x (Point blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"ClientDone"]
        []
        Text
"Client termination message."
  ]

--------------------------------------------------------------------------------
-- BlockFetchSerialised Tracer
--------------------------------------------------------------------------------

severityTBlockFetchSerialised :: BlockFetch.TraceLabelPeer peer
  (TraceSendRecv (BlockFetch (Serialised blk) (Point blk))) -> SeverityS
severityTBlockFetchSerialised :: TraceLabelPeer
  peer (TraceSendRecv (BlockFetch (Serialised blk) (Point blk)))
-> SeverityS
severityTBlockFetchSerialised (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (BlockFetch (Serialised blk) (Point blk))
v) = TraceSendRecv (BlockFetch (Serialised blk) (Point blk))
-> SeverityS
forall x blk. TraceSendRecv (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch' TraceSendRecv (BlockFetch (Serialised blk) (Point blk))
v
  where
    severityTBlockFetch' :: TraceSendRecv (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch' (TraceSendMsg AnyMessageAndAgency (BlockFetch x (Point blk))
msg) = AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
forall x blk.
AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch'' AnyMessageAndAgency (BlockFetch x (Point blk))
msg
    severityTBlockFetch' (TraceRecvMsg AnyMessageAndAgency (BlockFetch x (Point blk))
msg) = AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
forall x blk.
AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch'' AnyMessageAndAgency (BlockFetch x (Point blk))
msg

    severityTBlockFetch'' :: AnyMessageAndAgency (BlockFetch x (Point blk)) -> SeverityS
severityTBlockFetch'' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (BlockFetch x (Point blk)) st st'
msg) = Message (BlockFetch x (Point blk)) st st' -> SeverityS
forall x blk (from :: BlockFetch x (Point blk))
       (to :: BlockFetch x (Point blk)).
Message (BlockFetch x (Point blk)) from to -> SeverityS
severityTBlockFetch''' Message (BlockFetch x (Point blk)) st st'
msg

    severityTBlockFetch''' :: Message (BlockFetch x (Point blk)) from to
                                   -> SeverityS
    severityTBlockFetch''' :: Message (BlockFetch x (Point blk)) from to -> SeverityS
severityTBlockFetch''' MsgRequestRange {} = SeverityS
Info
    severityTBlockFetch''' MsgStartBatch {}   = SeverityS
Info
    severityTBlockFetch''' MsgNoBlocks {}     = SeverityS
Info
    severityTBlockFetch''' MsgBlock {}        = SeverityS
Info
    severityTBlockFetch''' MsgBatchDone {}    = SeverityS
Info
    severityTBlockFetch''' MsgClientDone {}   = SeverityS
Info

namesForTBlockFetchSerialised :: BlockFetch.TraceLabelPeer peer
  (TraceSendRecv (BlockFetch (Serialised blk) (Point blk))) -> [Text]
namesForTBlockFetchSerialised :: TraceLabelPeer
  peer (TraceSendRecv (BlockFetch (Serialised blk) (Point blk)))
-> [Text]
namesForTBlockFetchSerialised (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (BlockFetch (Serialised blk) (Point blk))
v) =
  Text
"NodeToNode" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: TraceSendRecv (BlockFetch (Serialised blk) (Point blk)) -> [Text]
forall x blk. TraceSendRecv (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch TraceSendRecv (BlockFetch (Serialised blk) (Point blk))
v
  where
    namesTBlockFetch :: TraceSendRecv (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch (TraceSendMsg AnyMessageAndAgency (BlockFetch x (Point blk))
msg) = Text
"Send" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
forall x blk.
AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch' AnyMessageAndAgency (BlockFetch x (Point blk))
msg
    namesTBlockFetch (TraceRecvMsg AnyMessageAndAgency (BlockFetch x (Point blk))
msg) = Text
"Receive" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
forall x blk.
AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch' AnyMessageAndAgency (BlockFetch x (Point blk))
msg

    namesTBlockFetch' :: AnyMessageAndAgency (BlockFetch x (Point blk)) -> [Text]
namesTBlockFetch' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (BlockFetch x (Point blk)) st st'
msg) = Message (BlockFetch x (Point blk)) st st' -> [Text]
forall x blk (from :: BlockFetch x (Point blk))
       (to :: BlockFetch x (Point blk)).
Message (BlockFetch x (Point blk)) from to -> [Text]
namesTBlockFetch'' Message (BlockFetch x (Point blk)) st st'
msg

    namesTBlockFetch'' :: Message (BlockFetch x (Point blk)) from to
                               -> [Text]
    namesTBlockFetch'' :: Message (BlockFetch x (Point blk)) from to -> [Text]
namesTBlockFetch'' MsgRequestRange {} = [Text
"RequestRange"]
    namesTBlockFetch'' MsgStartBatch {}   = [Text
"StartBatch"]
    namesTBlockFetch'' MsgNoBlocks {}     = [Text
"NoBlocks"]
    namesTBlockFetch'' MsgBlock {}        = [Text
"Block"]
    namesTBlockFetch'' MsgBatchDone {}    = [Text
"BatchDone"]
    namesTBlockFetch'' MsgClientDone {}   = [Text
"ClientDone"]

-- TODO Tracers
-- Provide complete implementation of forMachine
instance ( ConvertTxId blk
         , HasTxId (GenTx blk)
         , ConvertRawHash blk
         , StandardHash blk
         , HasTxs blk
         )
      => LogFormatting (AnyMessageAndAgency (BlockFetch (Serialised blk) (Point blk))) where
  forMachine :: DetailLevel
-> AnyMessageAndAgency (BlockFetch (Serialised blk) (Point blk))
-> Object
forMachine DetailLevel
DMinimal (AnyMessageAndAgency PeerHasAgency pr st
stok (MsgBlock _blk)) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgBlock"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
            -- , "blockHash" .= renderHeaderHash (Proxy @blk) (blockHash blk)
            -- , "blockSize" .= toJSON (estimateBlockSize (getHeader blk))
             ]

  forMachine DetailLevel
_dtal (AnyMessageAndAgency PeerHasAgency pr st
stok (MsgBlock _blk)) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgBlock"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
          -- , "blockHash" .= renderHeaderHash (Proxy @blk) (blockHash blk)
          --  , "blockSize" .= toJSON (estimateBlockSize (getHeader blk))
          --   , "txIds" .= toJSON (presentTx <$> extractTxs blk)
             ]
      -- where
      --   presentTx :: GenTx blk -> Value
      --   presentTx =  String . renderTxIdForDetails dtal . txId

  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgRequestRange{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgRequestRange"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]
  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgStartBatch{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgStartBatch"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]
  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgNoBlocks{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgNoBlocks"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]
  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgBatchDone{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgBatchDone"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]
  forMachine DetailLevel
_v (AnyMessageAndAgency PeerHasAgency pr st
stok MsgClientDone{}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgClientDone"
             , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
             ]

  forHuman :: AnyMessageAndAgency (BlockFetch (Serialised blk) (Point blk))
-> Text
forHuman = String -> Text
pack (String -> Text)
-> (AnyMessageAndAgency (BlockFetch (Serialised blk) (Point blk))
    -> String)
-> AnyMessageAndAgency (BlockFetch (Serialised blk) (Point blk))
-> Text
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. AnyMessageAndAgency (BlockFetch (Serialised blk) (Point blk))
-> String
forall a. Show a => a -> String
show


--------------------------------------------------------------------------------
-- TxSubmissionNode Tracer
--------------------------------------------------------------------------------

severityTxSubmissionNode :: BlockFetch.TraceLabelPeer peer
  (TraceSendRecv (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))) -> SeverityS
severityTxSubmissionNode :: TraceLabelPeer
  peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)))
-> SeverityS
severityTxSubmissionNode (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
v) = TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
forall blk.
TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
v
  where
    severityTxSubNode :: TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode (TraceSendMsg AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg) = AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
forall blk.
AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode' AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg
    severityTxSubNode (TraceRecvMsg AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg) = AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
forall blk.
AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode' AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg

    severityTxSubNode' :: AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
msg) = Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
-> SeverityS
forall blk (from :: TxSubmission2 (GenTxId blk) (GenTx blk))
       (to :: TxSubmission2 (GenTxId blk) (GenTx blk)).
Message (TxSubmission2 (GenTxId blk) (GenTx blk)) from to
-> SeverityS
severityTxSubNode'' Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
msg

    severityTxSubNode'' ::
        Message
          (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))
          from
          to
     -> SeverityS
    severityTxSubNode'' :: Message (TxSubmission2 (GenTxId blk) (GenTx blk)) from to
-> SeverityS
severityTxSubNode'' TXS.MsgInit {} = SeverityS
Info
    severityTxSubNode'' TXS.MsgRequestTxIds {} = SeverityS
Info
    severityTxSubNode'' TXS.MsgReplyTxIds {}   = SeverityS
Info
    severityTxSubNode'' TXS.MsgRequestTxs {}   = SeverityS
Info
    severityTxSubNode'' TXS.MsgReplyTxs {}     = SeverityS
Info
    severityTxSubNode'' TXS.MsgDone {}         = SeverityS
Info


namesForTxSubmissionNode :: BlockFetch.TraceLabelPeer peer
  (TraceSendRecv (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))) -> [Text]
namesForTxSubmissionNode :: TraceLabelPeer
  peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)))
-> [Text]
namesForTxSubmissionNode (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
v) =
  Text
"NodeToNode" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)) -> [Text]
forall blk.
TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)) -> [Text]
namesTxSubNode TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
v
  where
    namesTxSubNode :: TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)) -> [Text]
namesTxSubNode (TraceSendMsg AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg) = Text
"Send" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> [Text]
forall blk.
AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> [Text]
namesTxSubNode' AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg
    namesTxSubNode (TraceRecvMsg AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg) = Text
"Receive" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> [Text]
forall blk.
AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> [Text]
namesTxSubNode' AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg

    namesTxSubNode' :: AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> [Text]
namesTxSubNode' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
msg) = Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st' -> [Text]
forall blk (from :: TxSubmission2 (GenTxId blk) (GenTx blk))
       (to :: TxSubmission2 (GenTxId blk) (GenTx blk)).
Message (TxSubmission2 (GenTxId blk) (GenTx blk)) from to -> [Text]
namesTxSubNode'' Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
msg

    namesTxSubNode'' ::
         Message
          (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))
          from
          to
      -> [Text]
    namesTxSubNode'' :: Message (TxSubmission2 (GenTxId blk) (GenTx blk)) from to -> [Text]
namesTxSubNode'' TXS.MsgInit {} = [Text
"MsgInit"]
    namesTxSubNode'' TXS.MsgRequestTxIds {} = [Text
"RequestTxIds"]
    namesTxSubNode'' TXS.MsgReplyTxIds {}   = [Text
"ReplyTxIds"]
    namesTxSubNode'' TXS.MsgRequestTxs {}   = [Text
"RequestTxs"]
    namesTxSubNode'' TXS.MsgReplyTxs {}     = [Text
"ReplyTxs"]
    namesTxSubNode'' TXS.MsgDone {}         = [Text
"Done"]


instance (Show txid, Show tx)
      => LogFormatting (AnyMessageAndAgency (STX.TxSubmission2 txid tx)) where
  forMachine :: DetailLevel
-> AnyMessageAndAgency (TxSubmission2 txid tx) -> Object
forMachine DetailLevel
_dtal (AnyMessageAndAgency PeerHasAgency pr st
stok Message (TxSubmission2 txid tx) st st'
STX.MsgInit) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgInit"
      , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
      ]
  forMachine DetailLevel
_dtal (AnyMessageAndAgency PeerHasAgency pr st
stok (STX.MsgRequestTxs txids)) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgRequestTxs"
      , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
      , Key
"txIds" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ [txid1] -> String
forall a. Show a => a -> String
show [txid1]
txids)
      ]
  forMachine DetailLevel
_dtal (AnyMessageAndAgency PeerHasAgency pr st
stok (STX.MsgReplyTxs txs)) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgReplyTxs"
      , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
      , Key
"txs" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ [tx1] -> String
forall a. Show a => a -> String
show [tx1]
txs)
      ]
  forMachine DetailLevel
_dtal (AnyMessageAndAgency PeerHasAgency pr st
stok STX.MsgRequestTxIds {}) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgRequestTxIds"
      , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
      ]
  forMachine DetailLevel
_dtal (AnyMessageAndAgency PeerHasAgency pr st
stok (STX.MsgReplyTxIds _)) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgReplyTxIds"
      , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
      ]
  forMachine DetailLevel
_dtal (AnyMessageAndAgency PeerHasAgency pr st
stok Message (TxSubmission2 txid tx) st st'
STX.MsgDone) =
    [Object] -> Object
forall a. Monoid a => [a] -> a
mconcat
      [ Key
"kind" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String Text
"MsgDone"
      , Key
"agency" Key -> Value -> Object
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text -> Value
String (String -> Text
pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ PeerHasAgency pr st -> String
forall a. Show a => a -> String
show PeerHasAgency pr st
stok)
      ]

docTTxSubmissionNode :: Documented
  (BlockFetch.TraceLabelPeer peer
    (TraceSendRecv
      (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmissionNode :: Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmissionNode =
  [Text]
-> Documented
     (TraceLabelPeer
        Any (TraceSendRecv (TxSubmission2 (GenTxId Any) (GenTx Any))))
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a b. [Text] -> Documented a -> Documented b
addDocumentedNamespace  [Text
"NodeToNode", Text
"Send"] Documented
  (TraceLabelPeer
     Any (TraceSendRecv (TxSubmission2 (GenTxId Any) (GenTx Any))))
forall peer blk.
Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmissionNode'
  Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. Documented a -> Documented a -> Documented a
`addDocs` [Text]
-> Documented
     (TraceLabelPeer
        Any (TraceSendRecv (TxSubmission2 (GenTxId Any) (GenTx Any))))
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a b. [Text] -> Documented a -> Documented b
addDocumentedNamespace  [Text
"NodeToNode", Text
"Recieve"] Documented
  (TraceLabelPeer
     Any (TraceSendRecv (TxSubmission2 (GenTxId Any) (GenTx Any))))
forall peer blk.
Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmissionNode'

docTTxSubmissionNode' :: Documented
  (BlockFetch.TraceLabelPeer peer
    (TraceSendRecv
      (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmissionNode' :: Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmissionNode' = [DocMsg
   (TraceLabelPeer
      peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))]
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [DocMsg a] -> Documented a
Documented [
      [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"RequestTxIds"]
        []
        Text
"Request a non-empty list of transaction identifiers from the client,\
        \and confirm a number of outstanding transaction identifiers.\
        \\n\
        \With 'TokBlocking' this is a a blocking operation: the response will\
        \always have at least one transaction identifier, and it does not expect\
        \a prompt response: there is no timeout. This covers the case when there\
        \is nothing else to do but wait. For example this covers leaf nodes that\
        \rarely, if ever, create and submit a transaction.\
        \\n\
        \With 'TokNonBlocking' this is a non-blocking operation: the response\
        \may be an empty list and this does expect a prompt response. This\
        \covers high throughput use cases where we wish to pipeline, by\
        \interleaving requests for additional transaction identifiers with\
        \requests for transactions, which requires these requests not block.\
        \\n\
        \The request gives the maximum number of transaction identifiers that\
        \can be accepted in the response. This must be greater than zero in the\
        \'TokBlocking' case. In the 'TokNonBlocking' case either the numbers\
        \acknowledged or the number requested must be non-zero. In either case,\
        \the number requested must not put the total outstanding over the fixed\
        \protocol limit.\
        \\n\
        \The request also gives the number of outstanding transaction\
        \identifiers that can now be acknowledged. The actual transactions\
        \to acknowledge are known to the peer based on the FIFO order in which\
        \they were provided.\
        \\n\
        \There is no choice about when to use the blocking case versus the\
        \non-blocking case, it depends on whether there are any remaining\
        \unacknowledged transactions (after taking into account the ones\
        \acknowledged in this message):\
        \\n\
        \* The blocking case must be used when there are zero remaining\
        \  unacknowledged transactions.\
        \\n\
        \* The non-blocking case must be used when there are non-zero remaining\
        \  unacknowledged transactions."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"ReplyTxIds"]
        []
        Text
"Reply with a list of transaction identifiers for available\
        \transactions, along with the size of each transaction.\
        \\n\
        \The list must not be longer than the maximum number requested.\
        \\n\
        \In the 'StTxIds' 'StBlocking' state the list must be non-empty while\
        \in the 'StTxIds' 'StNonBlocking' state the list may be empty.\
        \\n\
        \These transactions are added to the notional FIFO of outstanding\
        \transaction identifiers for the protocol.\
        \\n\
        \The order in which these transaction identifiers are returned must be\
        \the order in which they are submitted to the mempool, to preserve\
        \dependent transactions."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"RequestTxs"]
        []
        Text
"Request one or more transactions corresponding to the given \
        \transaction identifiers. \
        \\n\
        \While it is the responsibility of the replying peer to keep within \
        \pipelining in-flight limits, the sender must also cooperate by keeping \
        \the total requested across all in-flight requests within the limits. \
        \\n\
        \It is an error to ask for transaction identifiers that were not \
        \previously announced (via 'MsgReplyTxIds'). \
        \\n\
        \It is an error to ask for transaction identifiers that are not \
        \outstanding or that were already asked for."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"ReplyTxs"]
        []
        Text
"Reply with the requested transactions, or implicitly discard.\
        \\n\
        \Transactions can become invalid between the time the transaction \
        \identifier was sent and the transaction being requested. Invalid \
        \(including committed) transactions do not need to be sent.\
        \\n\
        \Any transaction identifiers requested but not provided in this reply \
        \should be considered as if this peer had never announced them. (Note \
        \that this is no guarantee that the transaction is invalid, it may still \
        \be valid and available from another peer)."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"Done"]
        []
        Text
"Termination message, initiated by the client when the server is \
        \making a blocking call for more transaction identifiers."
  --TODO: Can't use 'MsgKThxBye' because NodeToNodeV_2 is not introduced yet.
  ]

--------------------------------------------------------------------------------
-- TxSubmissionNode2 Tracer
--------------------------------------------------------------------------------

severityTxSubmission2Node :: forall blk peer. BlockFetch.TraceLabelPeer peer
  (TraceSendRecv (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))) -> SeverityS
severityTxSubmission2Node :: TraceLabelPeer
  peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)))
-> SeverityS
severityTxSubmission2Node (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
v) = TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
v
  where
    severityTxSubNode :: TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode (TraceSendMsg AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg) = AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode' AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg
    severityTxSubNode (TraceRecvMsg AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg) = AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode' AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg

    severityTxSubNode' :: AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> SeverityS
severityTxSubNode' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
msg) = Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
-> SeverityS
forall (from :: TxSubmission2 (GenTxId blk) (GenTx blk))
       (to :: TxSubmission2 (GenTxId blk) (GenTx blk)).
Message (TxSubmission2 (GenTxId blk) (GenTx blk)) from to
-> SeverityS
severityTxSubNode'' Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
msg

    severityTxSubNode'' ::
        Message
          (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))
          from
          to
     -> SeverityS
    severityTxSubNode'' :: Message (TxSubmission2 (GenTxId blk) (GenTx blk)) from to
-> SeverityS
severityTxSubNode'' STX.MsgInit {}         = SeverityS
Debug
    severityTxSubNode'' TXS.MsgRequestTxIds {} = SeverityS
Info
    severityTxSubNode'' TXS.MsgReplyTxIds {}   = SeverityS
Info
    severityTxSubNode'' TXS.MsgRequestTxs {}   = SeverityS
Info
    severityTxSubNode'' TXS.MsgReplyTxs {}     = SeverityS
Info
    severityTxSubNode'' TXS.MsgDone {}         = SeverityS
Info

namesForTxSubmission2Node :: forall blk peer. BlockFetch.TraceLabelPeer peer
  (TraceSendRecv (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))) -> [Text]
namesForTxSubmission2Node :: TraceLabelPeer
  peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)))
-> [Text]
namesForTxSubmission2Node (BlockFetch.TraceLabelPeer peer
_ TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
v) =
  Text
"NodeToNode" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)) -> [Text]
namesTxSubNode TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))
v
  where
    namesTxSubNode :: TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk)) -> [Text]
namesTxSubNode (TraceSendMsg AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg) = Text
"Send" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> [Text]
namesTxSubNode' AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg
    namesTxSubNode (TraceRecvMsg AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg) = Text
"Receive" Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> [Text]
namesTxSubNode' AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
msg

    namesTxSubNode' :: AnyMessageAndAgency (TxSubmission2 (GenTxId blk) (GenTx blk))
-> [Text]
namesTxSubNode' (AnyMessageAndAgency PeerHasAgency pr st
_agency Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
msg) = Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st' -> [Text]
forall (from :: TxSubmission2 (GenTxId blk) (GenTx blk))
       (to :: TxSubmission2 (GenTxId blk) (GenTx blk)).
Message (TxSubmission2 (GenTxId blk) (GenTx blk)) from to -> [Text]
namesTxSubNode'' Message (TxSubmission2 (GenTxId blk) (GenTx blk)) st st'
msg

    namesTxSubNode'' ::
         Message
          (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))
          from
          to
      -> [Text]
    namesTxSubNode'' :: Message (TxSubmission2 (GenTxId blk) (GenTx blk)) from to -> [Text]
namesTxSubNode'' TXS.MsgInit {}         = [Text
"MsgInit"]
    namesTxSubNode'' TXS.MsgRequestTxIds {} = [Text
"RequestTxIds"]
    namesTxSubNode'' TXS.MsgReplyTxIds {}   = [Text
"ReplyTxIds"]
    namesTxSubNode'' TXS.MsgRequestTxs {}   = [Text
"RequestTxs"]
    namesTxSubNode'' TXS.MsgReplyTxs {}     = [Text
"ReplyTxs"]
    namesTxSubNode'' TXS.MsgDone {}         = [Text
"Done"]


docTTxSubmission2Node :: Documented
  (BlockFetch.TraceLabelPeer peer
    (TraceSendRecv
      (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmission2Node :: Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmission2Node =
  [Text]
-> Documented
     (TraceLabelPeer
        Any (TraceSendRecv (TxSubmission2 (GenTxId Any) (GenTx Any))))
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a b. [Text] -> Documented a -> Documented b
addDocumentedNamespace  [Text
"NodeToNode", Text
"Send"] Documented
  (TraceLabelPeer
     Any (TraceSendRecv (TxSubmission2 (GenTxId Any) (GenTx Any))))
forall peer blk.
Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmission2Node'
  Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. Documented a -> Documented a -> Documented a
`addDocs` [Text]
-> Documented
     (TraceLabelPeer
        Any (TraceSendRecv (TxSubmission2 (GenTxId Any) (GenTx Any))))
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a b. [Text] -> Documented a -> Documented b
addDocumentedNamespace  [Text
"NodeToNode", Text
"Recieve"] Documented
  (TraceLabelPeer
     Any (TraceSendRecv (TxSubmission2 (GenTxId Any) (GenTx Any))))
forall peer blk.
Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmission2Node'

docTTxSubmission2Node' :: Documented
  (BlockFetch.TraceLabelPeer peer
    (TraceSendRecv
      (TXS.TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmission2Node' :: Documented
  (TraceLabelPeer
     peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
docTTxSubmission2Node' = [DocMsg
   (TraceLabelPeer
      peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))]
-> Documented
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [DocMsg a] -> Documented a
Documented [
      [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"MsgHello"]
        []
        Text
"Client side hello message."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"RequestTxIds"]
        []
        Text
"Request a non-empty list of transaction identifiers from the client, \
        \and confirm a number of outstanding transaction identifiers. \
        \\n\
        \With 'TokBlocking' this is a a blocking operation: the response will \
        \always have at least one transaction identifier, and it does not expect \
        \a prompt response: there is no timeout. This covers the case when there \
        \is nothing else to do but wait. For example this covers leaf nodes that \
        \rarely, if ever, create and submit a transaction. \
        \\n\
        \With 'TokNonBlocking' this is a non-blocking operation: the response \
        \may be an empty list and this does expect a prompt response. This \
        \covers high throughput use cases where we wish to pipeline, by \
        \interleaving requests for additional transaction identifiers with \
        \requests for transactions, which requires these requests not block. \
        \\n\
        \The request gives the maximum number of transaction identifiers that \
        \can be accepted in the response. This must be greater than zero in the \
        \'TokBlocking' case. In the 'TokNonBlocking' case either the numbers \
        \acknowledged or the number requested must be non-zero. In either case, \
        \the number requested must not put the total outstanding over the fixed \
        \protocol limit. \
        \\n\
        \The request also gives the number of outstanding transaction \
        \identifiers that can now be acknowledged. The actual transactions \
        \to acknowledge are known to the peer based on the FIFO order in which \
        \they were provided. \
        \\n\
        \There is no choice about when to use the blocking case versus the \
        \non-blocking case, it depends on whether there are any remaining \
        \unacknowledged transactions (after taking into account the ones \
        \acknowledged in this message): \
        \\n\
        \* The blocking case must be used when there are zero remaining \
        \  unacknowledged transactions. \
        \\n\
        \* The non-blocking case must be used when there are non-zero remaining \
        \  unacknowledged transactions."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"ReplyTxIds"]
        []
        Text
"Reply with a list of transaction identifiers for available\
        \transactions, along with the size of each transaction.\
        \\n\
        \The list must not be longer than the maximum number requested.\
        \\n\
        \In the 'StTxIds' 'StBlocking' state the list must be non-empty while\
        \in the 'StTxIds' 'StNonBlocking' state the list may be empty.\
        \\n\
        \These transactions are added to the notional FIFO of outstanding\
        \transaction identifiers for the protocol.\
        \\n\
        \The order in which these transaction identifiers are returned must be\
        \the order in which they are submitted to the mempool, to preserve\
        \dependent transactions."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"RequestTxs"]
        []
        Text
"Request one or more transactions corresponding to the given \
        \transaction identifiers. \
        \\n\
        \While it is the responsibility of the replying peer to keep within\
        \pipelining in-flight limits, the sender must also cooperate by keeping\
        \the total requested across all in-flight requests within the limits.\
        \\n\
        \It is an error to ask for transaction identifiers that were not\
        \previously announced (via 'MsgReplyTxIds').\
        \\n\
        \It is an error to ask for transaction identifiers that are not\
        \outstanding or that were already asked for."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"ReplyTxs"]
        []
        Text
"Reply with the requested transactions, or implicitly discard.\
        \\n\
        \Transactions can become invalid between the time the transaction\
        \identifier was sent and the transaction being requested. Invalid\
        \(including committed) transactions do not need to be sent.\
        \\n\
        \Any transaction identifiers requested but not provided in this reply\
        \should be considered as if this peer had never announced them. (Note\
        \that this is no guarantee that the transaction is invalid, it may still\
        \be valid and available from another peer)."
    , [Text]
-> [(Text, Text)]
-> Text
-> DocMsg
     (TraceLabelPeer
        peer (TraceSendRecv (TxSubmission2 (GenTxId blk) (GenTx blk))))
forall a. [Text] -> [(Text, Text)] -> Text -> DocMsg a
DocMsg
        [Text
"Done"]
        []
        Text
"Termination message, initiated by the client when the server is\
        \making a blocking call for more transaction identifiers."
  --TODO: Can't use 'MsgKThxBye' because NodeToNodeV_2 is not introduced yet.
  ]