Skip to content
Open
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
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ contact_links:
- name: Cardano API Issues
url: https://github.com/IntersectMBO/cardano-api/issues
about: Report API related issues here
- name: Cardano gRPC Issues
url: https://github.com/IntersectMBO/cardano-api/issues
about: Report gRPC endpoint related issues here
3 changes: 3 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ jobs:
with:
use-sodium-vrf: true # default is true

- name: Install gRPC dependencies
uses: intersectmbo/cardano-api/.github/actions/grpc-deps@a7bd74dfa6ccb1eb04f69791f978a3b9e0cc63ca

- uses: actions/checkout@v4

- name: Cache and install Cabal dependencies
Expand Down
34 changes: 28 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 2026-02-06T20:27:32Z
, cardano-haskell-packages 2026-03-03T10:50:34Z
, cardano-haskell-packages 2026-03-11T22:13:22Z

constraints:
-- haskell.nix patch does not work for 1.6.8
Expand Down Expand Up @@ -68,12 +68,34 @@ allow-newer:

if impl(ghc >= 9.12)
allow-newer:
-- https://github.com/kapralVV/Unique/issues/11
, Unique:hashable

-- https://github.com/Gabriella439/Haskell-Pipes-Safe-Library/pull/70
, pipes-safe:base
-- we need newer io-classes: https://github.com/input-output-hk/typed-protocols/tree/coot/io-classes-1.9
, io-classes:time
, ouroboros-network:time
, nothunks:time
, network-mux:time
, cardano-ping:time

-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

-- GHC 9.12 support https://github.com/google/proto-lens/pull/519
source-repository-package
type: git
location: https://github.com/carbolymer/proto-lens
tag: 732ff478957507bdbdaf72606281df3fcb6b0121
--sha256: sha256-DR2hxFDNMICcueggBObhi+L5bKeake/Mj4N0078P3SA=
subdir:
discrimination-ieee754
proto-lens-arbitrary
proto-lens-benchmarks
proto-lens-discrimination
proto-lens-optparse
proto-lens-protobuf-types
proto-lens-protoc
proto-lens-runtime
proto-lens-setup
proto-lens-tests-dep
proto-lens-tests
proto-lens

3 changes: 3 additions & 0 deletions cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ library
Cardano.Node.Tracing.Tracers.NodeVersion
Cardano.Node.Tracing.Tracers.P2P
Cardano.Node.Tracing.Tracers.Resources
Cardano.Node.Tracing.Tracers.Rpc
Cardano.Node.Tracing.Tracers.Shutdown
Cardano.Node.Tracing.Tracers.Startup
Cardano.Node.Types
Expand Down Expand Up @@ -155,6 +156,7 @@ library
, cardano-prelude
, cardano-protocol-tpraos >= 1.4
, cardano-slotting >= 0.2
, cardano-rpc ^>= 10.1
, cborg ^>= 0.2.4
, containers
, contra-tracer
Expand Down Expand Up @@ -252,6 +254,7 @@ test-suite cardano-node-test
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-api
, cardano-rpc
, cardano-protocol-tpraos
, cardano-node
, cardano-slotting
Expand Down
25 changes: 24 additions & 1 deletion cardano-node/src/Cardano/Node/Configuration/POM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

{-# OPTIONS_GHC -Wno-noncanonical-monoid-instances #-}

{- HLINT ignore "Functor law" -}

module Cardano.Node.Configuration.POM
( NodeConfiguration (..)
, ResponderCoreAffinityPolicy (..)
Expand All @@ -34,6 +36,8 @@ import Cardano.Node.Configuration.Socket (SocketConfig (..))
import Cardano.Node.Handlers.Shutdown
import Cardano.Node.Protocol.Types (Protocol (..))
import Cardano.Node.Types
import Cardano.Rpc.Server.Config (PartialRpcConfig, RpcConfig, RpcConfigF (..),
makeRpcConfig)
import Cardano.Tracing.Config
import Cardano.Tracing.OrphanInstances.Network ()
import Ouroboros.Consensus.Ledger.SupportsMempool
Expand Down Expand Up @@ -196,6 +200,9 @@ data NodeConfiguration
, ncGenesisConfig :: GenesisConfig

, ncResponderCoreAffinityPolicy :: ResponderCoreAffinityPolicy

-- gRPC
, ncRpcConfig :: RpcConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. @jasagredo is working on moving the cardano node configuration machinery to ouroboros-consensus. To prevent future pain I would run this change by him.

} deriving (Eq, Show)

-- | We expose the `Ouroboros.Network.Mux.ForkPolicy` as a `NodeConfiguration` field.
Expand Down Expand Up @@ -282,6 +289,7 @@ data PartialNodeConfiguration
, pncSyncTargetOfKnownBigLedgerPeers :: !(Last Int)
, pncSyncTargetOfEstablishedBigLedgerPeers :: !(Last Int)
, pncSyncTargetOfActiveBigLedgerPeers :: !(Last Int)

-- Minimum number of active big ledger peers we must be connected to
-- in Genesis mode
, pncMinBigLedgerPeersForTrustedState :: !(Last NumberOfBigLedgerPeers)
Expand All @@ -296,6 +304,9 @@ data PartialNodeConfiguration
, pncGenesisConfigFlags :: !(Last GenesisConfigFlags)

, pncResponderCoreAffinityPolicy :: !(Last ResponderCoreAffinityPolicy)

-- gRPC
, pncRpcConfig :: !PartialRpcConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here regarding the configuration being moved to consensus.

} deriving (Eq, Generic, Show)

instance AdjustFilePaths PartialNodeConfiguration where
Expand Down Expand Up @@ -412,6 +423,12 @@ instance FromJSON PartialNodeConfiguration where
<$> v .:? "ResponderCoreAffinityPolicy"
<*> v .:? "ForkPolicy" -- deprecated

pncRpcConfig <-
RpcConfig
<$> (Last <$> v .:? "EnableRpc")
<*> (Last <$> v .:? "RpcSocketPath")
<*> pure mempty

pure PartialNodeConfiguration {
pncProtocolConfig
, pncSocketConfig = Last . Just $ SocketConfig mempty mempty mempty pncSocketPath
Expand Down Expand Up @@ -459,6 +476,7 @@ instance FromJSON PartialNodeConfiguration where
, pncPeerSharing
, pncGenesisConfigFlags
, pncResponderCoreAffinityPolicy
, pncRpcConfig
}
where
parseMempoolCapacityBytesOverride v = parseNoOverride <|> parseOverride
Expand Down Expand Up @@ -724,6 +742,7 @@ defaultPartialNodeConfiguration =
, pncGenesisConfigFlags = Last (Just defaultGenesisConfigFlags)
-- https://ouroboros-consensus.cardano.intersectmbo.org/haddocks/ouroboros-consensus-diffusion/Ouroboros-Consensus-Node-Genesis.html#v:defaultGenesisConfigFlags
, pncResponderCoreAffinityPolicy = Last $ Just NoResponderCoreAffinity
, pncRpcConfig = mempty
}

lastOption :: Parser a -> Parser (Last a)
Expand Down Expand Up @@ -821,7 +840,7 @@ makeNodeConfiguration pnc = do
, getLast (pncMempoolTimeoutHard pnc)
, getLast (pncMempoolTimeoutCapacity pnc)
)
(ncMempoolTimeoutSoft, ncMempoolTimeoutHard, ncMempoolTimeoutCapacity) <-
(ncMempoolTimeoutSoft, ncMempoolTimeoutHard, ncMempoolTimeoutCapacity) <-
case mempoolTimeouts of
(Just s, Just h, Just c) -> pure (s, h, c)
(Nothing, Nothing, Nothing) -> pure (1, 1.5, 5)
Expand Down Expand Up @@ -874,6 +893,9 @@ makeNodeConfiguration pnc = do
experimentalProtocols <-
lastToEither "Missing ExperimentalProtocolsEnabled" $
pncExperimentalProtocolsEnabled pnc

ncRpcConfig <- makeRpcConfig $ (pncRpcConfig pnc){nodeSocketPath=ncSocketPath socketConfig}

return $ NodeConfiguration
{ ncConfigFile = configFile
, ncTopologyFile = topologyFile
Expand Down Expand Up @@ -922,6 +944,7 @@ makeNodeConfiguration pnc = do
, ncConsensusMode
, ncGenesisConfig
, ncResponderCoreAffinityPolicy
, ncRpcConfig
}

ncProtocol :: NodeConfiguration -> Protocol
Expand Down
38 changes: 31 additions & 7 deletions cardano-node/src/Cardano/Node/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ module Cardano.Node.Parsers

import Cardano.Logging.Types
import qualified Cardano.Logging.Types as Net
import Cardano.Node.Configuration.NodeAddress (
NodeHostIPv4Address (NodeHostIPv4Address), File (..),
import Cardano.Node.Configuration.NodeAddress (File (..),
NodeHostIPv4Address (NodeHostIPv4Address),
NodeHostIPv6Address (NodeHostIPv6Address), PortNumber, SocketPath)
import Cardano.Node.Configuration.POM (PartialNodeConfiguration (..), lastOption)
import Cardano.Node.Configuration.Socket
import Cardano.Node.Handlers.Shutdown
import Cardano.Node.Types
import Cardano.Prelude (ConvertText (..))
import Cardano.Rpc.Server.Config (PartialRpcConfig, RpcConfigF (..))
import Ouroboros.Consensus.Ledger.SupportsMempool
import Ouroboros.Consensus.Node

import Data.Foldable
import Data.Char (isDigit)
import Data.Foldable
import Data.Maybe (fromMaybe)
import Data.Monoid (Last (..))
import Data.Text (Text)
Expand Down Expand Up @@ -57,7 +58,7 @@ nodeRunParser = do
topFp <- lastOption parseTopologyFile
dbFp <- lastOption parseNodeDatabasePaths
validate <- lastOption parseValidateDB
socketFp <- lastOption $ parseSocketPath "Path to a cardano-node socket"
socketFp <- lastOption $ parseSocketPath "socket-path" "Path to a cardano-node socket"
traceForwardSocket <- lastOption parseTracerSocketMode
nodeConfigFp <- lastOption parseConfigFile

Expand All @@ -84,6 +85,9 @@ nodeRunParser = do
-- Hidden options (to be removed eventually)
maybeMempoolCapacityOverride <- lastOption parseMempoolCapacityOverride

-- gRPC
pncRpcConfig <- parseRpcConfig

pure $ PartialNodeConfiguration
{ pncSocketConfig =
Last . Just $ SocketConfig
Expand Down Expand Up @@ -144,12 +148,15 @@ nodeRunParser = do
, pncPeerSharing = mempty
, pncGenesisConfigFlags = mempty
, pncResponderCoreAffinityPolicy = mempty
, pncRpcConfig
}

parseSocketPath :: Text -> Parser SocketPath
parseSocketPath helpMessage =
parseSocketPath :: Text -- ^ option name
-> Text -- ^ help text
-> Parser SocketPath
parseSocketPath optionName helpMessage =
fmap File $ strOption $ mconcat
[ long "socket-path"
[ long (toS optionName)
, help (toS helpMessage)
, completer (bashCompleter "file")
, metavar "FILEPATH"
Expand Down Expand Up @@ -423,6 +430,23 @@ parseStartAsNonProducingNode =
]
]

parseRpcConfig :: Parser PartialRpcConfig
parseRpcConfig = do
isEnabled <- lastOption parseRpcToggle
socketPath <- lastOption parseRpcSocketPath
pure $ RpcConfig isEnabled socketPath mempty
where
parseRpcToggle :: Parser Bool
parseRpcToggle =
Opt.flag' True $ mconcat
[ long "grpc-enable"
, help "[EXPERIMENTAL] Enable node gRPC endpoint."
]
parseRpcSocketPath :: Parser SocketPath
parseRpcSocketPath =
parseSocketPath
"grpc-socket-path"
"[EXPERIMENTAL] gRPC socket path. Defaults to rpc.sock in the same directory as node socket."

-- | Produce just the brief help header for a given CLI option parser,
-- without the options.
Expand Down
Loading
Loading