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
30 changes: 30 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[submodule "ouroboros-consensus"]
path = ouroboros-consensus
url = https://github.com/tweag/ouroboros-consensus.git
[submodule "ouroboros-network"]
path = ouroboros-network
url = https://github.com/tweag/ouroboros-network.git
[submodule "typed-protocols"]
path = typed-protocols
url = https://github.com/input-output-hk/typed-protocols.git
[submodule "ekg-forward"]
path = ekg-forward
url = https://github.com/tweag/ekg-forward.git
[submodule "hermod-tracing"]
path = hermod-tracing
url = https://github.com/IntersectMBO/hermod-tracing.git
[submodule "cardano-api"]
path = cardano-api
url = https://github.com/tweag/cardano-api.git
[submodule "cardano-cli"]
path = cardano-cli
url = https://github.com/IntersectMBO/cardano-cli.git
[submodule "dmq-node"]
path = dmq-node
url = git@github.com:tweag/dmq-node.git
[submodule "cardano-base"]
path = cardano-base
url = git@github.com:IntersectMBO/cardano-base.git
[submodule "plutus"]
path = plutus
url = git@github.com:IntersectMBO/plutus.git
2 changes: 1 addition & 1 deletion bench/tx-generator/tx-generator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ library
, network-mux
, optparse-applicative
, ouroboros-consensus:{ouroboros-consensus, cardano, diffusion} >= 3.0.1
, ouroboros-network:{api, framework, framework-tracing, ouroboros-network, protocols} >= 1.1
, ouroboros-network:{api, framework, ouroboros-network, protocols} >= 1.1
, plutus-ledger-api
, plutus-tx
, random
Expand Down
110 changes: 108 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ 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 2026-04-17T09:20:55Z
, cardano-haskell-packages 2026-05-02T16:21:41Z
, hackage.haskell.org 2026-05-18T17:14:36Z
, cardano-haskell-packages 2026-05-18T13:56:34Z

active-repositories:
, :rest
Expand All @@ -28,6 +28,8 @@ constraints:
-- https://github.com/channable/alfred-margaret/pull/76
, any.alfred-margaret < 2.1.1.0 || > 2.1.1.0

, any.validation >= 1.2.2

-- acts has a finitary flag; disabling it avoids pulling in finitary entirely,
-- which sidesteps the GHC type-checker plugin incompatibility with
-- cross-compilation to Windows (finitary-2.2.0.0+)
Expand All @@ -51,6 +53,38 @@ packages:
bench/trace-schemas/scripts/schema-gen
trace-resources
trace-forward
ouroboros-consensus
ouroboros-network/ouroboros-network
ouroboros-network/cardano-diffusion
ouroboros-network/cardano-ping
ouroboros-network/monoidal-synchronisation
ouroboros-network/network-mux
ekg-forward
hermod-tracing/trace-dispatcher
cardano-api/cardano-api
cardano-api/cardano-rpc
dmq-node/dmq-node
cardano-base/cardano-git-rev
cardano-base/cardano-crypto-class
cardano-base/cardano-slotting
cardano-base/cardano-base
cardano-base/cardano-crypto-peras
cardano-base/orphans-deriving-via
cardano-base/cardano-crypto-praos
cardano-base/heapwords
cardano-base/cardano-binary
cardano-base/measures
cardano-base/base-deriving-via
cardano-base/cardano-strict-containers
plutus/plutus-benchmark/plutus-benchmark.cabal
plutus/plutus-executables/plutus-executables.cabal
plutus/plutus-ledger-api/plutus-ledger-api.cabal
plutus/cardano-constitution/cardano-constitution.cabal
plutus/plutus-tx/plutus-tx.cabal
plutus/plutus-tx-plugin/plutus-tx-plugin.cabal
plutus/plutus-metatheory/plutus-metatheory.cabal
plutus/plutus-conformance/plutus-conformance.cabal
plutus/plutus-core/plutus-core.cabal

-- Needed when cross compiling
extra-packages: alex, dmq-node >= 0.4.2.0
Expand Down Expand Up @@ -86,8 +120,80 @@ allow-newer:
allow-newer:
, io-sim:time
, io-classes:time
, cardano-node:cardano-api
, cardano-node:cardano-rpc
, cardano-submit-api:cardano-api
, cardano-cli:cardano-api
, cardano-cli:cardano-crypto-class
, cardano-testnet:cardano-api
, cardano-testnet:cardano-crypto-class
, iohk-monitoring:contra-tracer
, cardano-recon-framework:contra-tracer
, cardano-node:kes-agent
, dmq-node:kes-agent-crypto
, network-mux:contra-tracer
, plutus-scripts-bench:*
, tx-generator:*

-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

package ouroboros-consensus
ghc-options: -Wno-redundant-constraints
-- diffusion
ghc-options: -Wno-unused-matches
-Wno-unused-imports
-Wno-unused-do-bind

package ouroboros-consensus-lmdb
ghc-options: -Wno-redundant-constraints

-- kes-agent on branch f-f/allow-crypto-class-2.5
source-repository-package
type: git
location: https://github.com/f-f/kes-agent.git
tag: 0b362519f6915841c92869ed288ce83f89b17b73
--sha256: sha256-8pZYF7MJZZ1tM19wIUhbLKORDL+OP2ckhueWJM4aG/c=
subdir:
kes-agent
kes-agent-crypto

-- cardano-ledger on branch nm/predicate-failure-ord
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-ledger.git
tag: 3f879bb37df4738ed8211e500c7d180443cfcbe4
--sha256: sha256-uLjiIHiU1SzAmoKs+rynQphc3FUYXKeJLlOnp87uNdg=
subdir:
eras/allegra/impl
eras/alonzo/impl
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/impl
eras/shelley/test-suite
eras/shelley-ma/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/small-steps
libs/vector-map

source-repository-package
type: git
location: https://github.com/avieth/contra-tracer.git
tag: bf4a562a3b1315946aca7f6b4935e94ca1a23aa9

source-repository-package
type: git
location: https://github.com/input-output-hk/cuddle.git
tag: 93d8c1d0c7259df2f520524ccae71818537922d5
1 change: 1 addition & 0 deletions cardano-api
Submodule cardano-api added at cc6bc3
1 change: 1 addition & 0 deletions cardano-base
Submodule cardano-base added at 4e43b0
1 change: 1 addition & 0 deletions cardano-cli
Submodule cardano-cli added at 947c27
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 @@ -67,7 +67,7 @@ test-suite chairman-tests

build-depends: , cardano-api
, cardano-testnet
, cardano-crypto-class ^>=2.3
, cardano-crypto-class ^>=2.5
, data-default-class
, filepath
, hedgehog
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 @@ -140,7 +140,7 @@ library
, bytestring
, cardano-api ^>= 11.0
, cardano-data
, cardano-crypto-class ^>=2.3
, cardano-crypto-class ^>=2.5
, cardano-crypto-wrapper
, cardano-git-rev ^>=0.2.2
, cardano-ledger-alonzo
Expand Down Expand Up @@ -186,8 +186,8 @@ library
, network-mux >= 0.8
, nothunks
, optparse-applicative
, ouroboros-consensus:{ouroboros-consensus, lmdb, lsm, cardano, diffusion, protocol} ^>= 3.0.1
, ouroboros-network:{api, ouroboros-network, orphan-instances, framework, protocols, framework-tracing, tracing} ^>= 1.1
, ouroboros-consensus:{ouroboros-consensus, lsm, cardano, diffusion, protocol} ^>= 3.0.1
, ouroboros-network:{api, ouroboros-network, orphan-instances, framework, protocols, tracing} ^>= 1.1
, cardano-diffusion:{api, cardano-diffusion, orphan-instances, tracing} ^>=1.0
, prettyprinter
, prettyprinter-ansi-terminal
Expand Down
82 changes: 11 additions & 71 deletions cardano-node/src/Cardano/Node/Configuration/LedgerDB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{-# LANGUAGE TypeApplications #-}

{-# OPTIONS_GHC -Wno-orphans #-}
{-# OPTIONS_GHC -Wno-unused-top-binds #-}

module Cardano.Node.Configuration.LedgerDB (
DeprecatedOptions (..),
Expand All @@ -20,8 +21,6 @@ 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 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

Expand All @@ -31,6 +30,8 @@ import Data.Proxy
import System.FilePath
import System.Random (StdGen)

import Ouroboros.Consensus.Ledger.Basics (LedgerState)

-- | Choose the LedgerDB Backend
--
-- As of UTxO-HD, the LedgerDB now uses either an in-memory backend or LMDB to
Expand All @@ -43,18 +44,7 @@ import System.Random (StdGen)
--
-- - '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. 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.
| V2InMemory
V2InMemory
| V2LSM
(Maybe FilePath)
-- ^ Maybe a custom path to the LSM database. If not provided the default
Expand All @@ -73,8 +63,7 @@ noDeprecatedOptions = DeprecatedOptions []

data LedgerDbConfiguration =
LedgerDbConfiguration
NumOfDiskSnapshots
SnapshotInterval
SnapshotPolicyArgs
QueryBatchSize
LedgerDbSelectorFlag
DeprecatedOptions
Expand All @@ -89,63 +78,14 @@ newtype Gigabytes = Gigabytes Int
toBytes :: Gigabytes -> Int
toBytes (Gigabytes x) = x * 1024 * 1024 * 1024

-- | Recommended settings for the LMDB backing store.
--
-- === @'lmdbMapSize'@
-- The default @'LMDBLimits'@ uses an @'lmdbMapSize'@ of @1024 * 1024 * 1024 * 16@
-- bytes, or 16 Gigabytes. @'lmdbMapSize'@ sets the size of the memory map
-- that is used internally by the LMDB backing store, and is also the
-- maximum size of the on-disk database. 16 GB should be sufficient for the
-- medium term, i.e., it is sufficient until a more performant alternative to
-- the LMDB backing store is implemented, which will probably replace the LMDB
-- backing store altogether.
--
-- Note(jdral): It is recommended not to set the @'lmdbMapSize'@ to a value
-- that is much smaller than 16 GB through manual configuration: the node will
-- die with a fatal error as soon as the database size exceeds the
-- @'lmdbMapSize'@. If this fatal error were to occur, we would expect that
-- the node can continue normal operation if it is restarted with a higher
-- @'lmdbMapSize'@ configured. Nonetheless, this situation should be avoided.
--
-- === @'lmdbMaxDatabases'@
-- The @'lmdbMaxDatabases'@ is set to 10, which means that the LMDB backing
-- store will allow up @<= 10@ internal databases. We say /internal/
-- databases, since they are not exposed outside the backing store interface,
-- such that from the outside view there is just one /logical/ database.
-- Two of these internal databases are reserved for normal operation of the
-- backing store, while the remaining databases will be used to store ledger
-- tables. At the moment, there is at most one ledger table that will be
-- stored in an internal database: the UTxO. Nonetheless, we set
-- @'lmdbMaxDatabases'@ to @10@ in order to future-proof these limits.
--
-- === @'lmdbMaxReaders'@
-- The @'lmdbMaxReaders'@ limit sets the maximum number of threads that can
-- read from the LMDB database. Currently, there should only be a single reader
-- active. Again, we set @'lmdbMaxReaders'@ to @16@ in order to future-proof
-- these limits.
--
-- === References
-- For more information about LMDB limits, one should inspect:
-- * The @lmdb-simple@ and @haskell-lmdb@ forked repositories.
-- * The official LMDB API documentation at
-- <http://www.lmdb.tech/doc/group__mdb.html>.
defaultLMDBLimits :: LMDB.LMDBLimits
defaultLMDBLimits = LMDB.LMDBLimits {
LMDB.lmdbMapSize = 16 * 1024 * 1024 * 1024
, LMDB.lmdbMaxDatabases = 10
, LMDB.lmdbMaxReaders = 16
}

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

selectorToArgs :: forall blk. (LedgerSupportsProtocol blk, LedgerSupportsLedgerDB blk) => LedgerDbSelectorFlag -> FilePath -> StdGen -> (LedgerDbBackendArgs IO blk, StdGen)
selectorToArgs ::
forall blk.
( LedgerSupportsProtocol blk
, LedgerDbSerialiseConstraints blk
, CanUpgradeLedgerTables LedgerState 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.mkLSMArgsIO (Proxy @blk) (fromMaybe "lsm" fp) fastStoragePath
Loading
Loading