diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Command.hs b/bench/tx-generator/src/Cardano/Benchmarking/Command.hs index 0f5c865d5b8..1aaecb41eae 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Command.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Command.hs @@ -58,6 +58,7 @@ import GHC.Weak as Weak (deRefWeak) import System.Posix.Signals as Sig (Handler (CatchInfo), SignalInfo (..), SignalSpecificInfo (..), installHandler, sigINT, sigTERM) +import Foreign.C (Errno(..)) #if MIN_VERSION_base(4,18,0) import Data.Maybe as Maybe (fromMaybe) import GHC.Conc.Sync as Conc (threadLabel) diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index b8275a8da51..0f39bddd5e7 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -158,6 +158,7 @@ library , transformers-except , unordered-containers , yaml + , microlens default-language: Haskell2010 default-extensions: OverloadedStrings diff --git a/cardano-node/src/Cardano/Node/Configuration/POM.hs b/cardano-node/src/Cardano/Node/Configuration/POM.hs index b67d97a1bb2..476b1fc8c35 100644 --- a/cardano-node/src/Cardano/Node/Configuration/POM.hs +++ b/cardano-node/src/Cardano/Node/Configuration/POM.hs @@ -166,6 +166,10 @@ data NodeConfiguration -- by the diffusion layer when syncing , ncConsensusMode :: !ConsensusMode + -- Minimum number of active big ledger peers we must be connected to + -- in Genesis mode + , ncMinBigLedgerPeersForTrustedState :: MinBigLedgerPeersForTrustedState + -- Enable experimental P2P mode , ncEnableP2P :: SomeNetworkP2PMode @@ -232,7 +236,9 @@ data PartialNodeConfiguration , pncSyncTargetOfKnownBigLedgerPeers :: !(Last Int) , pncSyncTargetOfEstablishedBigLedgerPeers :: !(Last Int) , pncSyncTargetOfActiveBigLedgerPeers :: !(Last Int) - , pncSyncMinTrusted :: !(Last MinBigLedgerPeersForTrustedState) + -- Minimum number of active big ledger peers we must be connected to + -- in Genesis mode + , pncMinBigLedgerPeersForTrustedState :: !(Last MinBigLedgerPeersForTrustedState) -- Consensus mode for diffusion layer , pncConsensusMode :: !(Last ConsensusMode) @@ -328,7 +334,9 @@ instance FromJSON PartialNodeConfiguration where pncSyncTargetOfKnownBigLedgerPeers <- Last <$> v .:? "SyncTargetNumberOfKnownBigLedgerPeers" pncSyncTargetOfEstablishedBigLedgerPeers <- Last <$> v .:? "SyncTargetNumberOfEstablishedBigLedgerPeers" pncSyncTargetOfActiveBigLedgerPeers <- Last <$> v .:? "SyncTargetNumberOfActiveBigLedgerPeers" - pncSyncMinTrusted <- Last <$> v .:? "SyncMinNumberOfBigLedgerPeersForTrustedState" + -- Minimum number of active big ledger peers we must be connected to + -- in Genesis mode + pncMinBigLedgerPeersForTrustedState <- Last <$> v .:? "MinBigLedgerPeersForTrustedState" pncConsensusMode <- Last <$> v .:? "ConsensusMode" @@ -344,7 +352,7 @@ instance FromJSON PartialNodeConfiguration where -- Peer Sharing -- DISABLED BY DEFAULT - pncPeerSharing <- Last <$> v .:? "PeerSharing" .!= Just Configuration.PeerSharingDisabled + pncPeerSharing <- Last <$> v .:? "PeerSharing" pure PartialNodeConfiguration { pncProtocolConfig @@ -382,7 +390,7 @@ instance FromJSON PartialNodeConfiguration where , pncSyncTargetOfKnownBigLedgerPeers , pncSyncTargetOfEstablishedBigLedgerPeers , pncSyncTargetOfActiveBigLedgerPeers - , pncSyncMinTrusted + , pncMinBigLedgerPeersForTrustedState , pncConsensusMode , pncEnableP2P , pncPeerSharing @@ -564,10 +572,10 @@ defaultPartialNodeConfiguration = , pncSyncTargetOfKnownBigLedgerPeers = Last (Just syncBigKnown) , pncSyncTargetOfEstablishedBigLedgerPeers = Last (Just syncBigEst) , pncSyncTargetOfActiveBigLedgerPeers = Last (Just syncBigAct) - , pncSyncMinTrusted = Last (Just defaultMinBigLedgerPeersForTrustedState) - , pncConsensusMode = mempty + , pncMinBigLedgerPeersForTrustedState = Last (Just defaultMinBigLedgerPeersForTrustedState) + , pncConsensusMode = Last (Just defaultConsensusMode) , pncEnableP2P = Last (Just EnabledP2PMode) - , pncPeerSharing = Last (Just Configuration.PeerSharingDisabled) + , pncPeerSharing = Last (Just defaultPeerSharing) } where Configuration.PeerSelectionTargets { @@ -637,9 +645,9 @@ makeNodeConfiguration pnc = do ncSyncTargetOfActiveBigLedgerPeers <- lastToEither "Missing SyncTargetNumberOfActiveBigLedgerPeers" $ pncSyncTargetOfActiveBigLedgerPeers pnc - ncSyncMinTrusted <- - lastToEither "Missing SyncMinNumberOfBigLedgerPeersForTrustedState" - $ pncSyncMinTrusted pnc + ncMinBigLedgerPeersForTrustedState <- + lastToEither "Missing MinBigLedgerPeersForTrustedState" + $ pncMinBigLedgerPeersForTrustedState pnc ncConsensusMode <- lastToEither "Missing ConsensusMode" $ pncConsensusMode pnc @@ -712,7 +720,7 @@ makeNodeConfiguration pnc = do , ncSyncTargetOfKnownBigLedgerPeers , ncSyncTargetOfEstablishedBigLedgerPeers , ncSyncTargetOfActiveBigLedgerPeers - , ncSyncMinTrusted + , ncMinBigLedgerPeersForTrustedState , ncEnableP2P = case enableP2P of EnabledP2PMode -> SomeNetworkP2PMode Consensus.EnabledP2PMode DisabledP2PMode -> SomeNetworkP2PMode Consensus.DisabledP2PMode diff --git a/cardano-node/src/Cardano/Node/Parsers.hs b/cardano-node/src/Cardano/Node/Parsers.hs index 0840a0660fa..e8d4b7ec619 100644 --- a/cardano-node/src/Cardano/Node/Parsers.hs +++ b/cardano-node/src/Cardano/Node/Parsers.hs @@ -128,7 +128,7 @@ nodeRunParser = do , pncSyncTargetOfKnownBigLedgerPeers = mempty , pncSyncTargetOfEstablishedBigLedgerPeers = mempty , pncSyncTargetOfActiveBigLedgerPeers = mempty - , pncSyncMinTrusted = mempty + , pncMinBigLedgerPeersForTrustedState = mempty , pncConsensusMode = mempty , pncEnableP2P = mempty , pncPeerSharing = mempty diff --git a/cardano-node/src/Cardano/Node/Run.hs b/cardano-node/src/Cardano/Node/Run.hs index bc4cb00fb55..dbc4023129b 100644 --- a/cardano-node/src/Cardano/Node/Run.hs +++ b/cardano-node/src/Cardano/Node/Run.hs @@ -900,7 +900,7 @@ mkP2PArguments NodeConfiguration { ncSyncTargetOfKnownBigLedgerPeers, ncSyncTargetOfEstablishedBigLedgerPeers, ncSyncTargetOfActiveBigLedgerPeers, - ncSyncMinTrusted, + ncMinBigLedgerPeersForTrustedState, ncProtocolIdleTimeout, ncTimeWaitTimeout, ncPeerSharing, @@ -926,7 +926,7 @@ mkP2PArguments NodeConfiguration { , P2P.daBulkChurnInterval = Configuration.defaultBulkChurnInterval , P2P.daOwnPeerSharing = ncPeerSharing , P2P.daConsensusMode = ncConsensusMode - , P2P.daMinBigLedgerPeersForTrustedState = ncSyncMinTrusted + , P2P.daMinBigLedgerPeersForTrustedState = ncMinBigLedgerPeersForTrustedState } where deadlineTargets = Configuration.defaultDeadlineTargets { diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs index 1cf6ee3f868..72ac9a57399 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs @@ -778,7 +778,7 @@ instance MetaTrace (TracePeerSelection SockAddr) where documentFor (Namespace [] ["DebugState"]) = Just "peer selection internal state" documentFor (Namespace [] ["VerifyPeerSnapshot"]) = Just - "Big ledger peer snapshot file failed integrity check against the ledger" + "Verification outcome of big ledger peer snapshot" documentFor _ = Nothing metricsDocFor (Namespace [] ["ChurnAction"]) = diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs index 5534f21873f..52004c2bd8b 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Network.hs @@ -2201,6 +2201,7 @@ instance ToJSON NodeToClientVersion where toJSON NodeToClientV_16 = Number 16 toJSON NodeToClientV_17 = Number 17 toJSON NodeToClientV_18 = Number 18 + toJSON NodeToClientV_19 = Number 19 -- NB: When adding a new version here, update FromJSON below as well! instance FromJSON NodeToClientVersion where @@ -2214,6 +2215,7 @@ instance FromJSON NodeToClientVersion where parseJSON (Number 16) = return NodeToClientV_16 parseJSON (Number 17) = return NodeToClientV_17 parseJSON (Number 18) = return NodeToClientV_18 + parseJSON (Number 19) = return NodeToClientV_19 parseJSON (Number x) = fail ("FromJSON.NodeToClientVersion: unsupported node-to-client protocol version " ++ show x) parseJSON x = fail ("FromJSON.NodeToClientVersion: error parsing NodeToClientVersion: " ++ show x) diff --git a/cardano-node/test/Test/Cardano/Node/POM.hs b/cardano-node/test/Test/Cardano/Node/POM.hs index 3e46cbd6e86..d0cebeeb00f 100644 --- a/cardano-node/test/Test/Cardano/Node/POM.hs +++ b/cardano-node/test/Test/Cardano/Node/POM.hs @@ -134,20 +134,21 @@ testPartialYamlConfig = , pncTimeWaitTimeout = mempty , pncChainSyncIdleTimeout = mempty , pncAcceptedConnectionsLimit = mempty - , pncTargetNumberOfRootPeers = mempty - , pncTargetNumberOfKnownPeers = mempty - , pncTargetNumberOfEstablishedPeers = mempty - , pncTargetNumberOfActivePeers = mempty - , pncTargetNumberOfKnownBigLedgerPeers = mempty - , pncTargetNumberOfEstablishedBigLedgerPeers = mempty - , pncTargetNumberOfActiveBigLedgerPeers = mempty - , pncGenesisTargetNumberOfActivePeers = mempty - , pncGenesisTargetNumberOfKnownBigLedgerPeers = mempty - , pncGenesisTargetNumberOfEstablishedBigLedgerPeers = mempty - , pncGenesisTargetNumberOfActiveBigLedgerPeers = mempty + , pncDeadlineTargetOfRootPeers = mempty + , pncDeadlineTargetOfKnownPeers = mempty + , pncDeadlineTargetOfEstablishedPeers = mempty + , pncDeadlineTargetOfActivePeers = mempty + , pncDeadlineTargetOfKnownBigLedgerPeers = mempty + , pncDeadlineTargetOfEstablishedBigLedgerPeers = mempty + , pncDeadlineTargetOfActiveBigLedgerPeers = mempty + , pncSyncTargetNumberOfActivePeers = mempty + , pncSyncTargetNumberOfKnownBigLedgerPeers = mempty + , pncSyncTargetNumberOfEstablishedBigLedgerPeers = mempty + , pncSyncTargetNumberOfActiveBigLedgerPeers = mempty + , pncMinBigLedgerPeersForTrustedState = mempty , pncEnableP2P = Last (Just DisabledP2PMode) , pncPeerSharing = Last (Just PeerSharingDisabled) - , pncConsensusMode = Last (Just PraosMode) + , pncConsensusMode = mempty } -- | Example partial configuration theoretically created @@ -179,20 +180,21 @@ testPartialCliConfig = , pncTimeWaitTimeout = mempty , pncChainSyncIdleTimeout = mempty , pncAcceptedConnectionsLimit = mempty - , pncTargetNumberOfRootPeers = mempty - , pncTargetNumberOfKnownPeers = mempty - , pncTargetNumberOfEstablishedPeers = mempty - , pncTargetNumberOfActivePeers = mempty - , pncTargetNumberOfKnownBigLedgerPeers = mempty - , pncTargetNumberOfEstablishedBigLedgerPeers = mempty - , pncTargetNumberOfActiveBigLedgerPeers = mempty - , pncGenesisTargetNumberOfActivePeers = mempty - , pncGenesisTargetNumberOfKnownBigLedgerPeers = mempty - , pncGenesisTargetNumberOfEstablishedBigLedgerPeers = mempty - , pncGenesisTargetNumberOfActiveBigLedgerPeers = mempty + , pncDeadlineTargetNumberOfRootPeers = mempty + , pncDeadlineTargetNumberOfKnownPeers = mempty + , pncDeadlineTargetNumberOfEstablishedPeers = mempty + , pncDeadlineTargetNumberOfActivePeers = mempty + , pncDeadlineTargetNumberOfKnownBigLedgerPeers = mempty + , pncDeadlineTargetNumberOfEstablishedBigLedgerPeers = mempty + , pncDeadlineTargetNumberOfActiveBigLedgerPeers = mempty + , pncSyncTargetNumberOfActivePeers = mempty + , pncSyncTargetNumberOfKnownBigLedgerPeers = mempty + , pncSyncTargetNumberOfEstablishedBigLedgerPeers = mempty + , pncSyncTargetNumberOfActiveBigLedgerPeers = mempty + , pncMinBigLedgerPeersForTrustedState = Last (Just defaultMinBigLedgerPeersForTrustedState) , pncEnableP2P = Last (Just DisabledP2PMode) , pncPeerSharing = Last (Just PeerSharingDisabled) - , pncConsensusMode = Last (Just GenesisMode) + , pncConsensusMode = Last (Just PraosMode) } -- | Expected final NodeConfiguration @@ -230,20 +232,21 @@ eExpectedConfig = do , acceptedConnectionsSoftLimit = 384 , acceptedConnectionsDelay = 5 } - , ncTargetNumberOfRootPeers = 60 - , ncTargetNumberOfKnownPeers = 85 - , ncTargetNumberOfEstablishedPeers = 40 - , ncTargetNumberOfActivePeers = 15 - , ncTargetNumberOfKnownBigLedgerPeers = 15 - , ncTargetNumberOfEstablishedBigLedgerPeers = 10 - , ncTargetNumberOfActiveBigLedgerPeers = 5 - , ncGenesisTargetNumberOfActivePeers = 0 - , ncGenesisTargetNumberOfKnownBigLedgerPeers = 100 - , ncGenesisTargetNumberOfEstablishedBigLedgerPeers = 50 - , ncGenesisTargetNumberOfActiveBigLedgerPeers = 30 + , ncDeadlineTargetNumberOfRootPeers = 60 + , ncDeadlineTargetNumberOfKnownPeers = 85 + , ncDeadlineTargetNumberOfEstablishedPeers = 40 + , ncDeadlineTargetNumberOfActivePeers = 15 + , ncDeadlineTargetNumberOfKnownBigLedgerPeers = 15 + , ncDeadlineTargetNumberOfEstablishedBigLedgerPeers = 10 + , ncDeadlineTargetNumberOfActiveBigLedgerPeers = 5 + , ncSyncTargetNumberOfActivePeers = 0 + , ncSyncTargetNumberOfKnownBigLedgerPeers = 100 + , ncSyncTargetNumberOfEstablishedBigLedgerPeers = 50 + , ncSyncTargetNumberOfActiveBigLedgerPeers = 30 + , ncMinBigLedgerPeersForTrustedState = defaultMinBigLedgerPeersForTrustedState , ncEnableP2P = SomeNetworkP2PMode Consensus.DisabledP2PMode , ncPeerSharing = PeerSharingDisabled - , ncConsensusMode = GenesisMode + , ncConsensusMode = PraosMode } -- -----------------------------------------------------------------------------