-
Notifications
You must be signed in to change notification settings - Fork 752
gRPC: Add gRPC interface to cardano-node with tests in cardano-testnet #6273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f87b8a8
13b5255
e3a5465
971fb11
9ad4fb5
c83492f
54c0d9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,8 @@ | |
|
|
||
| {-# OPTIONS_GHC -Wno-noncanonical-monoid-instances #-} | ||
|
|
||
| {- HLINT ignore "Functor law" -} | ||
|
|
||
carbolymer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| module Cardano.Node.Configuration.POM | ||
| ( NodeConfiguration (..) | ||
| , ResponderCoreAffinityPolicy (..) | ||
|
|
@@ -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 | ||
|
|
@@ -196,6 +200,9 @@ data NodeConfiguration | |
| , ncGenesisConfig :: GenesisConfig | ||
|
|
||
| , ncResponderCoreAffinityPolicy :: ResponderCoreAffinityPolicy | ||
|
|
||
| -- gRPC | ||
| , ncRpcConfig :: RpcConfig | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. @jasagredo is working on moving the cardano node configuration machinery to |
||
| } deriving (Eq, Show) | ||
|
|
||
| -- | We expose the `Ouroboros.Network.Mux.ForkPolicy` as a `NodeConfiguration` field. | ||
|
|
@@ -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) | ||
|
|
@@ -296,6 +304,9 @@ data PartialNodeConfiguration | |
| , pncGenesisConfigFlags :: !(Last GenesisConfigFlags) | ||
|
|
||
| , pncResponderCoreAffinityPolicy :: !(Last ResponderCoreAffinityPolicy) | ||
|
|
||
| -- gRPC | ||
| , pncRpcConfig :: !PartialRpcConfig | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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 | ||
|
|
@@ -459,6 +476,7 @@ instance FromJSON PartialNodeConfiguration where | |
| , pncPeerSharing | ||
| , pncGenesisConfigFlags | ||
| , pncResponderCoreAffinityPolicy | ||
| , pncRpcConfig | ||
| } | ||
| where | ||
| parseMempoolCapacityBytesOverride v = parseNoOverride <|> parseOverride | ||
|
|
@@ -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) | ||
|
|
@@ -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) | ||
|
|
@@ -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 | ||
|
|
@@ -922,6 +944,7 @@ makeNodeConfiguration pnc = do | |
| , ncConsensusMode | ||
| , ncGenesisConfig | ||
| , ncResponderCoreAffinityPolicy | ||
| , ncRpcConfig | ||
| } | ||
|
|
||
| ncProtocol :: NodeConfiguration -> Protocol | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.