Skip to content

Commit 0f388d2

Browse files
authored
Merge pull request IntersectMBO#5409 from input-output-hk/bolt12/update-network
Bump network packages version
2 parents 5006b56 + 05c0392 commit 0f388d2

File tree

22 files changed

+125
-56
lines changed

22 files changed

+125
-56
lines changed

bench/locli/locli.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ library
120120
, optparse-generic
121121
, ouroboros-consensus
122122
-- for Data.SOP.Strict:
123-
, ouroboros-network ^>= 0.8.1.0
123+
, ouroboros-network ^>= 0.8.2.0
124124
, ouroboros-network-api
125125
, process
126126
, quiet

bench/tx-generator/tx-generator.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ library
126126
, ouroboros-consensus >= 0.6
127127
, ouroboros-consensus-cardano >= 0.5
128128
, ouroboros-consensus-diffusion >= 0.7.0
129-
, ouroboros-network ^>= 0.8.1.0
129+
, ouroboros-network ^>= 0.8.2.0
130130
, ouroboros-network-api
131131
, ouroboros-network-framework
132132
, ouroboros-network-protocols

cabal.project

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ repository cardano-haskell-packages
1313
-- See CONTRIBUTING for information about these, including some Nix commands
1414
-- you need to run if you change them
1515
index-state:
16-
, hackage.haskell.org 2023-07-10T14:55:34Z
17-
, cardano-haskell-packages 2023-07-16T00:00:00Z
16+
, hackage.haskell.org 2023-07-21T10:12:20Z
17+
, cardano-haskell-packages 2023-07-21T12:48:43Z
1818

1919
packages:
2020
cardano-client-demo
@@ -102,7 +102,9 @@ write-ghc-environment-files: always
102102
package snap-server
103103
flags: +openssl
104104

105-
allow-newer: text
105+
allow-newer:
106+
text,
107+
ekg-forward
106108

107109
constraints:
108110
optparse-applicative >= 0.16.0 && < 0.16.1,

cardano-node/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
`TraceLocalHandshake`, `TraceLocalInboundGovernor`, `TraceLocalServer` and
99
`TraceServer`.
1010

11+
- Added `hotValency` optional to P2P Topology files, keeping the backwards compatible
12+
`valency` flag.
13+
- Added `warmValency` optional to P2P Topology files.
14+
1115
## 8.1.0
1216

1317
-

cardano-node/cardano-node.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ library
180180
, ouroboros-consensus-diffusion >= 0.7
181181
, ouroboros-consensus-protocol >= 0.5
182182
, ouroboros-network-api
183-
, ouroboros-network ^>= 0.8.1.1
184-
, ouroboros-network-framework >= 0.6
183+
, ouroboros-network ^>= 0.8.2.0
184+
, ouroboros-network-framework >= 0.7
185185
, ouroboros-network-protocols
186186
, prettyprinter
187187
, prettyprinter-ansi-terminal
@@ -249,7 +249,7 @@ test-suite cardano-node-test
249249
, ouroboros-consensus >= 0.9
250250
, ouroboros-consensus-cardano
251251
, ouroboros-consensus-diffusion >= 0.7
252-
, ouroboros-network ^>= 0.8.1.1
252+
, ouroboros-network ^>= 0.8.2.0
253253
, ouroboros-network-api
254254
, text >= 2.0
255255
, time

cardano-node/src/Cardano/Node/Configuration/TopologyP2P.hs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ import Cardano.Node.Configuration.Topology (TopologyError (..))
4343
import Cardano.Node.Startup (StartupTrace (..))
4444
import Cardano.Node.Types
4545

46+
import Cardano.Tracing.OrphanInstances.Network ()
47+
import Control.Applicative (Alternative (..))
4648
import Ouroboros.Network.NodeToNode (PeerAdvertise (..))
4749
import Ouroboros.Network.PeerSelection.LedgerPeers (UseLedgerAfter (..))
50+
import Ouroboros.Network.PeerSelection.LocalRootPeers (HotValency (..), WarmValency (..))
4851
import Ouroboros.Network.PeerSelection.RelayAccessPoint (RelayAccessPoint (..))
4952

5053
data NodeSetup = NodeSetup
@@ -112,28 +115,35 @@ rootConfigToRelayAccessPoint RootConfig { rootAccessPoints, rootAdvertise } =
112115

113116
-- | A local root peers group. Local roots are treated by the outbound
114117
-- governor in a special way. The node will make sure that a node has the
115-
-- requested number ('valency') of connections to the local root peer group.
118+
-- requested number ('valency'/'hotValency') of connections to the local root peer group.
119+
-- 'warmValency' value is the value of warm/established connections that the node
120+
-- will attempt to maintain. By default this value will be equal to 'hotValency'.
116121
--
117122
data LocalRootPeersGroup = LocalRootPeersGroup
118123
{ localRoots :: RootConfig
119-
, valency :: Int
124+
, hotValency :: HotValency
125+
, warmValency :: WarmValency
120126
} deriving (Eq, Show)
121127

122128
-- | Does not use the 'FromJSON' instance of 'RootConfig', so that
123-
-- 'accessPoints', 'advertise' and 'valency' fields are attached to the same
124-
-- object.
129+
-- 'accessPoints', 'advertise', 'valency' and 'warmValency' fields are attached to the
130+
-- same object.
125131
instance FromJSON LocalRootPeersGroup where
126-
parseJSON = withObject "LocalRootPeersGroup" $ \o ->
132+
parseJSON = withObject "LocalRootPeersGroup" $ \o -> do
133+
hv@(HotValency v) <- o .: "valency"
134+
<|> o .: "hotValency"
127135
LocalRootPeersGroup
128136
<$> parseJSON (Object o)
129-
<*> o .: "valency"
137+
<*> pure hv
138+
<*> o .:? "warmValency" .!= WarmValency v
130139

131140
instance ToJSON LocalRootPeersGroup where
132141
toJSON lrpg =
133142
object
134143
[ "accessPoints" .= rootAccessPoints (localRoots lrpg)
135144
, "advertise" .= rootAdvertise (localRoots lrpg)
136-
, "valency" .= valency lrpg
145+
, "hotValency" .= hotValency lrpg
146+
, "warmValency" .= warmValency lrpg
137147
]
138148

139149
newtype LocalRootPeersGroups = LocalRootPeersGroups
@@ -185,10 +195,12 @@ instance FromJSON (Legacy a) => FromJSON (Legacy [a]) where
185195
parseJSON = fmap (Legacy . map getLegacy) . parseJSONList
186196

187197
instance FromJSON (Legacy LocalRootPeersGroup) where
188-
parseJSON = withObject "LocalRootPeersGroup" $ \o ->
198+
parseJSON = withObject "LocalRootPeersGroup" $ \o -> do
199+
hv@(HotValency v) <- o .: "hotValency"
189200
fmap Legacy $ LocalRootPeersGroup
190201
<$> o .: "localRoots"
191-
<*> o .: "valency"
202+
<*> pure hv
203+
<*> pure (WarmValency v)
192204

193205
instance FromJSON (Legacy LocalRootPeersGroups) where
194206
parseJSON = withObject "LocalRootPeersGroups" $ \o ->

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ import Cardano.Node.Protocol.Types
120120
import Cardano.Node.Queries
121121
import Cardano.Node.TraceConstraints (TraceConstraints)
122122
import Cardano.Tracing.Tracers
123+
import Ouroboros.Network.PeerSelection.LocalRootPeers (HotValency, WarmValency)
123124
import Ouroboros.Network.PeerSelection.PeerSharing (PeerSharing (..))
124125

125126
{- HLINT ignore "Fuse concatMap/map" -}
@@ -434,7 +435,7 @@ handleSimpleNode blockType runP p2pMode tracers nc onKernel = do
434435
$ NetworkConfig localRoots
435436
publicRoots
436437
(useLedgerAfterSlot nt)
437-
(localRootsVar :: StrictTVar IO [(Int, Map RelayAccessPoint PeerAdvertise)]) <- newTVarIO localRoots
438+
localRootsVar <- newTVarIO localRoots
438439
publicRootsVar <- newTVarIO publicRoots
439440
useLedgerVar <- newTVarIO (useLedgerAfterSlot nt)
440441
void $
@@ -557,7 +558,7 @@ installP2PSigHUPHandler :: Tracer IO (StartupTrace blk)
557558
-> Api.BlockType blk
558559
-> NodeConfiguration
559560
-> NodeKernel IO RemoteAddress (ConnectionId LocalAddress) blk
560-
-> StrictTVar IO [(Int, Map RelayAccessPoint PeerAdvertise)]
561+
-> StrictTVar IO [(HotValency, WarmValency, Map RelayAccessPoint PeerAdvertise)]
561562
-> StrictTVar IO (Map RelayAccessPoint PeerAdvertise)
562563
-> StrictTVar IO UseLedgerAfter
563564
-> IO ()
@@ -646,7 +647,7 @@ updateBlockForging startupTracer blockType nodeKernel nc = do
646647

647648
updateTopologyConfiguration :: Tracer IO (StartupTrace blk)
648649
-> NodeConfiguration
649-
-> StrictTVar IO [(Int, Map RelayAccessPoint PeerAdvertise)]
650+
-> StrictTVar IO [(HotValency, WarmValency, Map RelayAccessPoint PeerAdvertise)]
650651
-> StrictTVar IO (Map RelayAccessPoint PeerAdvertise)
651652
-> StrictTVar IO UseLedgerAfter
652653
-> IO ()
@@ -719,7 +720,7 @@ checkVRFFilePermissions (File vrfPrivKey) = do
719720

720721
mkP2PArguments
721722
:: NodeConfiguration
722-
-> STM IO [(Int, Map RelayAccessPoint PeerAdvertise)]
723+
-> STM IO [(HotValency, WarmValency, Map RelayAccessPoint PeerAdvertise)]
723724
-- ^ non-overlapping local root peers groups; the 'Int' denotes the
724725
-- valency of its group.
725726
-> STM IO (Map RelayAccessPoint PeerAdvertise)
@@ -786,11 +787,12 @@ producerAddressesNonP2P nt =
786787

787788
producerAddresses
788789
:: NetworkTopology
789-
-> ([(Int, Map RelayAccessPoint PeerAdvertise)], Map RelayAccessPoint PeerAdvertise)
790+
-> ([(HotValency, WarmValency, Map RelayAccessPoint PeerAdvertise)], Map RelayAccessPoint PeerAdvertise)
790791
producerAddresses nt =
791792
case nt of
792793
RealNodeTopology lrpg prp _ ->
793-
( map (\lrp -> ( valency lrp
794+
( map (\lrp -> ( hotValency lrp
795+
, warmValency lrp
794796
, Map.fromList $ rootConfigToRelayAccessPoint
795797
$ localRoots lrp
796798
)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import Cardano.Node.Protocol (ProtocolInstantiationError)
5252
import Cardano.Node.Protocol.Types (SomeConsensusProtocol (..))
5353

5454
import Cardano.Git.Rev (gitRev)
55+
import Ouroboros.Network.PeerSelection.LocalRootPeers (HotValency, WarmValency)
5556
import Paths_cardano_node (version)
5657

5758
data StartupTrace blk =
@@ -108,7 +109,7 @@ data StartupTrace blk =
108109
-- | Log peer-to-peer network configuration, either on startup or when its
109110
-- updated.
110111
--
111-
| NetworkConfig [(Int, Map RelayAccessPoint PeerAdvertise)]
112+
| NetworkConfig [(HotValency, WarmValency, Map RelayAccessPoint PeerAdvertise)]
112113
(Map RelayAccessPoint PeerAdvertise)
113114
UseLedgerAfter
114115

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,9 @@ instance LogFormatting (TracePeerSelection SockAddr) where
268268
, "actualEstablished" .= actualKnown
269269
, "selectedPeers" .= toJSONList (toList sp)
270270
]
271-
forMachine _dtal (TracePromoteColdLocalPeers tLocalEst aLocalEst sp) =
271+
forMachine _dtal (TracePromoteColdLocalPeers tLocalEst sp) =
272272
mconcat [ "kind" .= String "PromoteColdLocalPeers"
273273
, "targetLocalEstablished" .= tLocalEst
274-
, "actualLocalEstablished" .= aLocalEst
275274
, "selectedPeers" .= toJSONList (toList sp)
276275
]
277276
forMachine _dtal (TracePromoteColdFailed tEst aEst p d err) =
@@ -379,6 +378,10 @@ instance LogFormatting (TracePeerSelection SockAddr) where
379378
forMachine _dtal (TraceChurnMode c) =
380379
mconcat [ "kind" .= String "ChurnMode"
381380
, "event" .= show c ]
381+
forMachine _dtal (TraceKnownInboundConnection addr sharing) =
382+
mconcat [ "kind" .= String "KnownInboundConnection"
383+
, "peer" .= toJSON addr
384+
, "peerSharing" .= String (pack . show $ sharing) ]
382385
forHuman = pack . show
383386

384387
instance MetaTrace (TracePeerSelection SockAddr) where
@@ -442,6 +445,8 @@ instance MetaTrace (TracePeerSelection SockAddr) where
442445
Namespace [] ["ChurnWait"]
443446
namespaceFor TraceChurnMode {} =
444447
Namespace [] ["ChurnMode"]
448+
namespaceFor TraceKnownInboundConnection {} =
449+
Namespace [] ["KnownInboundConnection"]
445450

446451
severityFor (Namespace [] ["LocalRootPeersChanged"]) _ = Just Notice
447452
severityFor (Namespace [] ["TargetsChanged"]) _ = Just Notice
@@ -472,6 +477,7 @@ instance MetaTrace (TracePeerSelection SockAddr) where
472477
severityFor (Namespace [] ["GovernorWakeup"]) _ = Just Info
473478
severityFor (Namespace [] ["ChurnWait"]) _ = Just Info
474479
severityFor (Namespace [] ["ChurnMode"]) _ = Just Info
480+
severityFor (Namespace [] ["KnownInboundConnection"]) _ = Just Info
475481
severityFor _ _ = Nothing
476482

477483
documentFor (Namespace [] ["LocalRootPeersChanged"]) = Just ""
@@ -524,6 +530,8 @@ instance MetaTrace (TracePeerSelection SockAddr) where
524530
documentFor (Namespace [] ["GovernorWakeup"]) = Just ""
525531
documentFor (Namespace [] ["ChurnWait"]) = Just ""
526532
documentFor (Namespace [] ["ChurnMode"]) = Just ""
533+
documentFor (Namespace [] ["KnownInboundConnection"]) = Just
534+
"An inbound connection was added to known set of outbound governor"
527535
documentFor _ = Nothing
528536

529537
allNamespaces = [
@@ -556,6 +564,7 @@ instance MetaTrace (TracePeerSelection SockAddr) where
556564
, Namespace [] ["GovernorWakeup"]
557565
, Namespace [] ["ChurnWait"]
558566
, Namespace [] ["ChurnMode"]
567+
, Namespace [] ["KnownInboundConnection"]
559568
]
560569

561570
--------------------------------------------------------------------------------

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ ppStartupInfoTrace (NetworkConfig localRoots publicRoots useLedgerAfter) =
512512
pack
513513
$ intercalate "\n"
514514
[ "\nLocal Root Groups:"
515-
, " " ++ intercalate "\n " (map (\(x,y) -> show (x, Map.assocs y))
515+
, " " ++ intercalate "\n " (map (\(x,y,z) -> show (x, y, Map.assocs z))
516516
localRoots)
517517
, "Public Roots:"
518518
, " " ++ intercalate "\n " (map show $ Map.assocs publicRoots)

0 commit comments

Comments
 (0)