Skip to content

Commit

Permalink
Set EnabledP2PMode by default
Browse files Browse the repository at this point in the history
Also added a mild warning when using the legacy network stack.
  • Loading branch information
coot committed Apr 3, 2024
1 parent 4beaff3 commit 412195c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 22 deletions.
4 changes: 4 additions & 0 deletions cardano-node/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for cardano-node

## Next version

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

## 8.2.1 -- August 2023

- prevent SIGHUP from killing node during ledger replay
Expand Down
2 changes: 1 addition & 1 deletion cardano-node/src/Cardano/Node/Configuration/POM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ defaultPartialNodeConfiguration =
, pncTargetNumberOfKnownBigLedgerPeers = Last (Just 15)
, pncTargetNumberOfEstablishedBigLedgerPeers = Last (Just 10)
, pncTargetNumberOfActiveBigLedgerPeers = Last (Just 5)
, pncEnableP2P = Last (Just DisabledP2PMode)
, pncEnableP2P = Last (Just EnabledP2PMode)
, pncPeerSharing = Last (Just PeerSharingDisabled)
}

Expand Down
4 changes: 2 additions & 2 deletions cardano-node/src/Cardano/Node/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ handleSimpleNode blockType runP p2pMode tracers nc onKernel = do
logStartupWarnings :: IO ()
logStartupWarnings = do
(case p2pMode of
DisabledP2PMode -> return ()
EnabledP2PMode -> traceWith (startupTracer tracers) P2PWarning
EnabledP2PMode -> return ()
DisabledP2PMode -> traceWith (startupTracer tracers) NonP2PWarning
) :: IO () -- annoying, but unavoidable for GADT type inference

let developmentNtnVersions =
Expand Down
4 changes: 2 additions & 2 deletions cardano-node/src/Cardano/Node/Startup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ data StartupTrace blk =
(Map RelayAccessPoint PeerAdvertise)
UseLedgerPeers

-- | Warn when 'EnableP2P' is set.
| P2PWarning
-- | Warn when 'DisabledP2P' is set.
| NonP2PWarning

-- | Warn when 'ExperimentalProtocolsEnabled' is set and affects
-- node-to-node protocol.
Expand Down
6 changes: 3 additions & 3 deletions cardano-node/src/Cardano/Node/Tracing/StateRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ data StartupState
| StartupDBValidation
| NetworkConfigUpdate
| NetworkConfigUpdateError Text
| P2PWarning
| NonP2PWarning
| WarningDevelopmentNodeToNodeVersions [NPV.NodeToNodeVersion]
| WarningDevelopmentNodeToClientVersions [NPV.NodeToClientVersion]
deriving (Generic, FromJSON, ToJSON)
Expand Down Expand Up @@ -260,8 +260,8 @@ traceNodeStateStartup tr ev =
traceWith tr $ NodeStartup NetworkConfigUpdate
Startup.NetworkConfigUpdateError e ->
traceWith tr $ NodeStartup $ NetworkConfigUpdateError e
Startup.P2PWarning ->
traceWith tr $ NodeStartup P2PWarning
Startup.NonP2PWarning ->
traceWith tr $ NodeStartup NonP2PWarning
Startup.WarningDevelopmentNodeToNodeVersions ntnVersions ->
traceWith tr $ NodeStartup (WarningDevelopmentNodeToNodeVersions ntnVersions)
Startup.WarningDevelopmentNodeToClientVersions ntcVersions ->
Expand Down
26 changes: 13 additions & 13 deletions cardano-node/src/Cardano/Node/Tracing/Tracers/Startup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ instance ( Show (BlockNodeToNodeVersion blk)
mconcat [ "kind" .= String "NetworkConfigLegacy"
, "message" .= String p2pNetworkConfigLegacyMessage
]
forMachine _dtal P2PWarning =
mconcat [ "kind" .= String "P2PWarning"
, "message" .= String p2pWarningMessage ]
forMachine _dtal NonP2PWarning =
mconcat [ "kind" .= String "NonP2PWarning"
, "message" .= String nonP2PWarningMessage ]
forMachine _ver (WarningDevelopmentNodeToNodeVersions ntnVersions) =
mconcat [ "kind" .= String "WarningDevelopmentNodeToNodeVersions"
, "message" .= String "enabled development network protocols"
Expand Down Expand Up @@ -304,8 +304,8 @@ instance MetaTrace (StartupTrace blk) where
Namespace [] ["NetworkConfig"]
namespaceFor NetworkConfigLegacy {} =
Namespace [] ["NetworkConfigLegacy"]
namespaceFor P2PWarning {} =
Namespace [] ["P2PWarning"]
namespaceFor NonP2PWarning {} =
Namespace [] ["NonP2PWarning"]
namespaceFor WarningDevelopmentNodeToNodeVersions {} =
Namespace [] ["WarningDevelopmentNodeToNodeVersions"]
namespaceFor WarningDevelopmentNodeToClientVersions {} =
Expand All @@ -323,7 +323,7 @@ instance MetaTrace (StartupTrace blk) where
severityFor (Namespace _ ["NetworkConfigUpdate"]) _ = Just Notice
severityFor (Namespace _ ["NetworkConfigUpdateError"]) _ = Just Error
severityFor (Namespace _ ["NetworkConfigUpdateUnsupported"]) _ = Just Warning
severityFor (Namespace _ ["P2PWarning"]) _ = Just Warning
severityFor (Namespace _ ["NonP2PWarning"]) _ = Just Warning
severityFor (Namespace _ ["WarningDevelopmentNodeToNodeVersions"]) _ = Just Warning
severityFor (Namespace _ ["WarningDevelopmentNodeToClientVersions"]) _ = Just Warning
severityFor (Namespace _ ["BlockForgingUpdateError"]) _ = Just Error
Expand Down Expand Up @@ -358,7 +358,7 @@ instance MetaTrace (StartupTrace blk) where
""
documentFor (Namespace [] ["NetworkConfigLegacy"]) = Just
""
documentFor (Namespace [] ["P2PWarning"]) = Just
documentFor (Namespace [] ["NonP2PWarning"]) = Just
""
documentFor (Namespace [] ["WarningDevelopmentNodeToNodeVersions"]) = Just
""
Expand Down Expand Up @@ -409,7 +409,7 @@ instance MetaTrace (StartupTrace blk) where
, Namespace [] ["NetworkConfigUpdateError"]
, Namespace [] ["NetworkConfig"]
, Namespace [] ["NetworkConfigLegacy"]
, Namespace [] ["P2PWarning"]
, Namespace [] ["NonP2PWarning"]
, Namespace [] ["WarningDevelopmentNodeToNodeVersions"]
, Namespace [] ["WarningDevelopmentNodeToClientVersions"]
, Namespace [] ["Common"]
Expand Down Expand Up @@ -522,7 +522,7 @@ ppStartupInfoTrace (NetworkConfig localRoots publicRoots useLedgerPeers) =
]
ppStartupInfoTrace NetworkConfigLegacy = p2pNetworkConfigLegacyMessage

ppStartupInfoTrace P2PWarning = p2pWarningMessage
ppStartupInfoTrace NonP2PWarning = nonP2PWarningMessage

ppStartupInfoTrace (WarningDevelopmentNodeToNodeVersions ntnVersions) =
"enabled development node-to-node versions: "
Expand Down Expand Up @@ -557,10 +557,10 @@ ppStartupInfoTrace (BICommon BasicInfoCommon {..}) =
<> ", Commit " <> showT biCommit
<> ", Node start time " <> showT biNodeStartTime

p2pWarningMessage :: Text
p2pWarningMessage =
"You are using an early release of peer-to-peer capabilities, "
<> "please report any issues."
nonP2PWarningMessage :: Text
nonP2PWarningMessage =
"You are using legacy networking stack, "
<> "consider upgrading to the p2p network stack."

p2pNetworkConfigLegacyMessage :: Text
p2pNetworkConfigLegacyMessage =
Expand Down
2 changes: 1 addition & 1 deletion cardano-node/src/Cardano/Tracing/Startup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ instance HasSeverityAnnotation (StartupTrace blk) where
getSeverityAnnotation NetworkConfigUpdate = Notice
getSeverityAnnotation (NetworkConfigUpdateError _) = Error
getSeverityAnnotation NetworkConfigUpdateUnsupported = Warning
getSeverityAnnotation P2PWarning = Warning
getSeverityAnnotation NonP2PWarning = Warning
getSeverityAnnotation WarningDevelopmentNodeToNodeVersions {} = Warning
getSeverityAnnotation WarningDevelopmentNodeToClientVersions {} = Warning
getSeverityAnnotation _ = Info
Expand Down

0 comments on commit 412195c

Please sign in to comment.