Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
For top level release notes, leave all the headers commented out.
-->


### Non-Breaking

- improvements to local state query client tracing
2 changes: 1 addition & 1 deletion dmq-node/src/DMQ/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions dmq-node/src/DMQ/NodeToClient/LocalStateQueryClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,6 +48,7 @@ import Ouroboros.Network.Protocol.LocalStateQuery.Type
--
data TraceLocalStateQueryClient =
Acquiring (Maybe SystemStart)
| CurrentEpoch EpochNo
| NextEpoch UTCTime NominalDiffTime
| PastHorizon PastHorizonException

Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down