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
20 changes: 16 additions & 4 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
# If you edit these versions, make sure the version in the lonely macos-latest job below is updated accordingly
# TODO add 9.8 again to the versions list when GHC-9.8 gets released with stm > 2.5.2,
# see https://github.com/haskell/stm/issues/76
ghc: ["9.6", "9.12"]
ghc: ["9.6", "9.10"]
cabal: ["3.12"]
sys:
- { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
Expand Down Expand Up @@ -97,6 +97,18 @@ jobs:
with:
use-sodium-vrf: true # default is true

- name: "[Linux] Install grpc dependencies"
if: runner.os == 'Linux'
run: sudo apt install libsnappy-dev protobuf-compiler

- name: "[Windows] Install grpc dependencies"
if: runner.os == 'Windows'
run: /usr/bin/pacman --noconfirm -S mingw-w64-x86_64-snappy mingw-w64-x86_64-protobuf

- name: "[macOS] Install grpc dependencies"
if: runner.os == 'macOS'
run: brew install snappy protobuf

- uses: actions/checkout@v4

- name: Cabal update
Expand Down Expand Up @@ -230,9 +242,9 @@ jobs:
# and will silently fail if msys2 is not in path. See the "Run tests" step.
#
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true

build-complete:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Cardano.Benchmarking.PlutusScripts (findPlutusScript)
#endif
import Control.Exception (SomeException (..), try)
import System.FilePath ((<.>), (</>))
import RIO (runRIO)

import Paths_tx_generator

Expand Down Expand Up @@ -71,7 +72,7 @@ readPlutusScript (Left s)
doLoad fp = second (second (const $ ResolvedToFallback asFileName)) <$> readPlutusScript (Right fp)
readPlutusScript (Right fp)
= runExceptT $ do
script <- firstExceptT ApiError $
script <- runRIO () $
readFileScriptInAnyLang fp
case script of
ScriptInAnyLang (PlutusScriptLanguage _) _ -> pure (script, ResolvedToFileName fp)
Expand Down
1 change: 1 addition & 0 deletions bench/tx-generator/tx-generator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ library
, network
, network-mux
, optparse-applicative-fork
, rio
, ouroboros-consensus >= 0.6
, ouroboros-consensus-cardano >= 0.5
, ouroboros-consensus-diffusion >= 0.7.0
Expand Down
26 changes: 26 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ package plutus-scripts-bench
allow-newer:
, katip:Win32


if impl (ghc >= 9.10)
allow-newer:
-- TODO: remove - this is for protolens
, *:base
, *:ghc-prim

if impl (ghc >= 9.12)
allow-newer:
-- https://github.com/kapralVV/Unique/issues/11
Expand All @@ -72,3 +79,22 @@ if impl (ghc >= 9.12)
-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.


source-repository-package
type: git
location: https://github.com/intersectmbo/cardano-api
-- master @ Fri Jul 25 18:47:11 2025
tag: 1765e37a04a8ed3dd7455e0434c1b2b09fa609a5
--sha256: sha256-XkoP1eBoyQGjmq1n3Oma0OJgxRos5oW4QCQ8HSfAexo=
subdir: cardano-api
cardano-api-gen
cardano-rpc

source-repository-package
type: git
location: https://github.com/intersectmbo/cardano-cli
-- master @ Fri Jul 18 14:45:44 2025
tag: 5dc410f1ec0b234a572e4470c3801fbac783bbeb
--sha256: sha256-f3RviGvNoDu5WX79BgAzPo9bL6PsNBqm+Qt1UlJGe5E=
subdir: cardano-cli
3 changes: 3 additions & 0 deletions cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ library
, cardano-prelude
, cardano-protocol-tpraos >= 1.4
, cardano-slotting >= 0.2
, cardano-rpc ^>= 10.0
, cborg ^>= 0.2.4
, containers
, contra-tracer
Expand Down Expand Up @@ -222,6 +223,7 @@ library
, typed-protocols-stateful >= 0.3
, yaml


executable cardano-node
import: project-config
hs-source-dirs: app
Expand Down Expand Up @@ -257,6 +259,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
28 changes: 25 additions & 3 deletions 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 @@ -35,6 +37,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 qualified Ouroboros.Cardano.Network.Diffusion.Configuration as Cardano
Expand Down Expand Up @@ -202,6 +206,9 @@ data NodeConfiguration
, ncGenesisConfig :: GenesisConfig

, ncResponderCoreAffinityPolicy :: ResponderCoreAffinityPolicy

-- gRPC
, ncRpcConfig :: RpcConfig
} deriving (Eq, Show)

-- | We expose the `Ouroboros.Network.Mux.ForkPolicy` as a `NodeConfiguration` field.
Expand Down Expand Up @@ -283,13 +290,13 @@ data PartialNodeConfiguration
, pncSyncTargetOfKnownBigLedgerPeers :: !(Last Int)
, pncSyncTargetOfEstablishedBigLedgerPeers :: !(Last Int)
, pncSyncTargetOfActiveBigLedgerPeers :: !(Last Int)
-- Consensus mode for diffusion layer
, pncConsensusMode :: !(Last ConsensusMode)

-- Minimum number of active big ledger peers we must be connected to
-- in Genesis mode
, pncMinBigLedgerPeersForTrustedState :: !(Last NumberOfBigLedgerPeers)

-- Consensus mode for diffusion layer
, pncConsensusMode :: !(Last ConsensusMode)

-- Network P2P mode
, pncEnableP2P :: !(Last NetworkP2PMode)

Expand All @@ -300,6 +307,9 @@ data PartialNodeConfiguration
, pncGenesisConfigFlags :: !(Last GenesisConfigFlags)

, pncResponderCoreAffinityPolicy :: !(Last ResponderCoreAffinityPolicy)

-- gRPC
, pncRpcConfig :: !PartialRpcConfig
} deriving (Eq, Generic, Show)

instance AdjustFilePaths PartialNodeConfiguration where
Expand Down Expand Up @@ -418,6 +428,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 @@ -463,6 +479,7 @@ instance FromJSON PartialNodeConfiguration where
, pncPeerSharing
, pncGenesisConfigFlags
, pncResponderCoreAffinityPolicy
, pncRpcConfig
}
where
parseMempoolCapacityBytesOverride v = parseNoOverride <|> parseOverride
Expand Down Expand Up @@ -710,6 +727,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 @@ -850,6 +868,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 @@ -898,6 +919,7 @@ makeNodeConfiguration pnc = do
, ncConsensusMode
, ncGenesisConfig
, ncResponderCoreAffinityPolicy
, ncRpcConfig
}

ncProtocol :: NodeConfiguration -> Protocol
Expand Down
40 changes: 31 additions & 9 deletions cardano-node/src/Cardano/Node/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,26 @@ 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)
import qualified Data.Text as Text
import Data.Word (Word16, Word32)
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 All @@ -56,7 +55,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 @@ -83,6 +82,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 @@ -141,12 +143,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 @@ -420,6 +425,23 @@ parseStartAsNonProducingNode =
]
]

parseRpcConfig :: Parser PartialRpcConfig
parseRpcConfig = do
isEnabled <- lastOption parseRpcToggle
socketPath <- lastOption parseRpcSocketPath
pure $ RpcConfig isEnabled socketPath mempty
where
parseRpcToggle :: Parser Bool
parseRpcToggle =
Opt.switch (
long "grpc-enable"
<> help "[EXPERIMENTAL] Enable node gRPC endpoint."
)
parseRpcSocketPath :: Parser SocketPath
parseRpcSocketPath =
parseSocketPath
"gprc-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