From 6ad885d8661de97fc6647216d823c22df7b2adf3 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Tue, 28 Apr 2026 12:39:05 +0200 Subject: [PATCH 1/2] Update tracers with new message --- .../src/Cardano/Node/Tracing/Tracers/NodeToNode.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToNode.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToNode.hs index ccddf7ad479..93f985b59fe 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToNode.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToNode.hs @@ -500,6 +500,11 @@ instance LogFormatting (AnyMessage (LN.LeiosNotify LeiosPoint ())) where , "ebHash" .= ebHash ] + LN.MsgLeiosVotes votes -> + mconcat [ "kind" .= String "MsgLeiosVotes" + , "votes" .= votes + ] + LN.MsgDone -> mconcat [ "kind" .= String "MsgDone" ] @@ -516,6 +521,7 @@ instance MetaTrace (AnyMessage (LN.LeiosNotify LeiosPoint ())) where LN.MsgLeiosBlockAnnouncement {} -> Namespace [] ["BlockAnnouncement"] LN.MsgLeiosBlockOffer {} -> Namespace [] ["BlockOffer"] LN.MsgLeiosBlockTxsOffer {} -> Namespace [] ["BlockTxsOffer"] + LN.MsgLeiosVotes {} -> Namespace [] ["Votes"] LN.MsgDone -> Namespace [] ["Done"] severityFor _ _ = Just Debug @@ -527,6 +533,7 @@ instance MetaTrace (AnyMessage (LN.LeiosNotify LeiosPoint ())) where , Namespace [] ["BlockAnnouncement"] , Namespace [] ["BlockOffer"] , Namespace [] ["BlockTxsOffer"] + , Namespace [] ["Votes"] , Namespace [] ["Done"] ] From 86819610b2285945278404981959e2a21217e59d Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Mon, 11 May 2026 10:45:28 +0200 Subject: [PATCH 2/2] Use o-c with LeiosNotify toObject encoder --- cabal.project | 4 +- .../src/Cardano/Node/Tracing/Consistency.hs | 5 ++- .../Node/Tracing/Tracers/NodeToNode.hs | 39 +++--------------- .../Tracing/OrphanInstances/Network.hs | 41 ++++--------------- 4 files changed, 19 insertions(+), 70 deletions(-) diff --git a/cabal.project b/cabal.project index e52da80e514..4ae4f9756d9 100644 --- a/cabal.project +++ b/cabal.project @@ -110,8 +110,8 @@ source-repository-package source-repository-package type: git location: https://github.com/IntersectMBO/ouroboros-consensus - tag: 83999b476f3fff112453e71739e9a522b9f91057 - --sha256: sha256-pM9QaNvt3VEFt706uyhDFav8Cu1M0qRe3pV7m4ipJuw= + tag: 936d5a0ee3dd4d7349683aac981c743ae0b28c0a + --sha256: sha256-h7tbGN7XmU5XsenwF6GltuaU1jM3QEYE3y1TzIRk09A= subdir: ouroboros-consensus ouroboros-consensus-cardano diff --git a/cardano-node/src/Cardano/Node/Tracing/Consistency.hs b/cardano-node/src/Cardano/Node/Tracing/Consistency.hs index b955d6605ce..894373f05a3 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Consistency.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Consistency.hs @@ -101,9 +101,10 @@ import qualified Data.Text as T import qualified Network.Mux as Mux import qualified Network.Socket as Socket -import LeiosDemoTypes (LeiosPoint, LeiosEb, LeiosTx, TraceLeiosKernel, TraceLeiosPeer) import LeiosDemoOnlyTestFetch (LeiosFetch) import LeiosDemoOnlyTestNotify (LeiosNotify) +import LeiosDemoTypes (LeiosEb, LeiosPoint, LeiosTx, LeiosVote, TraceLeiosKernel, + TraceLeiosPeer) -- | Check the configuration in the given file. -- If there is no configuration in the file check the standard configuration @@ -273,7 +274,7 @@ getAllNamespaces = (allNamespaces :: [Namespace (BlockFetch.TraceLabelPeer peer (TraceSendRecv - (LeiosNotify LeiosPoint ())))]) + (LeiosNotify LeiosPoint () LeiosVote)))]) leiosFetchNS = map (nsGetTuple . nsReplacePrefix ["LeiosFetch", "Remote"]) (allNamespaces :: [Namespace diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToNode.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToNode.hs index 93f985b59fe..e1fff3702fb 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToNode.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/NodeToNode.hs @@ -37,8 +37,8 @@ import Network.TypedProtocol.Codec (AnyMessage (AnyMessageAndAgency)) import qualified LeiosDemoOnlyTestFetch as LF import qualified LeiosDemoOnlyTestNotify as LN -import LeiosDemoTypes (EbHash (..), LeiosEb, LeiosPoint (..), LeiosTx, - messageLeiosFetchToObject, prettyEbHash) +import LeiosDemoTypes (EbHash (..), LeiosEb, LeiosPoint (..), LeiosTx, LeiosVote, + messageLeiosFetchToObject, messageLeiosNotifyToObject, prettyEbHash) -------------------------------------------------------------------------------- -- BlockFetch Tracer @@ -476,38 +476,11 @@ instance MetaTrace (TraceKeepAliveClient remotePeer) where instance ToJSON EbHash where toJSON = toJSON . prettyEbHash -instance LogFormatting (AnyMessage (LN.LeiosNotify LeiosPoint ())) where +instance LogFormatting (AnyMessage (LN.LeiosNotify LeiosPoint () LeiosVote)) where forHuman = showT - forMachine _dtal (AnyMessageAndAgency _stok msg) = case msg of - - LN.MsgLeiosNotificationRequestNext -> - mconcat [ "kind" .= String "MsgLeiosNotificationRequestNext" - ] - - LN.MsgLeiosBlockAnnouncement () -> - mconcat [ "kind" .= String "MsgLeiosBlockAnnouncement" - ] - LN.MsgLeiosBlockOffer (MkLeiosPoint ebSlot ebHash) ebBytesSize -> - mconcat [ "kind" .= String "MsgLeiosBlockOffer" - , "ebSlot" .= ebSlot - , "ebHash" .= ebHash - , "ebBytesSize" .= ebBytesSize - ] - LN.MsgLeiosBlockTxsOffer (MkLeiosPoint ebSlot ebHash) -> - mconcat [ "kind" .= String "MsgLeiosBlockTxsOffer" - , "ebSlot" .= ebSlot - , "ebHash" .= ebHash - ] - - LN.MsgLeiosVotes votes -> - mconcat [ "kind" .= String "MsgLeiosVotes" - , "votes" .= votes - ] - - LN.MsgDone -> - mconcat [ "kind" .= String "MsgDone" - ] + forMachine _dtal (AnyMessageAndAgency _stok msg) = + messageLeiosNotifyToObject msg instance LogFormatting (AnyMessage (LF.LeiosFetch LeiosPoint LeiosEb LeiosTx)) where forHuman = showT @@ -515,7 +488,7 @@ instance LogFormatting (AnyMessage (LF.LeiosFetch LeiosPoint LeiosEb LeiosTx)) w forMachine _dtal (AnyMessageAndAgency _stok msg) = messageLeiosFetchToObject msg -instance MetaTrace (AnyMessage (LN.LeiosNotify LeiosPoint ())) where +instance MetaTrace (AnyMessage (LN.LeiosNotify LeiosPoint () LeiosVote)) where namespaceFor (AnyMessageAndAgency _stok msg) = case msg of LN.MsgLeiosNotificationRequestNext {} -> Namespace [] ["RequestNext"] LN.MsgLeiosBlockAnnouncement {} -> Namespace [] ["BlockAnnouncement"] diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs index c1f757c9b14..4b75654e4a7 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs @@ -141,9 +141,10 @@ import qualified Network.TypedProtocol.Stateful.Codec as Stateful import qualified LeiosDemoOnlyTestFetch as LF import qualified LeiosDemoOnlyTestNotify as LN -import LeiosDemoTypes (EbHash (..), LeiosEb, LeiosPoint (..), LeiosTx, TraceLeiosKernel, - TraceLeiosPeer, messageLeiosFetchToObject, prettyEbHash, - traceLeiosKernelToObject, traceLeiosPeerToObject) +import LeiosDemoTypes (EbHash (..), LeiosEb, LeiosPoint (..), LeiosTx, LeiosVote, + TraceLeiosKernel, TraceLeiosPeer, messageLeiosFetchToObject, + messageLeiosNotifyToObject, prettyEbHash, traceLeiosKernelToObject, + traceLeiosPeerToObject) -- -- * instances of @HasPrivacyAnnotation@ and @HasSeverityAnnotation@ @@ -2882,38 +2883,12 @@ instance ToJSON PeerTrustable where instance ToJSON EbHash where toJSON = toJSON . prettyEbHash instance ToObject peer - => Transformable Text IO (TraceLabelPeer peer (NtN.TraceSendRecv (LN.LeiosNotify LeiosPoint ()))) where + => Transformable Text IO (TraceLabelPeer peer (NtN.TraceSendRecv (LN.LeiosNotify LeiosPoint () LeiosVote))) where trTransformer = trStructured -instance ToObject (AnyMessage (LN.LeiosNotify LeiosPoint ())) where - toObject _verb (AnyMessageAndAgency _stok msg) = case msg of - - LN.MsgLeiosNotificationRequestNext -> - mconcat [ "kind" .= String "MsgLeiosNotificationRequestNext" - ] - - LN.MsgLeiosBlockAnnouncement () -> - mconcat [ "kind" .= String "MsgLeiosBlockAnnouncement" - ] - LN.MsgLeiosBlockOffer (MkLeiosPoint ebSlot ebHash) ebBytesSize -> - mconcat [ "kind" .= String "MsgLeiosBlockOffer" - , "ebSlot" .= ebSlot - , "ebHash" .= ebHash - , "ebBytesSize" .= ebBytesSize - ] - LN.MsgLeiosBlockTxsOffer (MkLeiosPoint ebSlot ebHash) -> - mconcat [ "kind" .= String "MsgLeiosBlockTxsOffer" - , "ebSlot" .= ebSlot - , "ebHash" .= ebHash - ] - - LN.MsgDone -> - mconcat [ "kind" .= String "MsgDone" - ] - --- where --- agency :: Aeson.Object --- agency = "agency" .= show stok +instance ToObject (AnyMessage (LN.LeiosNotify LeiosPoint () LeiosVote)) where + toObject _verb (AnyMessageAndAgency _stok msg) = + messageLeiosNotifyToObject msg instance ToObject peer => Transformable Text IO (TraceLabelPeer peer (NtN.TraceSendRecv (LF.LeiosFetch LeiosPoint LeiosEb LeiosTx))) where