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
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 @@ -82,10 +82,10 @@ library
-- IOG dependencies
--------------------------
build-depends:
, cardano-api ^>=10.19
, plutus-ledger-api ^>=1.53
, plutus-tx ^>=1.53
, plutus-tx-plugin ^>=1.53
, cardano-api ^>=10.20
, plutus-ledger-api ^>=1.56
, plutus-tx ^>=1.56
, plutus-tx-plugin ^>=1.56

------------------------
-- Non-IOG dependencies
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 @@ -111,9 +111,9 @@ library
, attoparsec-aeson
, base16-bytestring
, bytestring
, cardano-api ^>= 10.19
, cardano-api ^>= 10.20
, cardano-binary
, cardano-cli ^>= 10.13
, cardano-cli ^>= 10.14
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-data
Expand Down
78 changes: 75 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ repository cardano-haskell-packages
-- See CONTRIBUTING for information about these, including some Nix commands
-- you need to run if you change them
index-state:
, hackage.haskell.org 2025-10-17T00:26:22Z
, cardano-haskell-packages 2025-11-20T19:55:27Z
, hackage.haskell.org 2025-12-03T15:53:31Z
, cardano-haskell-packages 2025-12-16T19:04:42Z

packages:
cardano-node
cardano-node-capi
cardano-node-chairman
-- cardano-node-chairman
cardano-submit-api
cardano-testnet
cardano-tracer
Expand Down Expand Up @@ -72,3 +72,75 @@ 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-ledger
tag: 71ec2758703b75b5a6187438a08eb3386773850e
--sha256: sha256-elIA+esNslfejQEuoYszrG7MkKJVc1AulUBDSIIEUEo=
subdir:
eras/allegra/impl
eras/alonzo/impl
eras/alonzo/test-suite
eras/babbage/impl
eras/byron/chain/executable-spec
eras/byron/crypto
eras/byron/ledger/executable-spec
eras/byron/ledger/impl
eras/conway/impl
eras/dijkstra/impl
eras/mary/impl
eras/shelley-ma/test-suite
eras/shelley/impl
eras/shelley/test-suite
libs/cardano-data
libs/cardano-ledger-api
libs/cardano-ledger-binary
libs/cardano-ledger-core
libs/cardano-protocol-tpraos
libs/non-integral
libs/plutus-preprocessor
libs/small-steps
libs/vector-map

source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-consensus
tag: c6c00805ea5b450e16efdfe22a3b3b6f3a360c82
--sha256: sha256-DtiaTJI5uAt4CZEv/OBsv8SSv9/OwK1wm2mMPn56XJE=
subdir:
ouroboros-consensus
ouroboros-consensus-cardano
ouroboros-consensus-diffusion
ouroboros-consensus-protocol
strict-sop-core
sop-extras

-- Backported version of https://github.com/IntersectMBO/ouroboros-network/pull/5161
source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-network
tag: 5f647704cfe1eaa0867af0bf283c817286eeb48d
--sha256: sha256-1qOwV8aGIDI1El7ttDfKv3nrFNh+lR8J5Nq/0WBXsV0=
subdir:
ouroboros-network-api
ouroboros-network
ouroboros-network-framework
ouroboros-network-mock
ouroboros-network-protocols

source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-api
tag: d4bb20eab0c4408990fb7443f7d61cada1b2c5d2
--sha256: sha256-ig7sf+U7rzeDSrmLPhp+FDGVZl2idd+PUbdbDYJgBtE=
subdir:
cardano-api

source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-cli
tag: 4125ec7ef9fa1e0f5b86e0ea5d17d2423f6c9ef1
--sha256: sha256-5aY5qvTJX8rJIRpvRaCZ4LF644o+/WvGnaBcHSqaUTA=
subdir:
cardano-cli
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,12 +44,12 @@ executable cardano-node-chairman
build-depends: cardano-api
, cardano-crypto-class
, cardano-git-rev ^>= 0.2.2
, cardano-ledger-core ^>= 1.18
, cardano-ledger-core ^>= 1.19
, cardano-node ^>= 10.6
, cardano-prelude
, containers
, contra-tracer
, io-classes:{io-classes, strict-stm, si-timers}
, io-classes:{io-classes, strict-stm, si-timers} ^>= 1.8
, optparse-applicative
, ouroboros-consensus
, ouroboros-consensus-cardano
Expand Down
6 changes: 3 additions & 3 deletions cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ library
, async
, base16-bytestring
, bytestring
, cardano-api ^>= 10.19
, cardano-api ^>= 10.20
, cardano-crypto-class ^>=2.2.3.2
, cardano-crypto-wrapper
, cardano-git-rev ^>=0.2.2
Expand Down Expand Up @@ -169,7 +169,7 @@ library
, generic-data
, hashable
, hostname
, io-classes:{io-classes,strict-stm,si-timers} >= 1.5
, io-classes:{io-classes,strict-stm,si-timers} ^>= 1.8
, iohk-monitoring ^>= 0.2
, kes-agent ^>=0.2
, microlens
Expand All @@ -185,7 +185,7 @@ library
, network-mux >= 0.8
, nothunks
, optparse-applicative
, ouroboros-consensus ^>= 0.28
, ouroboros-consensus:{ouroboros-consensus, ouroboros-consensus-lmdb, ouroboros-consensus-lsm} ^>= 0.28
, ouroboros-consensus-cardano ^>= 0.26
, ouroboros-consensus-diffusion ^>= 0.24
, ouroboros-consensus-protocol
Expand Down
76 changes: 43 additions & 33 deletions cardano-node/src/Cardano/Node/Configuration/LedgerDB.hs
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Node.Configuration.LedgerDB (
DeprecatedOptions (..)
, LedgerDbConfiguration (..)
, LedgerDbSelectorFlag(..)
, Gigabytes
, noDeprecatedOptions
, selectorToArgs
) where
DeprecatedOptions (..),
LedgerDbConfiguration (..),
LedgerDbSelectorFlag (..),
Gigabytes,
noDeprecatedOptions,
selectorToArgs,
) where

import Ouroboros.Consensus.Ledger.SupportsProtocol
import Ouroboros.Consensus.Storage.LedgerDB.API
import Ouroboros.Consensus.Storage.LedgerDB.Args
import Ouroboros.Consensus.Storage.LedgerDB.Snapshots
import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.Args as V1
import Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB (LMDBLimits (..))
import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.Args as V2
import Ouroboros.Consensus.Util.Args
import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB as LMDB
import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.InMemory as InMemory
import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.LSM as LSM

import qualified Data.Aeson.Types as Aeson (FromJSON)
import Data.Maybe (fromMaybe)
import Data.SOP.Dict
import Data.Proxy
import System.FilePath
import System.Random (StdGen)

-- | Choose the LedgerDB Backend
--
Expand All @@ -34,21 +41,25 @@ import Data.SOP.Dict
--
-- - 'V1LMDB': uses less memory but is somewhat slower.
--
-- - 'V1InMemory': Not intended for production. It is an in-memory reproduction
-- of the LMDB implementation.
-- - 'V2LSM': Uses the LSM backend.
data LedgerDbSelectorFlag =
V1LMDB
V1.FlushFrequency
-- ^ The frequency at which changes are flushed to the disk.
(Maybe FilePath)
-- ^ Path for the live tables.
-- ^ Path for the live tables. If not provided the default will be used
-- (@<fast-storage>/lmdb@).
(Maybe Gigabytes)
-- ^ A map size can be specified, this is the maximum disk space the LMDB
-- database can fill. If not provided, the default of 16GB will be used.
(Maybe Int)
-- ^ An override to the max number of readers.
| V1InMemory V1.FlushFrequency
| V2InMemory
| V2LSM
(Maybe FilePath)
-- ^ Maybe a custom path to the LSM database. If not provided the default
-- will be used (@<fast-storage>/lsm@).

deriving (Eq, Show)

-- | Some options that existed in the TopLevel were now moved to a
Expand Down Expand Up @@ -118,24 +129,23 @@ toBytes (Gigabytes x) = x * 1024 * 1024 * 1024
-- * The @lmdb-simple@ and @haskell-lmdb@ forked repositories.
-- * The official LMDB API documentation at
-- <http://www.lmdb.tech/doc/group__mdb.html>.
defaultLMDBLimits :: LMDBLimits
defaultLMDBLimits = LMDBLimits {
lmdbMapSize = 16 * 1024 * 1024 * 1024
, lmdbMaxDatabases = 10
, lmdbMaxReaders = 16
defaultLMDBLimits :: LMDB.LMDBLimits
defaultLMDBLimits = LMDB.LMDBLimits {
LMDB.lmdbMapSize = 16 * 1024 * 1024 * 1024
, LMDB.lmdbMaxDatabases = 10
, LMDB.lmdbMaxReaders = 16
}

defaultLMDBPath :: FilePath
defaultLMDBPath = "mainnet/db/lmdb"
defaultLMDBPath :: FilePath -> FilePath
defaultLMDBPath = (</> "lmdb")

selectorToArgs :: LedgerDbSelectorFlag -> Complete LedgerDbFlavorArgs IO
selectorToArgs (V1InMemory ff) = LedgerDbFlavorArgsV1 $ V1.V1Args ff V1.InMemoryBackingStoreArgs
selectorToArgs V2InMemory = LedgerDbFlavorArgsV2 $ V2.V2Args V2.InMemoryHandleArgs
selectorToArgs (V1LMDB ff fp l mxReaders) =
LedgerDbFlavorArgsV1
$ V1.V1Args ff
$ V1.LMDBBackingStoreArgs
(fromMaybe defaultLMDBPath fp)
(maybe id (\overrideMaxReaders lim -> lim { lmdbMaxReaders = overrideMaxReaders }) mxReaders
$ maybe id (\ll lim -> lim { lmdbMapSize = toBytes ll }) l defaultLMDBLimits)
Dict
selectorToArgs :: forall blk. (LedgerSupportsProtocol blk, LedgerSupportsLedgerDB blk) => LedgerDbSelectorFlag -> FilePath -> StdGen -> (LedgerDbBackendArgs IO blk, StdGen)
selectorToArgs V2InMemory _ = InMemory.mkInMemoryArgs
selectorToArgs (V1LMDB ff fp l mxReaders) fastStoragePath =
LMDB.mkLMDBArgs
ff
(fromMaybe (defaultLMDBPath fastStoragePath) fp)
( maybe id (\overrideMaxReaders lim -> lim{LMDB.lmdbMaxReaders = overrideMaxReaders}) mxReaders $
maybe id (\ll lim -> lim{LMDB.lmdbMapSize = toBytes ll}) l defaultLMDBLimits
)
selectorToArgs (V2LSM fp) fastStoragePath = LSM.mkLSMArgs (Proxy @blk) (fromMaybe "lsm" fp) fastStoragePath
6 changes: 3 additions & 3 deletions cardano-node/src/Cardano/Node/Configuration/POM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -466,16 +466,16 @@ instance FromJSON PartialNodeConfiguration where
qsize <- (fmap RequestedQueryBatchSize <$> o .:? "QueryBatchSize") .!= DefaultQueryBatchSize
backend <- o .:? "Backend" .!= "V2InMemory"
selector <- case backend of
"V1InMemory" -> do
flush <- (fmap RequestedFlushFrequency <$> o .:? "FlushFrequency") .!= DefaultFlushFrequency
return $ V1InMemory flush
"V1LMDB" -> do
flush <- (fmap RequestedFlushFrequency <$> o .:? "FlushFrequency") .!= DefaultFlushFrequency
mapSize :: Maybe Gigabytes <- o .:? "MapSize"
lmdbPath :: Maybe FilePath <- o .:? "LiveTablesPath"
mxReaders :: Maybe Int <- o .:? "MaxReaders"
return $ V1LMDB flush lmdbPath mapSize mxReaders
"V2InMemory" -> return V2InMemory
"V2LSM" -> do
lsmPath :: Maybe FilePath <- o .:? "LSMDatabasePath"
pure $ V2LSM lsmPath
_ -> fail $ "Malformed LedgerDB Backend: " <> backend
pure $ Just $ LedgerDbConfiguration ldbSnapNum ldbSnapInterval qsize selector deprecatedOpts

Expand Down
6 changes: 3 additions & 3 deletions cardano-node/src/Cardano/Node/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ import Cardano.Tracing.Tracers
import qualified Ouroboros.Consensus.Config as Consensus
import Ouroboros.Consensus.Config.SupportsNode (ConfigSupportsNode (..))
import Ouroboros.Consensus.Node (SnapshotPolicyArgs (..),
NodeDatabasePaths (..), RunNodeArgs (..), StdRunNodeArgs (..))
NodeDatabasePaths (..), nonImmutableDbPath, RunNodeArgs (..), StdRunNodeArgs (..))
import Ouroboros.Consensus.Protocol.Praos.AgentClient (KESAgentClientTrace)
import Ouroboros.Consensus.Ledger.SupportsMempool (GenTxId)
import Ouroboros.Consensus.Node (RunNodeArgs (..),
Expand All @@ -79,7 +79,6 @@ import Ouroboros.Consensus.Node.NetworkProtocolVersion
import Ouroboros.Consensus.Node.ProtocolInfo
import qualified Ouroboros.Consensus.Node.Tracers as Consensus
import qualified Ouroboros.Consensus.Storage.LedgerDB.Args as LDBArgs
import Ouroboros.Consensus.Storage.LedgerDB.V2.Args
import Ouroboros.Consensus.Util.Args
import Ouroboros.Consensus.Util.Orphans ()

Expand Down Expand Up @@ -481,6 +480,7 @@ handleSimpleNode blockType runP tracers nc onKernel = do
onKernel nodeKernel
, rnPeerSharing = ncPeerSharing nc
, rnGetUseBootstrapPeers = readTVar useBootstrapVar
, rnFeatureFlags = mempty
}
#ifdef UNIX
-- initial `SIGHUP` handler, which only rereads the topology file but
Expand Down Expand Up @@ -560,7 +560,7 @@ handleSimpleNode blockType runP tracers nc onKernel = do
, srnChainSyncIdleTimeout = customizeChainSyncTimeout
, srnSnapshotPolicyArgs = snapshotPolicyArgs
, srnQueryBatchSize = queryBatchSize
, srnLdbFlavorArgs = selectorToArgs ldbBackend
, srnLedgerDbBackendArgs = selectorToArgs ldbBackend (nonImmutableDbPath dbPath)
}
where
customizeChainSyncTimeout :: ChainSyncIdleTimeout
Expand Down
9 changes: 5 additions & 4 deletions cardano-node/src/Cardano/Node/TraceConstraints.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr, HasTxId
import Ouroboros.Consensus.Node.NetworkProtocolVersion
(HasNetworkProtocolVersion (BlockNodeToClientVersion, BlockNodeToNodeVersion))
import Ouroboros.Consensus.Node.Run (RunNode, SerialiseNodeToNodeConstraints)
import Ouroboros.Consensus.Peras.SelectView
import Ouroboros.Consensus.Protocol.Abstract (SelectView, ValidationErr)
import Ouroboros.Consensus.Shelley.Ledger.Mempool (GenTx, TxId)
import Ouroboros.Network.Block (Serialised)
Expand Down Expand Up @@ -51,7 +52,7 @@ type TraceConstraints blk =
, ToObject (LedgerError blk)
, ToObject (LedgerEvent blk)
, ToObject (OtherHeaderEnvelopeError blk)
, ToObject (SelectView (BlockProtocol blk))
, ToObject (WeightedSelectView (BlockProtocol blk))
, ToObject (ValidationErr (BlockProtocol blk))
, ToObject (CannotForge blk)
, ToObject (ForgeStateUpdateError blk)
Expand All @@ -66,10 +67,10 @@ type TraceConstraints blk =
, LogFormatting (LedgerUpdate blk)
, LogFormatting (LedgerWarning blk)
, LogFormatting (OtherHeaderEnvelopeError blk)
, LogFormatting (SelectView (BlockProtocol blk))
, LogFormatting (WeightedSelectView (BlockProtocol blk))
, LogFormatting (ValidationErr (BlockProtocol blk))
, LogFormatting (CannotForge blk)
, LogFormatting (ForgeStateUpdateError blk)
, LogFormatting (Set (Credential 'Staking))
, LogFormatting (NonEmpty.NonEmpty (KeyHash 'Staking))
, LogFormatting (Set (Credential Staking))
, LogFormatting (NonEmpty.NonEmpty (KeyHash Staking))
)
12 changes: 7 additions & 5 deletions cardano-node/src/Cardano/Node/Tracing/Era/HardFork.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Cardano.Logging
import Cardano.Slotting.Slot (EpochSize (..))
import Cardano.Tracing.OrphanInstances.HardFork ()
import Ouroboros.Consensus.Block (BlockProtocol, CannotForge, ForgeStateInfo,
ForgeStateUpdateError)
ForgeStateUpdateError, PerasWeight (..))
import Ouroboros.Consensus.BlockchainTime (getSlotLength)
import Ouroboros.Consensus.Cardano.Condense ()
import Ouroboros.Consensus.HardFork.Combinator
Expand All @@ -36,7 +36,8 @@ import Ouroboros.Consensus.HeaderValidation (OtherHeaderEnvelopeError)
import Ouroboros.Consensus.Ledger.Abstract (LedgerError)
import Ouroboros.Consensus.Ledger.Inspect (LedgerUpdate, LedgerWarning)
import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr)
import Ouroboros.Consensus.Protocol.Abstract (ValidationErr, TiebreakerView, SelectView(..))
import Ouroboros.Consensus.Peras.SelectView
import Ouroboros.Consensus.Protocol.Abstract (TiebreakerView, ValidationErr)
import Ouroboros.Consensus.TypeFamilyWrappers
import Ouroboros.Consensus.Util.Condense (Condense (..))

Expand Down Expand Up @@ -352,10 +353,11 @@ instance LogFormatting (ForgeStateUpdateError blk) => LogFormatting (WrapForgeSt
instance All (LogFormatting `Compose` WrapTiebreakerView) xs => LogFormatting (HardForkTiebreakerView xs) where
forMachine dtal = forMachine dtal . getHardForkTiebreakerView

instance LogFormatting (TiebreakerView protocol) => LogFormatting (SelectView protocol) where
instance LogFormatting (TiebreakerView protocol) => LogFormatting (WeightedSelectView protocol) where
forMachine dtal sv = mconcat
[ "blockNo" .= svBlockNo sv
, forMachine dtal (svTiebreakerView sv)
[ "blockNo" .= wsvBlockNo sv
, "weightBoost" .= unPerasWeight (wsvWeightBoost sv)
, forMachine dtal (wsvTiebreaker sv)
]

instance All (LogFormatting `Compose` WrapTiebreakerView) xs => LogFormatting (OneEraTiebreakerView xs) where
Expand Down
Loading
Loading