Skip to content
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

collateral balancing test #5980

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
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
14 changes: 11 additions & 3 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 2024-08-20T21:35:22Z
, cardano-haskell-packages 2024-08-18T22:35:14Z
, cardano-haskell-packages 2024-09-09T11:32:44Z

packages:
cardano-node
Expand All @@ -34,8 +34,8 @@ packages:

extra-packages: Cabal

program-options
ghc-options: -Werror
-- program-options
-- ghc-options: -Werror

test-show-details: direct

Expand Down Expand Up @@ -72,3 +72,11 @@ 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.

source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-cli.git
tag: d1d4ddef07614ddbed61b42626e73ae30504382c
--sha256: sha256-sghDLRheKc8I4BAJCggJfH+xotGASg7vkR245EMctrY=
subdir: cardano-cli

2 changes: 1 addition & 1 deletion cardano-node-chairman/cardano-node-chairman.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,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
Expand Up @@ -38,9 +38,9 @@ common project-config
-Wpartial-fields
-Wredundant-constraints
-Wunused-packages
common maybe-Win32
if os(windows)
build-depends: Win32
common maybe-Win32
if os(windows)
build-depends: Win32

common maybe-unix
if !os(windows)
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
7 changes: 4 additions & 3 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 @@ -492,7 +493,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
5 changes: 5 additions & 0 deletions cardano-node/src/Cardano/Node/Orphans.hs
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE StandaloneDeriving #-}

{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Node.Orphans () where

import Cardano.Api ()

import Ouroboros.Consensus.Node
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 Down
50 changes: 39 additions & 11 deletions cardano-node/src/Cardano/Node/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import Cardano.Node.Configuration.Socket
import Cardano.Node.Handlers.Shutdown
import Cardano.Node.Types
import Cardano.Prelude (ConvertText (..))
import Ouroboros.Consensus.Mempool (MempoolCapacityBytes (..),
MempoolCapacityBytesOverride (..))
import Ouroboros.Consensus.Mempool (MempoolCapacityBytes (..))
import Ouroboros.Consensus.Node
import Ouroboros.Consensus.Storage.LedgerDB.DiskPolicy (NumOfDiskSnapshots (..),
SnapshotInterval (..))

Expand Down Expand Up @@ -50,7 +50,7 @@ nodeRunParser :: Parser PartialNodeConfiguration
nodeRunParser = do
-- Filepaths
topFp <- lastOption parseTopologyFile
dbFp <- lastOption parseDbPath
dbFp <- lastOption parseNodeDatabasePaths
validate <- lastOption parseValidateDB
socketFp <- lastOption $ parseSocketPath "Path to a cardano-node socket"
traceForwardSocket <- lastOption parseTracerSocketMode
Expand Down Expand Up @@ -88,7 +88,7 @@ nodeRunParser = do
socketFp
, pncConfigFile = ConfigYamlFilePath <$> nodeConfigFp
, pncTopologyFile = TopologyFile <$> topFp
, pncDatabaseFile = DbFile <$> dbFp
, pncDatabaseFile = dbFp
, pncDiffusionMode = mempty
, pncNumOfDiskSnapshots = numOfDiskSnapshots
, pncSnapshotInterval = snapshotInterval
Expand Down Expand Up @@ -224,14 +224,42 @@ parseMempoolCapacityOverride = parseOverride <|> parseNoOverride
<> help "[DEPRECATED: Set it in config file] Don't override mempool capacity"
)

parseDbPath :: Parser FilePath

parseNodeDatabasePaths :: Parser NodeDatabasePaths
parseNodeDatabasePaths = parseDbPath <|> parseMultipleDbPaths

parseDbPath :: Parser NodeDatabasePaths
parseDbPath =
strOption
( long "database-path"
<> metavar "FILEPATH"
<> help "Directory where the state is stored."
<> completer (bashCompleter "file")
)
fmap OnePathForAllDbs $
strOption $
mconcat
[ long "database-path"
, metavar "FILEPATH"
, help "Directory where the state is stored."
, completer (bashCompleter "file")
]

parseMultipleDbPaths :: Parser NodeDatabasePaths
parseMultipleDbPaths = MultipleDbPaths <$> parseImmutableDbPath <*> parseVolatileDbPath

parseVolatileDbPath :: Parser FilePath
parseVolatileDbPath = strOption $
mconcat
[ long "volatile-database-path"
, metavar "FILEPATH"
, help "Directory where the state is stored."
, completer (bashCompleter "file")
]

parseImmutableDbPath :: Parser FilePath
parseImmutableDbPath = strOption $
mconcat
[ long "immutable-database-path"
, metavar "FILEPATH"
, help "Directory where the state is stored."
, completer (bashCompleter "file")
]


parseValidateDB :: Parser Bool
parseValidateDB =
Expand Down
Loading
Loading