Skip to content

Commit c5d59b9

Browse files
authored
Merge branch 'master' into karknu/adj_trace
2 parents 01b38f4 + be74c97 commit c5d59b9

36 files changed

+740
-311
lines changed

.github/workflows/release-ghcr.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,15 @@ jobs:
9393
echo "Latest release tag is: $LATEST_TAG"
9494
9595
- name: Tagging intersectmbo container latest
96-
if: ${{ github.event.release.tag_name == steps.latest-tag.outputs.LATEST_TAG }}
96+
# Github releases are checked for latest tag in the first `or` operand of
97+
# the if statement. However, promoted pre-releases or changed full
98+
# releases do not count as a `published` event and so won't trigger
99+
# this workflow. For those use cases a manual workflow must be run
100+
# from the matching release tag which the second `or` operand checks
101+
# for.
102+
if: |
103+
(github.event_name == 'release' && github.event.release.tag_name == steps.latest-tag.outputs.LATEST_TAG) ||
104+
(github.event_name == 'workflow_dispatch' && github.ref == format('refs/tags/{0}', steps.latest-tag.outputs.LATEST_TAG))
97105
run: |
98106
echo "::group::Tagging latest for intersectmbo/cardano-node"
99107
skopeo copy docker-archive:./result-node docker://ghcr.io/intersectmbo/cardano-node:latest

cabal.project

+1-2
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-04-16T18:30:40Z
17-
, cardano-haskell-packages 2025-04-22T10:01:33Z
17+
, cardano-haskell-packages 2025-04-29T14:14:35Z
1818

1919
packages:
2020
cardano-node
@@ -90,4 +90,3 @@ if impl (ghc >= 9.12)
9090
-- https://github.com/haskell-servant/servant/pull/1810
9191
, servant:base
9292
, servant-server:base
93-

cardano-node-chairman/cardano-node-chairman.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ executable cardano-node-chairman
4545
, cardano-crypto-class
4646
, cardano-git-rev ^>= 0.2.2
4747
, cardano-ledger-core ^>= 1.17
48-
, cardano-node ^>= 10.3
48+
, cardano-node ^>= 10.4
4949
, cardano-prelude
5050
, containers
5151
, contra-tracer

cardano-node/ChangeLog.md

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
}
3030
```
3131

32+
- KeepAlive client tracing: dropped `KeepAliveClient` from `kind` of
33+
`AddSample` messages in the legacy tracing system.
34+
3235
## 10.2 -- January 2025
3336

3437
- Use p2p network stack by default, warn when using the legacy network stack.

cardano-node/cardano-node.cabal

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.0
22

33
name: cardano-node
4-
version: 10.3.1
4+
version: 10.4.1
55
synopsis: The cardano full node
66
description: The cardano full node.
77
category: Cardano,
@@ -190,7 +190,7 @@ library
190190
, network-mux >= 0.5
191191
, nothunks
192192
, optparse-applicative-fork >= 0.18.1
193-
, ouroboros-consensus ^>= 0.26
193+
, ouroboros-consensus ^>= 0.26.0.1
194194
, ouroboros-consensus-cardano ^>= 0.25
195195
, ouroboros-consensus-diffusion ^>= 0.22
196196
, ouroboros-consensus-protocol

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

+1-39
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,11 @@ import qualified Ouroboros.Network.BlockFetch.ClientState as BlockFetch
6868
import Ouroboros.Network.BlockFetch.Decision
6969
import Ouroboros.Network.BlockFetch.Decision.Trace (TraceDecisionEvent (..))
7070
import Ouroboros.Network.ConnectionId (ConnectionId (..))
71-
import Ouroboros.Network.DeltaQ (GSV (..), PeerGSV (..))
72-
import Ouroboros.Network.KeepAlive (TraceKeepAliveClient (..))
7371
import Ouroboros.Network.SizeInBytes (SizeInBytes (..))
7472
import Ouroboros.Network.TxSubmission.Inbound hiding (txId)
7573
import Ouroboros.Network.TxSubmission.Outbound
7674

7775
import Control.Monad (guard)
78-
import Control.Monad.Class.MonadTime.SI (Time (..))
7976
import Data.Aeson (ToJSON, Value (Number, String), toJSON, (.=))
8077
import qualified Data.Aeson as Aeson
8178
import Data.Foldable (Foldable (toList))
@@ -84,7 +81,7 @@ import Data.IntPSQ (IntPSQ)
8481
import qualified Data.IntPSQ as Pq
8582
import qualified Data.List as List
8683
import qualified Data.Text as Text
87-
import Data.Time (DiffTime, NominalDiffTime)
84+
import Data.Time (NominalDiffTime)
8885
import Data.Word (Word32, Word64)
8986
import Network.TypedProtocol.Core
9087

@@ -2163,41 +2160,6 @@ instance MetaTrace (TraceBlockchainTimeEvent t) where
21632160
, Namespace [] ["SystemClockMovedBack"]
21642161
]
21652162

2166-
--------------------------------------------------------------------------------
2167-
-- KeepAliveClient Tracer
2168-
--------------------------------------------------------------------------------
2169-
2170-
instance Show remotePeer => LogFormatting (TraceKeepAliveClient remotePeer) where
2171-
forMachine _dtal (AddSample peer rtt pgsv) =
2172-
mconcat
2173-
[ "kind" .= String "AddSample"
2174-
, "address" .= show peer
2175-
, "rtt" .= rtt
2176-
, "sampleTime" .= show (dTime $ sampleTime pgsv)
2177-
, "outboundG" .= (realToFrac $ gGSV (outboundGSV pgsv) :: Double)
2178-
, "inboundG" .= (realToFrac $ gGSV (inboundGSV pgsv) :: Double)
2179-
]
2180-
where
2181-
gGSV :: GSV -> DiffTime
2182-
gGSV (GSV g _ _) = g
2183-
2184-
dTime :: Time -> Double
2185-
dTime (Time d) = realToFrac d
2186-
2187-
forHuman = showT
2188-
2189-
instance MetaTrace (TraceKeepAliveClient remotePeer) where
2190-
namespaceFor AddSample {} = Namespace [] ["KeepAliveClient"]
2191-
2192-
severityFor (Namespace _ ["KeepAliveClient"]) Nothing = Just Info
2193-
severityFor _ _ = Nothing
2194-
2195-
documentFor (Namespace _ ["KeepAliveClient"]) = Just
2196-
"A server read has occurred, either for an add block or a rollback"
2197-
documentFor _ = Just ""
2198-
2199-
allNamespaces = [Namespace [] ["KeepAliveClient"]]
2200-
22012163
--------------------------------------------------------------------------------
22022164
-- Gsm Tracer
22032165
--------------------------------------------------------------------------------

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

+39
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,18 @@ import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, HasTxId, Has
2020
LedgerSupportsMempool, extractTxs, txId)
2121
import Ouroboros.Consensus.Node.Run (SerialiseNodeToNodeConstraints, estimateBlockSize)
2222
import Ouroboros.Network.Block (Point, Serialised (..), blockHash)
23+
import Ouroboros.Network.DeltaQ (GSV (..), PeerGSV (..))
24+
import Ouroboros.Network.KeepAlive (TraceKeepAliveClient (..))
2325
import Ouroboros.Network.Protocol.BlockFetch.Type (BlockFetch (..), Message (..))
2426
import qualified Ouroboros.Network.Protocol.TxSubmission2.Type as STX
2527
import qualified Ouroboros.Network.Protocol.KeepAlive.Type as KA
2628
import qualified Ouroboros.Network.Protocol.PeerSharing.Type as PS
2729
import Ouroboros.Network.SizeInBytes (SizeInBytes (..))
2830

31+
import Control.Monad.Class.MonadTime.SI (Time (..))
2932
import Data.Aeson (ToJSON (..), Value (String), (.=))
3033
import Data.Proxy (Proxy (..))
34+
import Data.Time (DiffTime)
3135
import Data.Text (pack)
3236
import Network.TypedProtocol.Codec (AnyMessage (AnyMessageAndAgency))
3337

@@ -427,3 +431,38 @@ instance MetaTrace (AnyMessage (PS.PeerSharing addr)) where
427431
, Namespace [] ["PeerShareResult"]
428432
, Namespace [] ["PeerShareDone"]
429433
]
434+
435+
--------------------------------------------------------------------------------
436+
-- KeepAliveClient Tracer
437+
--------------------------------------------------------------------------------
438+
439+
instance Show remotePeer => LogFormatting (TraceKeepAliveClient remotePeer) where
440+
forMachine _dtal (AddSample peer rtt pgsv) =
441+
mconcat
442+
[ "kind" .= String "AddSample"
443+
, "address" .= show peer
444+
, "rtt" .= rtt
445+
, "sampleTime" .= show (dTime $ sampleTime pgsv)
446+
, "outboundG" .= (realToFrac $ gGSV (outboundGSV pgsv) :: Double)
447+
, "inboundG" .= (realToFrac $ gGSV (inboundGSV pgsv) :: Double)
448+
]
449+
where
450+
gGSV :: GSV -> DiffTime
451+
gGSV (GSV g _ _) = g
452+
453+
dTime :: Time -> Double
454+
dTime (Time d) = realToFrac d
455+
456+
forHuman = showT
457+
458+
instance MetaTrace (TraceKeepAliveClient remotePeer) where
459+
namespaceFor AddSample {} = Namespace [] ["KeepAliveClient"]
460+
461+
severityFor (Namespace _ ["KeepAliveClient"]) Nothing = Just Info
462+
severityFor _ _ = Nothing
463+
464+
documentFor (Namespace _ ["KeepAliveClient"]) = Just
465+
"A server read has occurred, either for an add block or a rollback"
466+
documentFor _ = Just ""
467+
468+
allNamespaces = [Namespace [] ["KeepAliveClient"]]

cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ instance (Show txid, Show tx)
15261526
instance Show remotePeer => ToObject (TraceKeepAliveClient remotePeer) where
15271527
toObject _verb (AddSample peer rtt pgsv) =
15281528
mconcat
1529-
[ "kind" .= String "KeepAliveClient AddSample"
1529+
[ "kind" .= String "AddSample"
15301530
, "address" .= show peer
15311531
, "rtt" .= rtt
15321532
, "sampleTime" .= show (dTime $ sampleTime pgsv)

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

+12-13
Original file line numberDiff line numberDiff line change
@@ -1564,18 +1564,17 @@ traceConnectionManagerTraceMetrics (OnOff True) (Just ekgDirect) = cmtTracer
15641564
where
15651565
cmtTracer :: Tracer IO (ConnectionManager.Trace peerAddr handlerTrace)
15661566
cmtTracer = Tracer $ \case
1567-
(ConnectionManager.TrConnectionManagerCounters
1568-
(ConnectionManagerCounters
1569-
prunableConns
1570-
duplexConns
1571-
unidirectionalConns
1572-
incomingConns
1573-
outgoingConns
1574-
)
1575-
) -> do
1567+
ConnectionManager.TrConnectionManagerCounters
1568+
ConnectionManagerCounters {
1569+
fullDuplexConns,
1570+
duplexConns,
1571+
unidirectionalConns,
1572+
inboundConns,
1573+
outboundConns
1574+
} -> do
15761575
sendEKGDirectInt ekgDirect
1577-
"cardano.node.metrics.connectionManager.prunableConns"
1578-
prunableConns
1576+
"cardano.node.metrics.connectionManager.fullDuplexConns"
1577+
fullDuplexConns
15791578
sendEKGDirectInt ekgDirect
15801579
"cardano.node.metrics.connectionManager.duplexConns"
15811580
duplexConns
@@ -1584,10 +1583,10 @@ traceConnectionManagerTraceMetrics (OnOff True) (Just ekgDirect) = cmtTracer
15841583
unidirectionalConns
15851584
sendEKGDirectInt ekgDirect
15861585
"cardano.node.metrics.connectionManager.incomingConns"
1587-
incomingConns
1586+
inboundConns
15881587
sendEKGDirectInt ekgDirect
15891588
"cardano.node.metrics.connectionManager.outgoingConns"
1590-
outgoingConns
1589+
outboundConns
15911590
_ -> return ()
15921591

15931592

cardano-testnet/cardano-testnet.cabal

+3-2
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,13 @@ test-suite cardano-testnet-test
185185

186186
main-is: cardano-testnet-test.hs
187187

188-
other-modules: Cardano.Testnet.Test.Cli.Conway.Plutus
189-
Cardano.Testnet.Test.Cli.Conway.StakeSnapshot
188+
other-modules: Cardano.Testnet.Test.Cli.Conway.StakeSnapshot
190189
Cardano.Testnet.Test.Cli.KesPeriodInfo
191190
Cardano.Testnet.Test.Cli.LeadershipSchedule
192191
Cardano.Testnet.Test.Cli.Query
193192
Cardano.Testnet.Test.Cli.QuerySlotNumber
193+
Cardano.Testnet.Test.Cli.Plutus.Scripts
194+
Cardano.Testnet.Test.Cli.Plutus.CostCalculation
194195
Cardano.Testnet.Test.Cli.StakeSnapshot
195196
Cardano.Testnet.Test.Cli.Transaction
196197
Cardano.Testnet.Test.Cli.Transaction.RegisterDeregisterStakeAddress

cardano-testnet/src/Testnet/Components/Query.hs

+19-2
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,31 @@ module Testnet.Components.Query
3939
, getGovActionLifetime
4040
, getKeyDeposit
4141
, getDelegationState
42+
, getTxIx
4243
) where
4344

4445
import Cardano.Api as Api
4546
import Cardano.Api.Ledger (Credential, DRepState, EpochInterval (..), KeyRole (DRepRole))
4647
import Cardano.Api.Shelley (ShelleyLedgerEra)
48+
import qualified Cardano.Api.Ledger as L
4749

50+
import Cardano.Crypto.Hash (hashToStringAsHex)
4851
import Cardano.Ledger.Api (ConwayGovState)
4952
import qualified Cardano.Ledger.Api as L
50-
import qualified Cardano.Ledger.Coin as L
5153
import qualified Cardano.Ledger.Conway.Governance as L
5254
import qualified Cardano.Ledger.Conway.PParams as L
5355
import qualified Cardano.Ledger.Shelley.LedgerState as L
5456
import qualified Cardano.Ledger.UMap as L
5557

58+
import Prelude
59+
5660
import Control.Exception.Safe (MonadCatch)
5761
import Control.Monad
5862
import Control.Monad.Trans.Resource
5963
import Control.Monad.Trans.State.Strict (put)
6064
import Data.IORef
6165
import Data.List (sortOn)
66+
import qualified Data.Map as Map
6267
import Data.Map.Strict (Map)
6368
import qualified Data.Map.Strict as M
6469
import Data.Maybe
@@ -74,10 +79,10 @@ import Lens.Micro (Lens', to, (^.))
7479
import Testnet.Property.Assert
7580
import Testnet.Types
7681

82+
import Hedgehog
7783
import qualified Hedgehog as H
7884
import Hedgehog.Extras (MonadAssertion)
7985
import qualified Hedgehog.Extras as H
80-
import Hedgehog.Internal.Property (MonadTest)
8186

8287
-- | Block and wait for the desired epoch.
8388
waitUntilEpoch
@@ -592,3 +597,15 @@ getDelegationState epochStateView = do
592597
. L.dsUnifiedL
593598

594599
pure $ L.toStakeCredentials pools
600+
601+
-- | Returns the transaction index of a transaction with a given amount and ID.
602+
getTxIx :: forall m era. HasCallStack => MonadTest m => ShelleyBasedEra era -> String -> L.Coin -> (AnyNewEpochState, SlotNo, BlockNo) -> m (Maybe Int)
603+
getTxIx sbe txId amount (AnyNewEpochState sbe' _ tbs, _, _) = do
604+
Refl <- H.leftFail $ assertErasEqual sbe sbe'
605+
shelleyBasedEraConstraints sbe' $ do
606+
return $ Map.foldlWithKey (\acc (TxIn (TxId thisTxId) (TxIx thisTxIx)) (TxOut _ txOutValue _ _) ->
607+
case acc of
608+
Nothing | hashToStringAsHex thisTxId == txId &&
609+
txOutValueToLovelace txOutValue == amount -> Just $ fromIntegral thisTxIx
610+
| otherwise -> Nothing
611+
x -> x) Nothing $ getLedgerTablesUTxOValues sbe' tbs

0 commit comments

Comments
 (0)