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 d98cb2ff755..886053e74d2 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 db1978a7837..651bc9f3e6b 100644 --- a/cardano-node/src/Cardano/Node/Configuration/POM.hs +++ b/cardano-node/src/Cardano/Node/Configuration/POM.hs @@ -169,6 +169,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 @@ -236,7 +240,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) @@ -334,7 +340,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" @@ -350,7 +358,7 @@ instance FromJSON PartialNodeConfiguration where -- Peer Sharing -- DISABLED BY DEFAULT - pncPeerSharing <- Last <$> v .:? "PeerSharing" .!= Just Configuration.PeerSharingDisabled + pncPeerSharing <- Last <$> v .:? "PeerSharing" pure PartialNodeConfiguration { pncProtocolConfig @@ -390,7 +398,7 @@ instance FromJSON PartialNodeConfiguration where , pncSyncTargetOfKnownBigLedgerPeers , pncSyncTargetOfEstablishedBigLedgerPeers , pncSyncTargetOfActiveBigLedgerPeers - , pncSyncMinTrusted + , pncMinBigLedgerPeersForTrustedState , pncConsensusMode , pncEnableP2P , pncPeerSharing @@ -573,10 +581,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 { @@ -648,9 +656,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 @@ -724,7 +732,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 821d580b3bd..8cfd0091ead 100644 --- a/cardano-node/src/Cardano/Node/Parsers.hs +++ b/cardano-node/src/Cardano/Node/Parsers.hs @@ -130,7 +130,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 e89f5dc2eef..0405ae461cc 100644 --- a/cardano-node/src/Cardano/Node/Run.hs +++ b/cardano-node/src/Cardano/Node/Run.hs @@ -902,7 +902,7 @@ mkP2PArguments NodeConfiguration { ncSyncTargetOfKnownBigLedgerPeers, ncSyncTargetOfEstablishedBigLedgerPeers, ncSyncTargetOfActiveBigLedgerPeers, - ncSyncMinTrusted, + ncMinBigLedgerPeersForTrustedState, ncProtocolIdleTimeout, ncTimeWaitTimeout, ncPeerSharing, @@ -930,7 +930,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 09baa6e054f..3f46de89e9f 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs @@ -784,7 +784,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/test/Test/Cardano/Node/POM.hs b/cardano-node/test/Test/Cardano/Node/POM.hs index b6b59c403d9..f79b664c4d1 100644 --- a/cardano-node/test/Test/Cardano/Node/POM.hs +++ b/cardano-node/test/Test/Cardano/Node/POM.hs @@ -136,20 +136,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 @@ -182,20 +183,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 @@ -234,20 +236,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 } -- -----------------------------------------------------------------------------