Skip to content

Commit 353b894

Browse files
committed
tracing: removed duplicate instances for LocalStateQuery mini-protocol
LocalStateQuery mini-protocol is running using `typed-protoocls:stateful` API, and only it's instances are necessary.
1 parent 6ce5a78 commit 353b894

File tree

3 files changed

+11
-118
lines changed

3 files changed

+11
-118
lines changed

cardano-node/src/Cardano/Node/Tracing/Consistency.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import qualified Ouroboros.Network.ConnectionManager.Core as ConnectionManager
6666
import qualified Ouroboros.Network.ConnectionManager.Types as ConnectionManager
6767
import Ouroboros.Network.Diffusion (DiffusionTracer)
6868
import Ouroboros.Network.Driver.Simple (TraceSendRecv)
69+
import qualified Ouroboros.Network.Driver.Stateful as Stateful (TraceSendRecv)
6970
import qualified Ouroboros.Network.InboundGovernor as InboundGovernor
7071
import Ouroboros.Network.KeepAlive (TraceKeepAliveClient (..))
7172
import qualified Ouroboros.Network.NodeToClient as NtC
@@ -86,6 +87,7 @@ import Ouroboros.Network.Protocol.ChainSync.Type (ChainSync)
8687
import Ouroboros.Network.Protocol.Handshake.Unversioned (UnversionedProtocol (..),
8788
UnversionedProtocolData (..))
8889
import Ouroboros.Network.Protocol.LocalStateQuery.Type (LocalStateQuery)
90+
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as LocalStateQuery
8991
import qualified Ouroboros.Network.Protocol.LocalTxMonitor.Type as LTM
9092
import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Type as LTS
9193
import Ouroboros.Network.Protocol.TxSubmission2.Type (TxSubmission2)
@@ -229,8 +231,9 @@ getAllNamespaces =
229231
stateQueryNS = map (nsGetTuple . nsReplacePrefix ["StateQueryServer"])
230232
(allNamespaces :: [Namespace
231233
(BlockFetch.TraceLabelPeer peer
232-
(TraceSendRecv
233-
(LocalStateQuery blk (Point blk) (Query blk))))])
234+
(Stateful.TraceSendRecv
235+
(LocalStateQuery blk (Point blk) (Query blk))
236+
LocalStateQuery.State))])
234237

235238
-- Node to Node
236239
chainSyncNodeNS = map (nsGetTuple . nsReplacePrefix ["ChainSync", "Remote"])

cardano-node/src/Cardano/Node/Tracing/Documentation.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import qualified Ouroboros.Network.ConnectionManager.Core as ConnectionManager
8080
import qualified Ouroboros.Network.ConnectionManager.Types as ConnectionManager
8181
import Ouroboros.Network.Diffusion.Types (DiffusionTracer)
8282
import Ouroboros.Network.Driver.Simple (TraceSendRecv)
83+
import qualified Ouroboros.Network.Driver.Stateful as Stateful (TraceSendRecv)
8384
import qualified Ouroboros.Network.InboundGovernor as InboundGovernor
8485
import Ouroboros.Network.KeepAlive (TraceKeepAliveClient (..))
8586
import Ouroboros.Network.NodeToNode (RemoteAddress)
@@ -98,6 +99,7 @@ import Ouroboros.Network.Protocol.ChainSync.Type (ChainSync)
9899
import Ouroboros.Network.Protocol.Handshake.Unversioned (UnversionedProtocol (..),
99100
UnversionedProtocolData (..))
100101
import Ouroboros.Network.Protocol.LocalStateQuery.Type (LocalStateQuery)
102+
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as LocalStateQuery
101103
import qualified Ouroboros.Network.Protocol.LocalTxMonitor.Type as LTM
102104
import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Type as LTS
103105
import Ouroboros.Network.Protocol.TxSubmission2.Type (TxSubmission2)
@@ -489,8 +491,10 @@ docTracersFirstPhase condConfigFileName = do
489491
stateQueryTrDoc <- documentTracer (stateQueryTr ::
490492
Logging.Trace IO
491493
(BlockFetch.TraceLabelPeer peer
492-
(TraceSendRecv
493-
(LocalStateQuery blk (Point blk) (Query blk)))))
494+
(Stateful.TraceSendRecv
495+
(LocalStateQuery blk (Point blk) (Query blk))
496+
LocalStateQuery.State
497+
)))
494498

495499
-- Node to Node
496500

cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToClient.hs

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -488,41 +488,6 @@ instance MetaTrace (Simple.AnyMessage (LTS.LocalTxSubmission tx err)) where
488488
-- TStateQuery Tracer
489489
--------------------------------------------------------------------------------
490490

491-
instance (forall result. Show (Query blk result))
492-
=> LogFormatting (Simple.AnyMessage (LSQ.LocalStateQuery blk pt (Query blk))) where
493-
forMachine _dtal (Simple.AnyMessageAndAgency stok LSQ.MsgAcquire{}) =
494-
mconcat [ "kind" .= String "MsgAcquire"
495-
, "agency" .= String (pack $ show stok)
496-
]
497-
forMachine _dtal (Simple.AnyMessageAndAgency stok LSQ.MsgAcquired{}) =
498-
mconcat [ "kind" .= String "MsgAcquired"
499-
, "agency" .= String (pack $ show stok)
500-
]
501-
forMachine _dtal (Simple.AnyMessageAndAgency stok LSQ.MsgFailure{}) =
502-
mconcat [ "kind" .= String "MsgFailure"
503-
, "agency" .= String (pack $ show stok)
504-
]
505-
forMachine _dtal (Simple.AnyMessageAndAgency stok LSQ.MsgQuery{}) =
506-
mconcat [ "kind" .= String "MsgQuery"
507-
, "agency" .= String (pack $ show stok)
508-
]
509-
forMachine _dtal (Simple.AnyMessageAndAgency stok LSQ.MsgResult{}) =
510-
mconcat [ "kind" .= String "MsgResult"
511-
, "agency" .= String (pack $ show stok)
512-
]
513-
forMachine _dtal (Simple.AnyMessageAndAgency stok LSQ.MsgRelease{}) =
514-
mconcat [ "kind" .= String "MsgRelease"
515-
, "agency" .= String (pack $ show stok)
516-
]
517-
forMachine _dtal (Simple.AnyMessageAndAgency stok LSQ.MsgReAcquire{}) =
518-
mconcat [ "kind" .= String "MsgReAcquire"
519-
, "agency" .= String (pack $ show stok)
520-
]
521-
forMachine _dtal (Simple.AnyMessageAndAgency stok LSQ.MsgDone{}) =
522-
mconcat [ "kind" .= String "MsgDone"
523-
, "agency" .= String (pack $ show stok)
524-
]
525-
526491
instance (forall result. Show (Query blk result))
527492
=> LogFormatting (Stateful.AnyMessage (LSQ.LocalStateQuery blk pt (Query blk)) f) where
528493
forMachine _dtal (Stateful.AnyMessageAndAgency stok _ LSQ.MsgAcquire{}) =
@@ -558,85 +523,6 @@ instance (forall result. Show (Query blk result))
558523
, "agency" .= String (pack $ show stok)
559524
]
560525

561-
instance MetaTrace (Simple.AnyMessage (LSQ.LocalStateQuery blk pt (Query blk))) where
562-
namespaceFor (Simple.AnyMessageAndAgency _agency LSQ.MsgAcquire{}) =
563-
Namespace [] ["Acquire"]
564-
namespaceFor (Simple.AnyMessageAndAgency _agency LSQ.MsgAcquired{}) =
565-
Namespace [] ["Acquired"]
566-
namespaceFor (Simple.AnyMessageAndAgency _agency LSQ.MsgFailure{}) =
567-
Namespace [] ["Failure"]
568-
namespaceFor (Simple.AnyMessageAndAgency _agency LSQ.MsgQuery{}) =
569-
Namespace [] ["Query"]
570-
namespaceFor (Simple.AnyMessageAndAgency _agency LSQ.MsgResult{}) =
571-
Namespace [] ["Result"]
572-
namespaceFor (Simple.AnyMessageAndAgency _agency LSQ.MsgRelease{}) =
573-
Namespace [] ["Release"]
574-
namespaceFor (Simple.AnyMessageAndAgency _agency LSQ.MsgReAcquire{}) =
575-
Namespace [] ["ReAcquire"]
576-
namespaceFor (Simple.AnyMessageAndAgency _agency LSQ.MsgDone{}) =
577-
Namespace [] ["Done"]
578-
579-
severityFor (Namespace _ ["Acquire"]) _ = Just Debug
580-
severityFor (Namespace _ ["Acquired"]) _ = Just Debug
581-
severityFor (Namespace _ ["Failure"]) _ = Just Warning
582-
severityFor (Namespace _ ["Query"]) _ = Just Debug
583-
severityFor (Namespace _ ["Result"]) _ = Just Debug
584-
severityFor (Namespace _ ["Release"]) _ = Just Debug
585-
severityFor (Namespace _ ["ReAcquire"]) _ = Just Debug
586-
severityFor (Namespace _ ["Done"]) _ = Just Debug
587-
severityFor _ _ = Nothing
588-
589-
documentFor (Namespace _ ["Acquire"]) = Just $ mconcat
590-
[ "The client requests that the state as of a particular recent point on "
591-
, "the server's chain (within K of the tip) be made available to query, "
592-
, "and waits for confirmation or failure. "
593-
, "\n "
594-
, "From 'NodeToClient_V8' onwards if the point is not specified, current tip "
595-
, "will be acquired. For previous versions of the protocol 'point' must be "
596-
, "given."
597-
]
598-
documentFor (Namespace _ ["Acquired"]) = Just
599-
"The server can confirm that it has the state at the requested point."
600-
documentFor (Namespace _ ["Failure"]) = Just $ mconcat
601-
[ "The server can report that it cannot obtain the state for the "
602-
, "requested point."
603-
]
604-
documentFor (Namespace _ ["Query"]) = Just
605-
"The client can perform queries on the current acquired state."
606-
documentFor (Namespace _ ["Result"]) = Just
607-
"The server must reply with the queries."
608-
documentFor (Namespace _ ["Release"]) = Just $ mconcat
609-
[ "The client can instruct the server to release the state. This lets "
610-
, "the server free resources."
611-
]
612-
documentFor (Namespace _ ["ReAcquire"]) = Just $ mconcat
613-
[ "This is like 'MsgAcquire' but for when the client already has a "
614-
, "state. By moving to another state directly without a 'MsgRelease' it "
615-
, "enables optimisations on the server side (e.g. moving to the state for "
616-
, "the immediate next block). "
617-
, "\n "
618-
, "Note that failure to re-acquire is equivalent to 'MsgRelease', "
619-
, "rather than keeping the exiting acquired state. "
620-
, "\n "
621-
, "From 'NodeToClient_V8' onwards if the point is not specified, current tip "
622-
, "will be acquired. For previous versions of the protocol 'point' must be "
623-
, "given."
624-
]
625-
documentFor (Namespace _ ["Done"]) = Just
626-
"The client can terminate the protocol."
627-
documentFor _ = Nothing
628-
629-
allNamespaces = [
630-
Namespace [] ["Acquire"]
631-
, Namespace [] ["Acquired"]
632-
, Namespace [] ["Failure"]
633-
, Namespace [] ["Query"]
634-
, Namespace [] ["Result"]
635-
, Namespace [] ["Release"]
636-
, Namespace [] ["ReAcquire"]
637-
, Namespace [] ["Done"]
638-
]
639-
640526
instance MetaTrace (Stateful.AnyMessage (LSQ.LocalStateQuery blk pt (Query blk)) f) where
641527
namespaceFor (Stateful.AnyMessageAndAgency _agency _ LSQ.MsgAcquire{}) =
642528
Namespace [] ["Acquire"]

0 commit comments

Comments
 (0)