Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/locli/locli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ library
, hashable
, optparse-applicative-fork >= 0.18.1
, ouroboros-consensus
, ouroboros-network-api ^>= 0.14
, ouroboros-network-api ^>= 0.14.1
, sop-core
, split
, sqlite-easy >= 1.1.0.1
Expand Down
10 changes: 4 additions & 6 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- you need to run if you change them
index-state:
, hackage.haskell.org 2025-06-03T08:07:10Z
, cardano-haskell-packages 2025-06-03T08:30:50Z
, cardano-haskell-packages 2025-11-20T19:55:27Z

packages:
cardano-node
Expand Down Expand Up @@ -92,9 +92,7 @@ if impl (ghc >= 9.12)
, servant:base
, servant-server:base

, cardano-ping:base
, network-mux:base
, ouroboros-network:base
, ouroboros-network-api:base
, ouroboros-network-framework:base
, ouroboros-network-protocols:base

constraints:
hedgehog-extras == 0.7.0.0
12 changes: 6 additions & 6 deletions cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.8

name: cardano-node
version: 10.5.0
version: 10.5.3
synopsis: The cardano full node
description: The cardano full node.
category: Cardano,
Expand Down Expand Up @@ -150,7 +150,7 @@ library
, base16-bytestring
, bytestring
, cardano-api ^>= 10.16
, cardano-crypto-class
, cardano-crypto-class ^>=2.2.3.2
, cardano-crypto-wrapper
, cardano-git-rev ^>=0.2.2
, cardano-ledger-alonzo
Expand Down Expand Up @@ -197,9 +197,9 @@ library
, ouroboros-consensus-cardano ^>= 0.25
, ouroboros-consensus-diffusion ^>= 0.23
, ouroboros-consensus-protocol
, ouroboros-network-api ^>= 0.14
, ouroboros-network ^>= 0.21.2
, ouroboros-network-framework ^>= 0.18.0.1
, ouroboros-network-api ^>= 0.14.1
, ouroboros-network ^>= 0.21.4
, ouroboros-network-framework ^>= 0.18
, ouroboros-network-protocols ^>= 0.14
, prettyprinter
, prettyprinter-ansi-terminal
Expand Down Expand Up @@ -244,7 +244,7 @@ executable cardano-node
autogen-modules: Paths_cardano_node

build-depends: base
, cardano-crypto-class
, cardano-crypto-class ^>=2.2.3.2
, cardano-git-rev
, cardano-node
, optparse-applicative-fork
Expand Down
28 changes: 15 additions & 13 deletions cardano-node/src/Cardano/Node/Configuration/POM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ data PartialNodeConfiguration
, pncConfigFile :: !(Last ConfigYamlFilePath)
, pncTopologyFile :: !(Last TopologyFile)
, pncDatabaseFile :: !(Last NodeDatabasePaths)
-- | pncProtocolFiles can only be supplied with command line arguments.
, pncProtocolFiles :: !(Last ProtocolFilepaths)
, pncValidateDB :: !(Last Bool)
, pncShutdownConfig :: !(Last ShutdownConfig)
Expand Down Expand Up @@ -314,6 +315,7 @@ instance Semigroup PartialNodeConfiguration where
instance FromJSON PartialNodeConfiguration where
parseJSON =
withObject "PartialNodeConfiguration" $ \v -> do
pncStartAsNonProducingNode <- Last <$> v .:? "StartAsNonProducingNode"

-- Node parameters, not protocol-specific
pncSocketPath <- Last <$> v .:? "SocketPath"
Expand Down Expand Up @@ -435,7 +437,7 @@ instance FromJSON PartialNodeConfiguration where
, pncProtocolFiles = mempty
, pncValidateDB = mempty
, pncShutdownConfig = mempty
, pncStartAsNonProducingNode = Last $ Just False
, pncStartAsNonProducingNode
, pncMaybeMempoolCapacityOverride
, pncLedgerDbConfig
, pncProtocolIdleTimeout
Expand Down Expand Up @@ -653,7 +655,7 @@ defaultPartialNodeConfiguration =
, pncDiffusionMode = Last $ Just InitiatorAndResponderDiffusionMode
, pncExperimentalProtocolsEnabled = Last $ Just False
, pncTopologyFile = Last . Just $ TopologyFile "configuration/cardano/mainnet-topology.json"
, pncProtocolFiles = mempty
, pncProtocolFiles = Last . Just $ ProtocolFilepaths Nothing Nothing Nothing Nothing Nothing Nothing
, pncValidateDB = Last $ Just False
, pncShutdownConfig = Last . Just $ ShutdownConfig Nothing Nothing
, pncStartAsNonProducingNode = Last $ Just False
Expand Down Expand Up @@ -695,7 +697,8 @@ defaultPartialNodeConfiguration =
, pncMinBigLedgerPeersForTrustedState = Last (Just Cardano.defaultNumberOfBigLedgerPeers)
, pncConsensusMode = Last (Just Ouroboros.defaultConsensusMode)
, pncEnableP2P = Last (Just EnabledP2PMode)
, pncPeerSharing = Last (Just Ouroboros.defaultPeerSharing)
, pncPeerSharing = mempty
-- the default is defined in `makeNodeConfiguration`
, pncGenesisConfigFlags = Last (Just defaultGenesisConfigFlags)
, pncResponderCoreAffinityPolicy = Last $ Just NoResponderCoreAffinity
}
Expand Down Expand Up @@ -730,6 +733,7 @@ makeNodeConfiguration pnc = do
validateDB <- lastToEither "Missing ValidateDB" $ pncValidateDB pnc
startAsNonProducingNode <- lastToEither "Missing StartAsNonProducingNode" $ pncStartAsNonProducingNode pnc
protocolConfig <- lastToEither "Missing ProtocolConfig" $ pncProtocolConfig pnc
protocolFiles <- lastToEither "Missing ProtocolFiles" $ pncProtocolFiles pnc
loggingSwitch <- lastToEither "Missing LoggingSwitch" $ pncLoggingSwitch pnc
logMetrics <- lastToEither "Missing LogMetrics" $ pncLogMetrics pnc
traceConfig <- first Text.unpack $ partialTraceSelectionToEither $ pncTraceConfig pnc
Expand Down Expand Up @@ -809,9 +813,13 @@ makeNodeConfiguration pnc = do
$ getLast
$ pncChainSyncIdleTimeout pnc

ncPeerSharing <-
lastToEither "Missing PeerSharing"
$ pncPeerSharing pnc
let ncPeerSharing =
case pncPeerSharing pnc of
Last Nothing ->
if hasProtocolFile protocolFiles
then PeerSharingDisabled
else PeerSharingEnabled
Last (Just peerSharing) -> peerSharing

mGenesisConfigFlags <- case ncConsensusMode of
PraosMode -> pure Nothing
Expand Down Expand Up @@ -856,13 +864,7 @@ makeNodeConfiguration pnc = do
{ ncConfigFile = configFile
, ncTopologyFile = topologyFile
, ncDatabaseFile = databaseFile
, ncProtocolFiles =
-- TODO: ncProtocolFiles should be Maybe ProtocolFiles
-- as relay nodes don't need the protocol files because
-- they are not minting blocks.
case getLast $ pncProtocolFiles pnc of
Just pFiles -> pFiles
Nothing -> ProtocolFilepaths Nothing Nothing Nothing Nothing Nothing Nothing
, ncProtocolFiles = protocolFiles
, ncValidateDB = validateDB
, ncShutdownConfig = shutdownConfig
, ncStartAsNonProducingNode = startAsNonProducingNode
Expand Down
35 changes: 29 additions & 6 deletions cardano-node/src/Cardano/Node/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ import Data.Maybe (fromMaybe)
import Data.Monoid (Last (..))
import Data.Text (Text)
import Data.Word (Word32)
import Options.Applicative hiding (str)
import Options.Applicative hiding (str, switch)
-- Don't use switch. It will not allow to set an option in a configuration
-- file. See `parseStartAsNonProducingNode` and `parseValidateDB`.
import qualified Options.Applicative as Opt
import qualified Options.Applicative.Help as OptI
import System.Posix.Types (Fd (..))
Expand Down Expand Up @@ -60,7 +62,9 @@ nodeRunParser = do
shelleyVRFFile <- optional parseVrfKeyFilePath
shelleyCertFile <- optional parseOperationalCertFilePath
shelleyBulkCredsFile <- optional parseBulkCredsFilePath
startAsNonProducingNode <- lastOption parseStartAsNonProducingNode
startAsNonProducingNode <- (\depr new -> Last depr <> Last new)
<$> parseStartAsNonProducingNodeDeprecated
<*> parseStartAsNonProducingNode

-- Node Address
nIPv4Address <- lastOption parseHostIPv4Addr
Expand Down Expand Up @@ -266,9 +270,13 @@ parseImmutableDbPath = strOption $
]


-- | This parser will always override configuration option, even if the
-- `--validate-db` is not present. This is fine for `--validate-db` switch,
-- but might not be for something else. See `parseStartAsNonProducingNode` for
-- an alternative solution.
parseValidateDB :: Parser Bool
parseValidateDB =
switch (
Opt.switch (
long "validate-db"
<> help "Validate all on-disk database files"
)
Expand Down Expand Up @@ -353,16 +361,31 @@ parseVrfKeyFilePath =
<> completer (bashCompleter "file")
)

parseStartAsNonProducingNode :: Parser Bool
parseStartAsNonProducingNode =
switch $ mconcat
parseStartAsNonProducingNodeDeprecated :: Parser (Maybe Bool)
parseStartAsNonProducingNodeDeprecated =
flag Nothing (Just True) $ mconcat
[ long "non-producing-node"
, help $ mconcat
[ "DEPRECATED, use --start-as-non-producing-node instead. "
, "This option will be removed in one of the future versions of cardano-node."
]
, hidden
]

-- | A parser which returns `Nothing` or `Just True`; the default value is set
-- in `defaultPartialNodeConfiguration`. This allows to set this option either
-- in the configuration file or as command line flag.
parseStartAsNonProducingNode :: Parser (Maybe Bool)
parseStartAsNonProducingNode =
flag Nothing (Just True) $ mconcat
[ long "start-as-non-producing-node"
, help $ mconcat
[ "Start the node as a non block producing node even if "
, "credentials are specified."
]
]


-- | Produce just the brief help header for a given CLI option parser,
-- without the options.
parserHelpHeader :: String -> Opt.Parser a -> OptI.Doc
Expand Down
2 changes: 1 addition & 1 deletion cardano-node/src/Cardano/Node/Protocol/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
shelleyGenesisHash,
shelleyBasedLeaderCredentials = shelleyLeaderCredentials
}
, Consensus.cardanoProtocolVersion = ProtVer (natVersion @10) 3
, Consensus.cardanoProtocolVersion = ProtVer (natVersion @10) 6
-- The remaining arguments specify the parameters needed to transition between two eras
, Consensus.cardanoLedgerTransitionConfig =
Ledger.mkLatestTransitionConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,17 @@ calculateForgingStats stats _context
TraceNodeCannotForge {} =
pure $ stats { fsNodeCannotForgeNum = fsNodeCannotForgeNum stats + 1 }
calculateForgingStats stats _context
TraceNodeIsLeader {} =
pure $ stats { fsNodeIsLeaderNum = fsNodeIsLeaderNum stats + 1 }
(TraceNodeIsLeader (SlotNo slot)) =
pure $ stats { fsNodeIsLeaderNum = fsNodeIsLeaderNum stats + 1
, fsLastSlot = fromIntegral slot }
calculateForgingStats stats _context
TraceForgedBlock {} =
pure $ stats { fsBlocksForgedNum = fsBlocksForgedNum stats + 1 }
calculateForgingStats stats _context
(TraceNodeNotLeader (SlotNo slot')) =
-- Node is not a leader again: The number of blocks forged by
-- this node should now be equal to the number of slots when
-- this node was a leader.
let slot = fromIntegral slot'
in if fsLastSlot stats == 0 || succ (fsLastSlot stats) == slot
then pure $ stats { fsLastSlot = slot }
Expand Down
21 changes: 21 additions & 0 deletions cardano-node/src/Cardano/Node/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module Cardano.Node.Types
, PeerSnapshotFile (..)
, CheckpointsFile(..)
, ProtocolFilepaths (..)
, hasProtocolFile
, GenesisHash(..)
, CheckpointsHash(..)
, MaxConcurrencyBulkSync(..)
Expand Down Expand Up @@ -50,6 +51,7 @@ import Ouroboros.Network.NodeToNode (DiffusionMode (..))
import Control.Exception
import Data.Aeson
import Data.ByteString (ByteString)
import Data.Maybe (isJust)
import Data.Monoid (Last (..))
import Data.String (IsString)
import Data.Text (Text)
Expand Down Expand Up @@ -174,6 +176,25 @@ data ProtocolFilepaths =
, shelleyBulkCredsFile :: !(Maybe FilePath)
} deriving (Eq, Show)

-- | If any of the 'ProtocolFilepath` is given `PeerSharing` option will be
-- disabled by default.
--
hasProtocolFile :: ProtocolFilepaths -> Bool
hasProtocolFile ProtocolFilepaths {
byronCertFile,
byronKeyFile,
shelleyKESFile,
shelleyVRFFile,
shelleyCertFile,
shelleyBulkCredsFile
}
= isJust byronCertFile
|| isJust byronKeyFile
|| isJust shelleyKESFile
|| isJust shelleyVRFFile
|| isJust shelleyCertFile
|| isJust shelleyBulkCredsFile

newtype GenesisHash = GenesisHash (Crypto.Hash Crypto.Blake2b_256 ByteString)
deriving newtype (Eq, Show, ToJSON, FromJSON)

Expand Down
4 changes: 2 additions & 2 deletions cardano-submit-api/cardano-submit-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ library
, cardano-api ^>= 10.16
, cardano-binary
, cardano-cli ^>= 10.11
, cardano-crypto-class ^>= 2.2
, cardano-crypto-class ^>= 2.2.3.2
, http-media
, iohk-monitoring
, mtl
, network
, optparse-applicative-fork
, ouroboros-consensus-cardano
, ouroboros-network ^>= 0.21.2
, ouroboros-network ^>= 0.21.4
, ouroboros-network-protocols
, prometheus >= 2.2.4
, servant
Expand Down
2 changes: 1 addition & 1 deletion cardano-testnet/cardano-testnet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ library
, network
, network-mux
, optparse-applicative-fork
, ouroboros-network ^>= 0.21
, ouroboros-network ^>= 0.21.4
, ouroboros-network-api
, prettyprinter
, process
Expand Down
14 changes: 7 additions & 7 deletions cardano-tracer/cardano-tracer.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ library
, mime-mail
, network-mux >= 0.8
, optparse-applicative
, ouroboros-network ^>= 0.21.2
, ouroboros-network-api ^>= 0.14
, ouroboros-network ^>= 0.21.4
, ouroboros-network-api ^>= 0.14.1
, ouroboros-network-framework
, signal
, slugify
Expand Down Expand Up @@ -250,7 +250,7 @@ library demo-forwarder-lib
, generic-data
, network-mux
, optparse-applicative-fork >= 0.18.1
, ouroboros-network-api ^>= 0.14
, ouroboros-network-api ^>= 0.14.1
, ouroboros-network-framework
, tasty-quickcheck
, time
Expand Down Expand Up @@ -293,7 +293,7 @@ library demo-acceptor-lib
, filepath
, generic-data
, optparse-applicative-fork >= 0.18.1
, ouroboros-network-api ^>= 0.14
, ouroboros-network-api ^>= 0.14.1
, stm <2.5.2 || >=2.5.3
, text
, tasty-quickcheck
Expand Down Expand Up @@ -352,7 +352,7 @@ test-suite cardano-tracer-test
, generic-data
, network-mux
, optparse-applicative-fork >= 0.18.1
, ouroboros-network-api ^>= 0.14
, ouroboros-network-api ^>= 0.14.1
, ouroboros-network-framework
, stm <2.5.2 || >=2.5.3
, tasty
Expand Down Expand Up @@ -411,8 +411,8 @@ test-suite cardano-tracer-test-ext
, Glob
, network-mux
, optparse-applicative-fork >= 0.18.1
, ouroboros-network ^>= 0.21.2
, ouroboros-network-api ^>= 0.14
, ouroboros-network ^>= 0.21.4
, ouroboros-network-api ^>= 0.14.1
, ouroboros-network-framework
, process
, QuickCheck
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading