Skip to content

Commit ad38e9b

Browse files
committed
Bump consensus version
1 parent c6f48e8 commit ad38e9b

File tree

7 files changed

+209
-50
lines changed

7 files changed

+209
-50
lines changed

cabal.project

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repository cardano-haskell-packages
1414
-- you need to run if you change them
1515
index-state:
1616
, hackage.haskell.org 2025-09-24T20:00:55Z
17-
, cardano-haskell-packages 2025-09-24T15:29:30Z
17+
, cardano-haskell-packages 2025-09-30T09:59:24Z
1818

1919
packages:
2020
cardano-node
@@ -91,21 +91,7 @@ source-repository-package
9191
source-repository-package
9292
type: git
9393
location: https://github.com/IntersectMBO/cardano-api
94-
tag: 7388805c2a56e2f628ca46924c648268cc61bbd2
95-
--sha256: sha256-YdFyulwmlwLDjVd6Bk+8IxQAdBSRCpacL5HzW3aCb7c=
94+
tag: cee9b20505a407b55f3b7b335e857d61d71ae196
95+
--sha256: sha256-ijMOji6MNupx6eewRJcWpuoxitp4rw8nnccr/Ay+tTo=
9696
subdir:
9797
cardano-api
98-
99-
source-repository-package
100-
type: git
101-
location: https://github.com/IntersectMBO/ouroboros-consensus
102-
-- latest master
103-
tag: ac1a8db76f4c7a38a9a6b962a40fa722d5bd55a6
104-
--sha256: sha256-8MlAxCi1wXLc2p0csYTKZ4RW7+uqWvxOBs5IhISzwxk=
105-
subdir:
106-
ouroboros-consensus
107-
ouroboros-consensus-cardano
108-
ouroboros-consensus-diffusion
109-
ouroboros-consensus-protocol
110-
sop-extras
111-
strict-sop-core

cardano-node/cardano-node.cabal

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ library
175175
, hostname
176176
, io-classes:{io-classes,strict-stm,si-timers} >= 1.5
177177
, iohk-monitoring ^>= 0.2
178+
, kes-agent ^>=0.2
178179
, microlens
179180
, mmap
180181
, network-mux
@@ -188,9 +189,9 @@ library
188189
, network-mux >= 0.8
189190
, nothunks
190191
, optparse-applicative-fork >= 0.18.1
191-
, ouroboros-consensus ^>= 0.27
192-
, ouroboros-consensus-cardano ^>= 0.25
193-
, ouroboros-consensus-diffusion ^>= 0.23
192+
, ouroboros-consensus ^>= 0.28
193+
, ouroboros-consensus-cardano ^>= 0.26
194+
, ouroboros-consensus-diffusion ^>= 0.24
194195
, ouroboros-consensus-protocol
195196
, ouroboros-network-api ^>= 0.16
196197
, ouroboros-network:{ouroboros-network, cardano-diffusion, orphan-instances} ^>= 0.22.3

cardano-node/src/Cardano/Node/Run.hs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import qualified Ouroboros.Consensus.Config as Consensus
7070
import Ouroboros.Consensus.Config.SupportsNode (ConfigSupportsNode (..))
7171
import Ouroboros.Consensus.Node (SnapshotPolicyArgs (..),
7272
NodeDatabasePaths (..), RunNodeArgs (..), StdRunNodeArgs (..))
73+
import Ouroboros.Consensus.Protocol.Praos.AgentClient (KESAgentClientTrace)
7374
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTxId)
7475
import Ouroboros.Consensus.Node (RunNodeArgs (..),
7576
SnapshotPolicyArgs (..), StdRunNodeArgs (..))
@@ -241,23 +242,20 @@ handleNodeWithTracers cmdPc nc p@(SomeConsensusProtocol blockType runP) = do
241242
(getLast (pncConfigFile cmdPc))
242243
case ncTraceConfig nc of
243244
TraceDispatcher{} -> do
244-
-- TODO fix
245-
blockForging <- snd (Api.protocolInfo runP)
245+
blockForging <- snd (Api.protocolInfo runP) nullTracer
246246
tracers <-
247247
initTraceDispatcher
248248
nc
249249
p
250250
networkMagic
251251
nodeKernelData
252-
-- TODO fix
253252
(null blockForging)
254253

255254
startupInfo <- getStartupInfo nc p fp
256255
mapM_ (traceWith $ startupTracer tracers) startupInfo
257256
traceNodeStartupInfo (nodeStartupInfoTracer tracers) startupInfo
258257
-- sends initial BlockForgingUpdate
259258
let isNonProducing = ncStartAsNonProducingNode nc
260-
-- TODO fix
261259
traceWith (startupTracer tracers)
262260
(BlockForgingUpdate (if isNonProducing || null blockForging
263261
then DisabledBlockForging
@@ -301,8 +299,7 @@ handleNodeWithTracers cmdPc nc p@(SomeConsensusProtocol blockType runP) = do
301299

302300
traceWith (nodeVersionTracer tracers) getNodeVersion
303301
let isNonProducing = ncStartAsNonProducingNode nc
304-
-- TODO fix
305-
blockForging <- snd (Api.protocolInfo runP)
302+
blockForging <- snd (Api.protocolInfo runP) nullTracer
306303
traceWith (startupTracer tracers)
307304
(BlockForgingUpdate (if isNonProducing || null blockForging
308305
then DisabledBlockForging
@@ -472,8 +469,7 @@ handleSimpleNode blockType runP tracers nc onKernel = do
472469
, rnProtocolInfo = pInfo
473470
, rnNodeKernelHook = \registry nodeKernel -> do
474471
-- set the initial block forging
475-
-- TODO fix
476-
blockForging <- snd (Api.protocolInfo runP)
472+
blockForging <- snd (Api.protocolInfo runP) (Consensus.kesAgentTracer $ consensusTracers tracers)
477473

478474
unless (ncStartAsNonProducingNode nc) $
479475
setBlockForging nodeKernel blockForging
@@ -546,7 +542,7 @@ handleSimpleNode blockType runP tracers nc onKernel = do
546542
nodeArgs {
547543
rnNodeKernelHook = \registry nodeKernel -> do
548544
-- reinstall `SIGHUP` handler
549-
installSigHUPHandler (startupTracer tracers) blockType nc nodeKernel
545+
installSigHUPHandler (startupTracer tracers) (Consensus.kesAgentTracer $ consensusTracers tracers) blockType nc nodeKernel
550546
localRootsVar publicRootsVar useLedgerVar useBootstrapVar
551547
ledgerPeerSnapshotPathVar ledgerPeerSnapshotVar
552548
rnNodeKernelHook nodeArgs registry nodeKernel
@@ -639,6 +635,7 @@ handleSimpleNode blockType runP tracers nc onKernel = do
639635
-- | The P2P SIGHUP handler can update block forging & reconfigure network topology.
640636
--
641637
installSigHUPHandler :: Tracer IO (StartupTrace blk)
638+
-> Tracer IO KESAgentClientTrace
642639
-> Api.BlockType blk
643640
-> NodeConfiguration
644641
-> NodeKernel IO RemoteAddress (ConnectionId LocalAddress) blk
@@ -650,14 +647,14 @@ installSigHUPHandler :: Tracer IO (StartupTrace blk)
650647
-> StrictTVar IO (Maybe LedgerPeerSnapshot)
651648
-> IO ()
652649
#ifndef UNIX
653-
installSigHUPHandler _ _ _ _ _ _ _ _ _ _ = return ()
650+
installSigHUPHandler _ _ _ _ _ _ _ _ _ _ _ = return ()
654651
#else
655-
installSigHUPHandler startupTracer blockType nc nodeKernel localRootsVar publicRootsVar useLedgerVar
652+
installSigHUPHandler startupTracer kesAgentTracer blockType nc nodeKernel localRootsVar publicRootsVar useLedgerVar
656653
useBootstrapPeersVar ledgerPeerSnapshotPathVar ledgerPeerSnapshotVar =
657654
void $ Signals.installHandler
658655
Signals.sigHUP
659656
(Signals.Catch $ do
660-
updateBlockForging startupTracer blockType nodeKernel nc
657+
updateBlockForging startupTracer kesAgentTracer blockType nodeKernel nc
661658
updateTopologyConfiguration startupTracer nc localRootsVar publicRootsVar
662659
useLedgerVar useBootstrapPeersVar ledgerPeerSnapshotPathVar
663660
void $ updateLedgerPeerSnapshot
@@ -673,11 +670,12 @@ installSigHUPHandler startupTracer blockType nc nodeKernel localRootsVar publicR
673670

674671
#ifdef UNIX
675672
updateBlockForging :: Tracer IO (StartupTrace blk)
673+
-> Tracer IO KESAgentClientTrace
676674
-> Api.BlockType blk
677675
-> NodeKernel IO RemoteAddress (ConnectionId LocalAddress) blk
678676
-> NodeConfiguration
679677
-> IO ()
680-
updateBlockForging startupTracer blockType nodeKernel nc = do
678+
updateBlockForging startupTracer kesAgentTracer blockType nodeKernel nc = do
681679
eitherSomeProtocol <- runExceptT $ mkConsensusProtocol
682680
(ncProtocolConfig nc)
683681
(Just (ncProtocolFiles nc))
@@ -693,8 +691,7 @@ updateBlockForging startupTracer blockType nodeKernel nc = do
693691
case Api.reflBlockType blockType blockType' of
694692
Just Refl -> do
695693
-- TODO: check if runP' has changed
696-
-- TODO fix
697-
blockForging <- snd (Api.protocolInfo runP')
694+
blockForging <- snd (Api.protocolInfo runP') kesAgentTracer
698695
traceWith startupTracer
699696
(BlockForgingUpdate (if null blockForging
700697
then DisabledBlockForging

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ mkConsensusTracers configReflection trBase trForward mbTrEKG _trDataPoint trConf
333333
["Consensus", "CSJ"]
334334
configureTracers configReflection trConfig [consensusCsjTr]
335335

336+
!consensusKesAgentTr <- mkCardanoTracer
337+
trBase trForward mbTrEKG
338+
["Consensus", "KESAgent"]
339+
configureTracers configReflection trConfig [consensusKesAgentTr]
340+
336341
!consensusDbfTr <- mkCardanoTracer
337342
trBase trForward mbTrEKG
338343
["Consensus", "DevotedBlockFetch"]
@@ -384,6 +389,8 @@ mkConsensusTracers configReflection trBase trForward mbTrEKG _trDataPoint trConf
384389
traceWith consensusCsjTr
385390
, Consensus.dbfTracer = Tracer $
386391
traceWith consensusDbfTr
392+
, Consensus.kesAgentTracer = Tracer $
393+
traceWith consensusKesAgentTr
387394
}
388395

389396
mkNodeToClientTracers :: forall blk.

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

Lines changed: 132 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ import Ouroboros.Network.ConnectionId (ConnectionId (..))
6868
import Ouroboros.Network.SizeInBytes (SizeInBytes (..))
6969
import Ouroboros.Network.TxSubmission.Inbound hiding (txId)
7070
import Ouroboros.Network.TxSubmission.Outbound
71+
import qualified Cardano.KESAgent.Processes.ServiceClient as Agent
7172

72-
import Control.Exception
7373
import Control.Monad (guard)
7474
import Data.Aeson (ToJSON, Value (..), toJSON, (.=))
7575
import qualified Data.Aeson as Aeson
@@ -2305,12 +2305,135 @@ instance ( StandardHash blk
23052305
KES-agent
23062306
-------------------------------------------------------------------------------}
23072307

2308+
--------------------------------------------------------------------------------
2309+
-- KES Agent tracer
2310+
--------------------------------------------------------------------------------
2311+
2312+
instance LogFormatting Agent.ServiceClientTrace where
2313+
forMachine _dtal = \case
2314+
Agent.ServiceClientVersionHandshakeTrace _vhdt ->
2315+
mconcat [ "kind" .= String "ServiceClientVersionHandshakeTrace" ]
2316+
Agent.ServiceClientVersionHandshakeFailed ->
2317+
mconcat [ "kind" .= String "ServiceClientVersionHandshakeFailed" ]
2318+
Agent.ServiceClientDriverTrace _sdt ->
2319+
mconcat [ "kind" .= String "ServiceClientDriverTrace" ]
2320+
Agent.ServiceClientSocketClosed ->
2321+
mconcat [ "kind" .= String "ServiceClientSocketClosed" ]
2322+
Agent.ServiceClientConnected _s ->
2323+
mconcat [ "kind" .= String "ServiceClientConnected" ]
2324+
Agent.ServiceClientAttemptReconnect{} ->
2325+
mconcat [ "kind" .= String "ServiceClientAttemptReconnect" ]
2326+
Agent.ServiceClientReceivedKey _tbt ->
2327+
mconcat [ "kind" .= String "ServiceClientReceivedKey" ]
2328+
Agent.ServiceClientDeclinedKey _tbt ->
2329+
mconcat [ "kind" .= String "ServiceClientDeclinedKey" ]
2330+
Agent.ServiceClientDroppedKey ->
2331+
mconcat [ "kind" .= String "ServiceClientDroppedKey" ]
2332+
Agent.ServiceClientOpCertNumberCheck _ _ ->
2333+
mconcat [ "kind" .= String "ServiceClientOpCertNumberCheck" ]
2334+
Agent.ServiceClientAbnormalTermination _s ->
2335+
mconcat [ "kind" .= String "ServiceClientAbnormalTermination" ]
2336+
Agent.ServiceClientStopped ->
2337+
mconcat [ "kind" .= String "ServiceClientStopped" ]
2338+
2339+
forHuman = showT
2340+
2341+
instance MetaTrace Agent.ServiceClientTrace where
2342+
namespaceFor = \case
2343+
Agent.ServiceClientVersionHandshakeTrace _vhdt ->
2344+
Namespace [] ["ServiceClientVersionHandshakeTrace"]
2345+
Agent.ServiceClientVersionHandshakeFailed ->
2346+
Namespace [] ["ServiceClientVersionHandshakeFailed"]
2347+
Agent.ServiceClientDriverTrace _sdt ->
2348+
Namespace [] ["ServiceClientDriverTrace"]
2349+
Agent.ServiceClientSocketClosed ->
2350+
Namespace [] ["ServiceClientSocketClosed"]
2351+
Agent.ServiceClientConnected _s ->
2352+
Namespace [] ["ServiceClientConnected"]
2353+
Agent.ServiceClientAttemptReconnect{} ->
2354+
Namespace [] ["ServiceClientAttemptReconnect"]
2355+
Agent.ServiceClientReceivedKey _tbt ->
2356+
Namespace [] ["ServiceClientReceivedKey"]
2357+
Agent.ServiceClientDeclinedKey _tbt ->
2358+
Namespace [] ["ServiceClientDeclinedKey"]
2359+
Agent.ServiceClientDroppedKey ->
2360+
Namespace [] ["ServiceClientDroppedKey"]
2361+
Agent.ServiceClientOpCertNumberCheck _ _ ->
2362+
Namespace [] ["ServiceClientOpCertNumberCheck"]
2363+
Agent.ServiceClientAbnormalTermination _s ->
2364+
Namespace [] ["ServiceClientAbnormalTermination"]
2365+
Agent.ServiceClientStopped ->
2366+
Namespace [] ["ServiceClientStopped"]
2367+
2368+
severityFor ns _ = case ns of
2369+
Namespace [] ["ServiceClientVersionHandshakeTrace"] ->
2370+
Just Debug
2371+
Namespace [] ["ServiceClientVersionHandshakeFailed"] ->
2372+
Just Error
2373+
Namespace [] ["ServiceClientDriverTrace"] ->
2374+
Just Debug
2375+
Namespace [] ["ServiceClientSocketClosed"] ->
2376+
Just Info
2377+
Namespace [] ["ServiceClientConnected"] ->
2378+
Just Info
2379+
Namespace [] ["ServiceClientAttemptReconnect"] ->
2380+
Just Info
2381+
Namespace [] ["ServiceClientReceivedKey"] ->
2382+
Just Info
2383+
Namespace [] ["ServiceClientDeclinedKey"] ->
2384+
Just Info
2385+
Namespace [] ["ServiceClientDroppedKey"] ->
2386+
Just Info
2387+
Namespace [] ["ServiceClientOpCertNumberCheck"] ->
2388+
Just Debug
2389+
Namespace [] ["ServiceClientAbnormalTermination"] ->
2390+
Just Error
2391+
Namespace [] ["ServiceClientStopped"] ->
2392+
Just Info
2393+
Namespace _ _ -> Nothing
2394+
2395+
documentFor _ = Nothing
2396+
allNamespaces =
2397+
[ Namespace [] ["ServiceClientVersionHandshakeTrace"]
2398+
, Namespace [] ["ServiceClientVersionHandshakeFailed"]
2399+
, Namespace [] ["ServiceClientDriverTrace"]
2400+
, Namespace [] ["ServiceClientSocketClosed"]
2401+
, Namespace [] ["ServiceClientConnected"]
2402+
, Namespace [] ["ServiceClientAttemptReconnect"]
2403+
, Namespace [] ["ServiceClientReceivedKey"]
2404+
, Namespace [] ["ServiceClientDeclinedKey"]
2405+
, Namespace [] ["ServiceClientDroppedKey"]
2406+
, Namespace [] ["ServiceClientOpCertNumberCheck"]
2407+
, Namespace [] ["ServiceClientAbnormalTermination"]
2408+
, Namespace [] ["ServiceClientStopped"]
2409+
]
2410+
23082411
instance LogFormatting KESAgentClientTrace where
2309-
forMachine _verb (KESAgentClientException exc) =
2310-
mconcat [ "kind" .= String "KESAgentClientException"
2311-
, "exception" .= String (Text.pack $ displayException exc)
2312-
]
2313-
forMachine _verb (KESAgentClientTrace trc) =
2314-
mconcat [ "kind" .= String "KESAgentClientTrace"
2315-
, "trace" .= String (Text.pack $ show trc)
2316-
]
2412+
forMachine dtal = \case
2413+
KESAgentClientException ex -> mconcat
2414+
[ "kind" .= String "KESAgentClientException"
2415+
, "exception" .= String (Text.pack $ show ex)
2416+
]
2417+
KESAgentClientTrace t -> mconcat
2418+
[ "kind" .= String "KESAgentClientTrace"
2419+
, "trace" .= forMachine dtal t
2420+
]
2421+
2422+
forHuman = showT
2423+
2424+
2425+
instance MetaTrace KESAgentClientTrace where
2426+
namespaceFor = \case
2427+
KESAgentClientException _ ->
2428+
Namespace [] ["KESAgentClientException"]
2429+
KESAgentClientTrace t -> nsCast $ namespaceFor t
2430+
2431+
severityFor (Namespace [] ["KESAgentClientException"]) _ = Just Error
2432+
severityFor (Namespace [] ["KESAgentClientTrace"]) _ = Just Info
2433+
severityFor _ _ = Nothing
2434+
2435+
documentFor _ = Nothing
2436+
2437+
allNamespaces =
2438+
Namespace [] ["KESAgentClientException"] :
2439+
fmap nsCast (allNamespaces :: [Namespace Agent.ServiceClientTrace])

0 commit comments

Comments
 (0)