Skip to content

Commit

Permalink
Merge branch 'master' into mgalazyn/fix/testnet-increase-socket-liste…
Browse files Browse the repository at this point in the history
…n-timeout
  • Loading branch information
carbolymer authored Sep 19, 2024
2 parents 3fa8747 + 341ea87 commit fc1c4f3
Show file tree
Hide file tree
Showing 58 changed files with 885 additions and 541 deletions.
1 change: 0 additions & 1 deletion bench/cardano-profile/cardano-profile.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ license: Apache-2.0
license-files: LICENSE
NOTICE
build-type: Simple
extra-source-files: README.md
data-files: data/all-profiles.json
data/ci-test-bage.json
data/genesis/epoch-timeline.json
Expand Down
2 changes: 1 addition & 1 deletion bench/locli/locli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ library
, optparse-generic
, ouroboros-consensus
-- for Data.SOP.Strict:
, ouroboros-network ^>= 0.16.1
, ouroboros-network ^>= 0.17
, ouroboros-network-api
, process
, quiet
Expand Down
8 changes: 4 additions & 4 deletions bench/plutus-scripts-bench/plutus-scripts-bench.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ library
-- IOG dependencies
--------------------------
build-depends:
, cardano-api ^>=9.2
, plutus-ledger-api ^>=1.31
, plutus-tx ^>=1.31
, plutus-tx-plugin ^>=1.31
, cardano-api ^>=9.3
, plutus-ledger-api ^>=1.32
, plutus-tx ^>=1.32
, plutus-tx-plugin ^>=1.32

------------------------
-- Non-IOG dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,38 @@ module Cardano.Benchmarking.GeneratorTx.SubmissionClient
, txSubmissionClient
) where

import Cardano.Prelude hiding (ByteString, atomically, retry, state, threadDelay)
import Prelude (error, fail)

import Control.Arrow ((&&&))

import qualified Data.List as L
import qualified Data.List.Extra as L
import qualified Data.List.NonEmpty as NE
import qualified Data.Text as T
import Cardano.Api hiding (Active)
import Cardano.Api.Shelley (fromShelleyTxId, toConsensusGenTx)

import Cardano.Benchmarking.LogTypes
import Cardano.Benchmarking.Types
import Cardano.Logging
import Cardano.Prelude hiding (ByteString, atomically, retry, state, threadDelay)
import Cardano.Tracing.OrphanInstances.Byron ()
import Cardano.Tracing.OrphanInstances.Common ()
import Cardano.Tracing.OrphanInstances.Consensus ()
import Cardano.Tracing.OrphanInstances.Network ()
import Cardano.Tracing.OrphanInstances.Shelley ()

import qualified Ouroboros.Consensus.Cardano as Consensus (CardanoBlock)
import qualified Ouroboros.Consensus.Cardano.Block as Block
(TxId (GenTxIdAllegra, GenTxIdAlonzo, GenTxIdBabbage, GenTxIdConway, GenTxIdMary, GenTxIdShelley))
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTx, GenTxId, txInBlockSize)
import qualified Ouroboros.Consensus.Ledger.SupportsMempool as Mempool
import Ouroboros.Consensus.Shelley.Eras (StandardCrypto)
import qualified Ouroboros.Consensus.Shelley.Ledger.Mempool as Mempool (TxId (ShelleyTxId))

import qualified Ouroboros.Consensus.Cardano.Block as Block
(TxId (GenTxIdAllegra, GenTxIdAlonzo, GenTxIdBabbage, GenTxIdConway, GenTxIdMary, GenTxIdShelley))

import Ouroboros.Network.Protocol.TxSubmission2.Client (ClientStIdle (..),
ClientStTxIds (..), ClientStTxs (..), TxSubmissionClient (..))
import Ouroboros.Network.Protocol.TxSubmission2.Type (BlockingReplyList (..),
TokBlockingStyle (..), TxSizeInBytes)
NumTxIdsToAck (..), NumTxIdsToReq (..), TokBlockingStyle (..))
import Ouroboros.Network.SizeInBytes

import Cardano.Api hiding (Active)
import Cardano.Api.Shelley (fromShelleyTxId, toConsensusGenTx)

import Cardano.Logging
import Prelude (error, fail)

import Cardano.Benchmarking.LogTypes
import Cardano.Benchmarking.Types
import Control.Arrow ((&&&))
import qualified Data.List as L
import qualified Data.List.Extra as L
import qualified Data.List.NonEmpty as NE
import qualified Data.Text as T
type CardanoBlock = Consensus.CardanoBlock StandardCrypto

data SubmissionThreadStats
Expand Down Expand Up @@ -129,10 +124,10 @@ txSubmissionClient tr bmtr initialTxSource endOfProtocolCallback =
requestTxIds :: forall blocking.
LocalState era
-> TokBlockingStyle blocking
-> Word16
-> Word16
-> NumTxIdsToAck
-> NumTxIdsToReq
-> m (ClientStTxIds blocking (GenTxId CardanoBlock) (GenTx CardanoBlock) m ())
requestTxIds state blocking ackNum reqNum = do
requestTxIds state blocking (NumTxIdsToAck ackNum) (NumTxIdsToReq reqNum) = do
let ack = Ack $ fromIntegral ackNum
req = Req $ fromIntegral reqNum
traceWith tr $ reqIdsTrace ack req blocking
Expand Down Expand Up @@ -182,8 +177,8 @@ txSubmissionClient tr bmtr initialTxSource endOfProtocolCallback =
, stsUnavailable =
stsUnavailable stats + Unav (length missIds)}))

txToIdSize :: tx -> (GenTxId CardanoBlock, TxSizeInBytes)
txToIdSize = (Mempool.txId &&& txInBlockSize) . toGenTx
txToIdSize :: tx -> (GenTxId CardanoBlock, SizeInBytes)
txToIdSize = (Mempool.txId &&& (SizeInBytes . txInBlockSize)) . toGenTx

toGenTx :: tx -> GenTx CardanoBlock
toGenTx tx = toConsensusGenTx $ TxInMode (shelleyBasedEra @era) tx
Expand Down
16 changes: 8 additions & 8 deletions bench/tx-generator/src/Cardano/TxGenerator/Setup/NodeConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ module Cardano.TxGenerator.Setup.NodeConfig
(module Cardano.TxGenerator.Setup.NodeConfig)
where

import Control.Applicative (Const (Const), getConst)
import Control.Monad.Trans.Except (runExceptT)
import Data.Bifunctor (first)
import Data.Monoid

import qualified Ouroboros.Consensus.Cardano as Consensus

import Cardano.Api (BlockType (..), ProtocolInfoArgs (..))

import qualified Cardano.Ledger.Api.Transition as Ledger (tcShelleyGenesisL)
import Cardano.Node.Configuration.POM
import Cardano.Node.Handlers.Shutdown (ShutdownConfig (..))
Expand All @@ -25,6 +19,12 @@ import Cardano.Node.Types (ConfigYamlFilePath (..), GenesisFile,
NodeProtocolConfiguration (..), NodeShelleyProtocolConfiguration (..),
ProtocolFilepaths (..))
import Cardano.TxGenerator.Types
import qualified Ouroboros.Consensus.Cardano.Node as Consensus

import Control.Applicative (Const (Const), getConst)
import Control.Monad.Trans.Except (runExceptT)
import Data.Bifunctor (first)
import Data.Monoid


-- | extract genesis from a Cardano protocol
Expand All @@ -35,7 +35,7 @@ getGenesis (SomeConsensusProtocol CardanoBlockType proto)
= getConst $ Ledger.tcShelleyGenesisL Const transCfg
where
ProtocolInfoArgsCardano Consensus.CardanoProtocolParams
{ Consensus.ledgerTransitionConfig = transCfg
{ Consensus.cardanoLedgerTransitionConfig = transCfg
} = proto

-- | extract the path to genesis file from a NodeConfiguration for Cardano protocol
Expand Down
4 changes: 2 additions & 2 deletions bench/tx-generator/tx-generator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ library
, attoparsec-aeson
, base16-bytestring
, bytestring
, cardano-api ^>= 9.2
, cardano-api ^>= 9.3
, cardano-binary
, cardano-cli ^>= 9.3
, cardano-cli ^>= 9.4
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-data
Expand Down
3 changes: 2 additions & 1 deletion 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 2024-09-05T18:39:40Z
, cardano-haskell-packages 2024-09-05T16:30:09Z
, cardano-haskell-packages 2024-09-10T12:51:27Z

packages:
cardano-node
Expand Down Expand Up @@ -66,3 +66,4 @@ allow-newer:
-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

4 changes: 2 additions & 2 deletions cardano-node-chairman/cardano-node-chairman.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ executable cardano-node-chairman
build-depends: cardano-api
, cardano-crypto-class
, cardano-git-rev ^>= 0.2.2
, cardano-node ^>= 9.1
, cardano-node ^>= 9.2
, cardano-prelude
, containers
, contra-tracer
Expand Down Expand Up @@ -89,5 +89,5 @@ test-suite chairman-tests
ghc-options: -threaded -rtsopts "-with-rtsopts=-N -T"

build-tool-depends: cardano-node:cardano-node
, cardano-cli:cardano-cli ^>= 9.3
, cardano-cli:cardano-cli ^>= 9.4
, cardano-node-chairman:cardano-node-chairman
18 changes: 9 additions & 9 deletions cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.0

name: cardano-node
version: 9.1.0
version: 9.2.0
synopsis: The cardano full node
description: The cardano full node.
category: Cardano,
Expand Down Expand Up @@ -38,8 +38,8 @@ common project-config
-Wpartial-fields
-Wredundant-constraints
-Wunused-packages
common maybe-Win32
if os(windows)
common maybe-Win32
if os(windows)
build-depends: Win32

common maybe-unix
Expand All @@ -55,7 +55,7 @@ common text
library
import: project-config
, maybe-unix
, maybe-Win32
, maybe-Win32
, text
if flag(unexpected_thunks)
cpp-options: -DUNEXPECTED_THUNKS
Expand Down Expand Up @@ -145,7 +145,7 @@ library
, async
, base16-bytestring
, bytestring
, cardano-api ^>= 9.2
, cardano-api ^>= 9.3
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-git-rev ^>=0.2.2
Expand Down Expand Up @@ -187,13 +187,13 @@ library
, nothunks
, optparse-applicative-fork >= 0.18.1
, ouroboros-consensus ^>= 0.20
, ouroboros-consensus-cardano ^>= 0.18
, ouroboros-consensus-cardano ^>= 0.19
, ouroboros-consensus-diffusion ^>= 0.17
, ouroboros-consensus-protocol
, ouroboros-network-api ^>= 0.7.3
, ouroboros-network ^>= 0.16.1
, ouroboros-network-api ^>= 0.9
, ouroboros-network ^>= 0.17
, ouroboros-network-framework
, ouroboros-network-protocols ^>= 0.9
, ouroboros-network-protocols ^>= 0.10
, prettyprinter
, prettyprinter-ansi-terminal
, psqueues
Expand Down
10 changes: 6 additions & 4 deletions cardano-node/src/Cardano/Node/Configuration/POM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import Cardano.Tracing.Config
import Cardano.Tracing.OrphanInstances.Network ()
import Ouroboros.Consensus.Mempool (MempoolCapacityBytes (..),
MempoolCapacityBytesOverride (..))
import Ouroboros.Consensus.Node (NodeDatabasePaths (..))
import qualified Ouroboros.Consensus.Node as Consensus (NetworkP2PMode (..))
import Ouroboros.Consensus.Storage.LedgerDB.DiskPolicy (NumOfDiskSnapshots (..),
SnapshotInterval (..))
Expand Down Expand Up @@ -91,7 +92,7 @@ data NodeConfiguration
-- (logging, tracing, protocol, slot length etc)
, ncConfigFile :: !ConfigYamlFilePath
, ncTopologyFile :: !TopologyFile
, ncDatabaseFile :: !DbFile
, ncDatabaseFile :: !NodeDatabasePaths
, ncProtocolFiles :: !ProtocolFilepaths
, ncValidateDB :: !Bool
, ncShutdownConfig :: !ShutdownConfig
Expand Down Expand Up @@ -173,7 +174,7 @@ data PartialNodeConfiguration
-- (logging, tracing, protocol, slot length etc)
, pncConfigFile :: !(Last ConfigYamlFilePath)
, pncTopologyFile :: !(Last TopologyFile)
, pncDatabaseFile :: !(Last DbFile)
, pncDatabaseFile :: !(Last NodeDatabasePaths)
, pncProtocolFiles :: !(Last ProtocolFilepaths)
, pncValidateDB :: !(Last Bool)
, pncShutdownConfig :: !(Last ShutdownConfig)
Expand Down Expand Up @@ -242,6 +243,7 @@ instance FromJSON PartialNodeConfiguration where

-- Node parameters, not protocol-specific
pncSocketPath <- Last <$> v .:? "SocketPath"
pncDatabaseFile <- Last <$> v .:? "DatabasePath"
pncDiffusionMode
<- Last . fmap getDiffusionMode <$> v .:? "DiffusionMode"
pncNumOfDiskSnapshots
Expand Down Expand Up @@ -336,7 +338,7 @@ instance FromJSON PartialNodeConfiguration where
, pncTraceForwardSocket = mempty
, pncConfigFile = mempty
, pncTopologyFile = mempty
, pncDatabaseFile = mempty
, pncDatabaseFile
, pncProtocolFiles = mempty
, pncValidateDB = mempty
, pncShutdownConfig = mempty
Expand Down Expand Up @@ -492,7 +494,7 @@ defaultPartialNodeConfiguration :: PartialNodeConfiguration
defaultPartialNodeConfiguration =
PartialNodeConfiguration
{ pncConfigFile = Last . Just $ ConfigYamlFilePath "configuration/cardano/mainnet-config.json"
, pncDatabaseFile = Last . Just $ DbFile "mainnet/db/"
, pncDatabaseFile = Last . Just $ OnePathForAllDbs "mainnet/db/"
, pncLoggingSwitch = Last $ Just True
, pncSocketConfig = Last . Just $ SocketConfig mempty mempty mempty mempty
, pncDiffusionMode = Last $ Just InitiatorAndResponderDiffusionMode
Expand Down
16 changes: 16 additions & 0 deletions cardano-node/src/Cardano/Node/Orphans.hs
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE StandaloneDeriving #-}

{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Node.Orphans () where

import Cardano.Api ()

import Ouroboros.Consensus.Node
import qualified Data.Text as Text
import Ouroboros.Network.NodeToNode (AcceptedConnectionsLimit (..))
import Ouroboros.Network.SizeInBytes (SizeInBytes (..))

import Data.Aeson.Types
import Text.Printf (PrintfArg (..))

deriving instance Eq NodeDatabasePaths
deriving instance Show NodeDatabasePaths

instance PrintfArg SizeInBytes where
formatArg (SizeInBytes s) = formatArg s

Expand All @@ -38,3 +44,13 @@ instance FromJSON AcceptedConnectionsLimit where
<$> v .: "hardLimit"
<*> v .: "softLimit"
<*> v .: "delay"

instance FromJSON NodeDatabasePaths where
parseJSON o@(Object{})=
withObject "NodeDatabasePaths"
(\v -> MultipleDbPaths
<$> v .: "ImmutableDbPath"
<*> v .: "VolatileDbPath"
) o
parseJSON (String s) = return . OnePathForAllDbs $ Text.unpack s
parseJSON _ = fail "NodeDatabasePaths must be an object or a string"
Loading

0 comments on commit fc1c4f3

Please sign in to comment.