From b93f61e33c0325fef63b3546ea079f59ce2ff182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20W=C3=B3jtowicz?= Date: Tue, 20 Jan 2026 15:36:57 +0100 Subject: [PATCH 1/2] localstatequery tracing --- dmq-node/src/DMQ/Configuration.hs | 2 +- .../src/DMQ/NodeToClient/LocalStateQueryClient.hs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dmq-node/src/DMQ/Configuration.hs b/dmq-node/src/DMQ/Configuration.hs index fcc6706..5fbcda8 100644 --- a/dmq-node/src/DMQ/Configuration.hs +++ b/dmq-node/src/DMQ/Configuration.hs @@ -275,7 +275,7 @@ defaultConfiguration = Configuration { dmqcSigSubmissionLogicTracer = I True, dmqcLocalMsgSubmissionServerTracer = I True, dmqcLocalMsgNotificationServerTracer = I False, - dmqcLocalStateQueryTracer = I False, + dmqcLocalStateQueryTracer = I True, -- CLI only options dmqcVersion = I False diff --git a/dmq-node/src/DMQ/NodeToClient/LocalStateQueryClient.hs b/dmq-node/src/DMQ/NodeToClient/LocalStateQueryClient.hs index aa5081b..0976fbd 100644 --- a/dmq-node/src/DMQ/NodeToClient/LocalStateQueryClient.hs +++ b/dmq-node/src/DMQ/NodeToClient/LocalStateQueryClient.hs @@ -24,6 +24,7 @@ import Data.Void import Cardano.Chain.Slotting (EpochSlots(..)) import Cardano.Network.NodeToClient import Cardano.Slotting.EpochInfo.API +import Cardano.Slotting.Slot (EpochNo) import Cardano.Slotting.Time import DMQ.Diffusion.NodeKernel import Ouroboros.Consensus.Cardano.Block @@ -47,6 +48,7 @@ import Ouroboros.Network.Protocol.LocalStateQuery.Type -- data TraceLocalStateQueryClient = Acquiring (Maybe SystemStart) + | CurrentEpoch EpochNo | NextEpoch UTCTime NominalDiffTime | PastHorizon PastHorizonException @@ -56,9 +58,13 @@ instance ToJSON TraceLocalStateQueryClient where object [ "kind" .= Aeson.String "Acquiring" , "systemStart" .= show mSystemStart ] + CurrentEpoch epoch -> + object [ "kind" .= Aeson.String "CurrentEpoch" + , "remoteEpoch" .= show epoch + ] NextEpoch ne timer -> object [ "kind" .= Aeson.String "NextEpoch" - , "time" .= show ne + , "remoteTime" .= show ne , "countdown" .= show timer ] PastHorizon e -> object [ "kind" .= Aeson.String "PastHorizon" @@ -115,6 +121,7 @@ cardanoClient tracer StakePools { stakePoolsVar } nextEpochVar = lastSlotLength <- epochInfoSlotLength ei lastSlot pure $ addRelativeTime (getSlotLength lastSlotLength) lastSlotTime + traceWith tracer $ CurrentEpoch epoch case res of Left err -> pure $ SendMsgRelease do @@ -134,7 +141,7 @@ cardanoClient tracer StakePools { stakePoolsVar } nextEpochVar = writeTVar nextEpochVar $ Just nextEpoch toNextEpoch <- diffUTCTime nextEpoch <$> getCurrentTime traceWith tracer $ NextEpoch nextEpoch toNextEpoch - threadDelay $ min (realToFrac toNextEpoch) 86400 -- TODO fuzz this? + threadDelay $ min (max 1 $ realToFrac toNextEpoch) 86400 -- TODO fuzz this? idle $ Just systemStart -- TODO uncomment once this functionality is integrated into cardano-node From 76deae8e895e37912a578f9624ada51924c703ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20W=C3=B3jtowicz?= Date: Tue, 20 Jan 2026 16:46:57 +0100 Subject: [PATCH 2/2] changelog --- ...606_crocodile-dentist_localstatequery_tracing_2.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 dmq-node/changelog.d/20260120_164606_crocodile-dentist_localstatequery_tracing_2.md diff --git a/dmq-node/changelog.d/20260120_164606_crocodile-dentist_localstatequery_tracing_2.md b/dmq-node/changelog.d/20260120_164606_crocodile-dentist_localstatequery_tracing_2.md new file mode 100644 index 0000000..b212ea6 --- /dev/null +++ b/dmq-node/changelog.d/20260120_164606_crocodile-dentist_localstatequery_tracing_2.md @@ -0,0 +1,11 @@ + + + +### Non-Breaking + +- improvements to local state query client tracing