diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index f01eb46d08e..34e56e64816 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -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 diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 22f2d7a38e4..91fe4ff61b5 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -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 diff --git a/cabal.project b/cabal.project index 3ef2447a9db..2fcffea799b 100644 --- a/cabal.project +++ b/cabal.project @@ -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 @@ -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 diff --git a/cardano-node-chairman/cardano-node-chairman.cabal b/cardano-node-chairman/cardano-node-chairman.cabal index 6c3a08e1faf..d6e1ff5fa82 100644 --- a/cardano-node-chairman/cardano-node-chairman.cabal +++ b/cardano-node-chairman/cardano-node-chairman.cabal @@ -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 diff --git a/cardano-node/cardano-node.cabal b/cardano-node/cardano-node.cabal index ddfe290dffa..f40a13ac0ad 100644 --- a/cardano-node/cardano-node.cabal +++ b/cardano-node/cardano-node.cabal @@ -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 @@ -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 @@ -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 diff --git a/cardano-node/src/Cardano/Node/Configuration/LedgerDB.hs b/cardano-node/src/Cardano/Node/Configuration/LedgerDB.hs index f43c5029725..32ea7e9143c 100644 --- a/cardano-node/src/Cardano/Node/Configuration/LedgerDB.hs +++ b/cardano-node/src/Cardano/Node/Configuration/LedgerDB.hs @@ -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 -- @@ -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 + -- (@/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 (@/lsm@). + deriving (Eq, Show) -- | Some options that existed in the TopLevel were now moved to a @@ -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 -- . -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 diff --git a/cardano-node/src/Cardano/Node/Configuration/POM.hs b/cardano-node/src/Cardano/Node/Configuration/POM.hs index 4255c77d775..296d94cde8d 100644 --- a/cardano-node/src/Cardano/Node/Configuration/POM.hs +++ b/cardano-node/src/Cardano/Node/Configuration/POM.hs @@ -466,9 +466,6 @@ 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" @@ -476,6 +473,9 @@ instance FromJSON PartialNodeConfiguration where 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 diff --git a/cardano-node/src/Cardano/Node/Run.hs b/cardano-node/src/Cardano/Node/Run.hs index 2c87c34956f..8a48eca415b 100644 --- a/cardano-node/src/Cardano/Node/Run.hs +++ b/cardano-node/src/Cardano/Node/Run.hs @@ -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 (..), @@ -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 () @@ -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 @@ -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 diff --git a/cardano-node/src/Cardano/Node/TraceConstraints.hs b/cardano-node/src/Cardano/Node/TraceConstraints.hs index ec4b9f61034..6997f14c237 100644 --- a/cardano-node/src/Cardano/Node/TraceConstraints.hs +++ b/cardano-node/src/Cardano/Node/TraceConstraints.hs @@ -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) @@ -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) @@ -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)) ) diff --git a/cardano-node/src/Cardano/Node/Tracing/Era/HardFork.hs b/cardano-node/src/Cardano/Node/Tracing/Era/HardFork.hs index 7e528ba3c2f..aebc3a1f721 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Era/HardFork.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Era/HardFork.hs @@ -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 @@ -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 (..)) @@ -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 diff --git a/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs b/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs index 0f76c298ab1..0b98424e5d0 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs @@ -36,6 +36,7 @@ import Cardano.Ledger.BaseTypes (Mismatch (..), activeSlotLog, strictM import Cardano.Ledger.Chain import Cardano.Ledger.Conway.Governance (govActionIdToText) import qualified Cardano.Ledger.Conway.Rules as Conway +import qualified Cardano.Ledger.Dijkstra.Rules as Dijkstra import qualified Cardano.Ledger.Core as Ledger import qualified Cardano.Ledger.Hashes as Hashes import Cardano.Ledger.Shelley.API @@ -93,13 +94,13 @@ instance ( "txid" .= txId tx ) : [ "tx" .= condense tx | dtal == DDetailed ] -instance LogFormatting (Set (Credential 'Staking)) where +instance LogFormatting (Set (Credential Staking)) where forMachine _dtal creds = mconcat [ "kind" .= String "StakeCreds" , "stakeCreds" .= map toJSON (Set.toList creds) ] -instance LogFormatting (NonEmpty.NonEmpty (KeyHash 'Staking)) where +instance LogFormatting (NonEmpty.NonEmpty (KeyHash Staking)) where forMachine _dtal keyHashes = mconcat [ "kind" .= String "StakingKeyHashes" , "stakeKeyHashes" .= toJSON keyHashes @@ -347,6 +348,8 @@ instance forMachine dtal = \case UtxowFailure f -> forMachine dtal f DelegsFailure f -> forMachine dtal f + (ShelleyWithdrawalsMissingAccounts _withdrawals) -> undefined -- TODO(geo2a) + (ShelleyIncompleteWithdrawals _payload) -> undefined -- TODO(geo2a) instance ( Api.ShelleyLedgerEra era ~ ledgerera @@ -610,10 +613,6 @@ instance mconcat [ "kind" .= String "DelegateeNotRegisteredDELEG" , "targetPool" .= targetPool ] - forMachine _dtal (WithdrawalsNotInRewardsDELEGS incorrectWithdrawals) = - mconcat [ "kind" .= String "WithdrawalsNotInRewardsCERTS" - , "incorrectWithdrawals" .= unWithdrawals incorrectWithdrawals - ] forMachine dtal (DelplFailure f) = forMachine dtal f @@ -1073,6 +1072,14 @@ instance , LogFormatting (PredicateFailure (Ledger.EraRule "CERTS" era)) ) => LogFormatting (Conway.ConwayLedgerPredFailure era) where forMachine v (Conway.ConwayUtxowFailure f) = forMachine v f + forMachine _ (Conway.ConwayWithdrawalsMissingAccounts missingWithdrawals) = + mconcat [ "kind" .= String "ConwayWithdrawalsMissingAccounts" + , "withdrawals" .= unWithdrawals missingWithdrawals + ] + forMachine _ (Conway.ConwayIncompleteWithdrawals _incompleteWithdrawals) = + mconcat [ "kind" .= String "ConwayIncompleteWithdrawals" + -- , "withdrawals" .= unWithdrawals incompleteWithdrawals -- TODO(geo2a) + ] forMachine _ (Conway.ConwayTxRefScriptsSizeTooBig Mismatch {mismatchSupplied, mismatchExpected}) = mconcat [ "kind" .= String "ConwayTxRefScriptsSizeTooBig" , "actual" .= mismatchSupplied @@ -1189,6 +1196,37 @@ instance forMachine dtal (Conway.CertFailure certFailure) = forMachine dtal certFailure +instance + ( LogFormatting (PredicateFailure (Ledger.EraRule "CERTS" ledgerera)) + , LogFormatting (PredicateFailure (Ledger.EraRule "UTXOW" ledgerera)) + , LogFormatting (PredicateFailure (Ledger.EraRule "GOV" ledgerera)) + ) => LogFormatting (Dijkstra.DijkstraLedgerPredFailure ledgerera) where + forMachine _ = undefined -- TODO(geo2a) + +instance + (LogFormatting (PredicateFailure (Ledger.EraRule "CERTS" ledgerera)) + ) => LogFormatting (Dijkstra.DijkstraGovCertPredFailure ledgerera) where + forMachine _ = undefined -- TODO(geo2a) + +instance + (LogFormatting (PredicateFailure (Ledger.EraRule "CERTS" ledgerera)) + ) => LogFormatting (Dijkstra.DijkstraGovPredFailure ledgerera) where + forMachine _ = undefined -- TODO(geo2a) + +instance + (LogFormatting (PredicateFailure (Ledger.EraRule "UTXOW" ledgerera)) + ) => LogFormatting (Dijkstra.DijkstraUtxowPredFailure ledgerera) where + forMachine _ = undefined -- TODO(geo2a) + +instance + (LogFormatting (PredicateFailure (Ledger.EraRule "CERTS" ledgerera)) + ) => LogFormatting (Dijkstra.DijkstraBbodyPredFailure ledgerera) where + forMachine _ = undefined -- TODO(geo2a) + +instance + (LogFormatting (PredicateFailure (Ledger.EraRule "CERTS" ledgerera)) + ) => LogFormatting (Dijkstra.DijkstraUtxoPredFailure ledgerera) where + forMachine _ = undefined -- TODO(geo2a) instance ( Ledger.Crypto crypto diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs index a8b5f32dcf5..796bf95d31e 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs @@ -28,7 +28,7 @@ import Ouroboros.Consensus.Ledger.Abstract (LedgerError) import Ouroboros.Consensus.Ledger.Extended (ExtValidationError (..)) import Ouroboros.Consensus.Ledger.Inspect (InspectLedger, LedgerEvent (..)) import Ouroboros.Consensus.Ledger.SupportsProtocol (LedgerSupportsProtocol) -import Ouroboros.Consensus.Protocol.Abstract (SelectView, ValidationErr) +import Ouroboros.Consensus.Protocol.Abstract (ValidationErr) import qualified Ouroboros.Consensus.Protocol.PBFT as PBFT import qualified Ouroboros.Consensus.Storage.ChainDB as ChainDB import qualified Ouroboros.Consensus.Storage.ImmutableDB as ImmDB @@ -37,7 +37,11 @@ import qualified Ouroboros.Consensus.Storage.ImmutableDB.Impl.Types as ImmDB import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB import qualified Ouroboros.Consensus.Storage.LedgerDB.Snapshots as LedgerDB import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore as V1 -import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.Args as V2 +import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB as LMDB +import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.Backend as V2 +import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.InMemory as InMemory +import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.LSM as LSM +import qualified Ouroboros.Consensus.Storage.PerasCertDB.Impl as PerasCertDB import qualified Ouroboros.Consensus.Storage.VolatileDB as VolDB import Ouroboros.Consensus.Util.Condense (condense) import Ouroboros.Consensus.Util.Enclose @@ -52,6 +56,9 @@ import qualified Data.Text as Text import qualified Data.Text.Encoding as Text import Data.Word (Word64) import Numeric (showFFloat) +import Data.Void (absurd) +import Data.Typeable (Typeable, cast) +import Ouroboros.Consensus.Peras.SelectView -- {-# ANN module ("HLint: ignore Redundant bracket" :: Text) #-} @@ -79,7 +86,7 @@ withAddedToCurrentChainEmptyLimited tr = do instance ( LogFormatting (Header blk) , LogFormatting (LedgerEvent blk) , LogFormatting (RealPoint blk) - , LogFormatting (SelectView (BlockProtocol blk)) + , LogFormatting (WeightedSelectView (BlockProtocol blk)) , ConvertRawHash blk , ConvertRawHash (Header blk) , LedgerSupportsProtocol blk @@ -103,6 +110,8 @@ instance ( LogFormatting (Header blk) "Chain Selection was starved." ChainDB.ChainSelStarvation (FallingEdgeWith pt) -> "Chain Selection was unstarved by " <> renderRealPoint pt + forHuman (ChainDB.TracePerasCertDbEvent ev) = forHuman ev + forHuman (ChainDB.TraceAddPerasCertEvent ev) = forHuman ev forMachine _ ChainDB.TraceLastShutdownUnclean = mconcat [ "kind" .= String "LastShutdownUnclean" ] @@ -132,6 +141,11 @@ instance ( LogFormatting (Header blk) forMachine details v forMachine details (ChainDB.TraceVolatileDBEvent v) = forMachine details v + forMachine details (ChainDB.TracePerasCertDbEvent v) = + forMachine details v + forMachine details (ChainDB.TraceAddPerasCertEvent v) = + forMachine details v + asMetrics ChainDB.TraceLastShutdownUnclean = [] asMetrics (ChainDB.TraceChainSelStarvationEvent _) = [] @@ -145,6 +159,8 @@ instance ( LogFormatting (Header blk) asMetrics (ChainDB.TraceLedgerDBEvent v) = asMetrics v asMetrics (ChainDB.TraceImmutableDBEvent v) = asMetrics v asMetrics (ChainDB.TraceVolatileDBEvent v) = asMetrics v + asMetrics (ChainDB.TracePerasCertDbEvent v) = asMetrics v + asMetrics (ChainDB.TraceAddPerasCertEvent v) = asMetrics v instance MetaTrace (ChainDB.TraceEvent blk) where @@ -172,6 +188,10 @@ instance MetaTrace (ChainDB.TraceEvent blk) where nsPrependInner "ImmDbEvent" (namespaceFor ev) namespaceFor (ChainDB.TraceVolatileDBEvent ev) = nsPrependInner "VolatileDbEvent" (namespaceFor ev) + namespaceFor (ChainDB.TracePerasCertDbEvent ev) = + nsPrependInner "PerasCertDbEvent" (namespaceFor ev) + namespaceFor (ChainDB.TraceAddPerasCertEvent ev) = + nsPrependInner "AddPerasCertEvent" (namespaceFor ev) severityFor (Namespace _ ["LastShutdownUnclean"]) _ = Just Info severityFor (Namespace _ ["ChainSelStarvationEvent"]) _ = Just Debug @@ -215,6 +235,14 @@ instance MetaTrace (ChainDB.TraceEvent blk) where severityFor (Namespace out tl) (Just ev') severityFor (Namespace out ("VolatileDbEvent" : tl)) Nothing = severityFor (Namespace out tl :: Namespace (VolDB.TraceEvent blk)) Nothing + severityFor (Namespace out ("PerasCertDbEvent" : tl)) (Just (ChainDB.TracePerasCertDbEvent ev')) = + severityFor (Namespace out tl) (Just ev') + severityFor (Namespace out ("PerasCertDbEvent" : tl)) Nothing = + severityFor (Namespace out tl :: Namespace (PerasCertDB.TraceEvent blk)) Nothing + severityFor (Namespace out ("AddPerasCertEvent" : tl)) (Just (ChainDB.TraceAddPerasCertEvent ev')) = + severityFor (Namespace out tl) (Just ev') + severityFor (Namespace out ("AddPerasCertEvent" : tl)) Nothing = + severityFor (Namespace out tl :: Namespace (ChainDB.TraceAddPerasCertEvent blk)) Nothing severityFor _ns _ = Nothing privacyFor (Namespace _ ["LastShutdownUnclean"]) _ = Just Public @@ -259,6 +287,14 @@ instance MetaTrace (ChainDB.TraceEvent blk) where privacyFor (Namespace out tl) (Just ev') privacyFor (Namespace out ("VolatileDbEvent" : tl)) Nothing = privacyFor (Namespace out tl :: Namespace (VolDB.TraceEvent blk)) Nothing + privacyFor (Namespace out ("PerasCertDbEvent" : tl)) (Just (ChainDB.TracePerasCertDbEvent ev')) = + privacyFor (Namespace out tl) (Just ev') + privacyFor (Namespace out ("PerasCertDbEvent" : tl)) Nothing = + privacyFor (Namespace out tl :: Namespace (PerasCertDB.TraceEvent blk)) Nothing + privacyFor (Namespace out ("AddPerasCertEvent" : tl)) (Just (ChainDB.TraceAddPerasCertEvent ev')) = + privacyFor (Namespace out tl) (Just ev') + privacyFor (Namespace out ("AddPerasCertEvent" : tl)) Nothing = + privacyFor (Namespace out tl :: Namespace (ChainDB.TraceAddPerasCertEvent blk)) Nothing privacyFor _ _ = Nothing detailsFor (Namespace _ ["LastShutdownUnclean"]) _ = Just DNormal @@ -303,6 +339,14 @@ instance MetaTrace (ChainDB.TraceEvent blk) where detailsFor (Namespace out tl) (Just ev') detailsFor (Namespace out ("VolatileDbEvent" : tl)) Nothing = detailsFor (Namespace out tl :: (Namespace (VolDB.TraceEvent blk))) Nothing + detailsFor (Namespace out ("PerasCertDbEvent" : tl)) (Just (ChainDB.TracePerasCertDbEvent ev')) = + detailsFor (Namespace out tl) (Just ev') + detailsFor (Namespace out ("PerasCertDbEvent" : tl)) Nothing = + detailsFor (Namespace out tl :: Namespace (PerasCertDB.TraceEvent blk)) Nothing + detailsFor (Namespace out ("AddPerasCertEvent" : tl)) (Just (ChainDB.TraceAddPerasCertEvent ev')) = + detailsFor (Namespace out tl) (Just ev') + detailsFor (Namespace out ("AddPerasCertEvent" : tl)) Nothing = + detailsFor (Namespace out tl :: Namespace (ChainDB.TraceAddPerasCertEvent blk)) Nothing detailsFor _ _ = Nothing metricsDocFor (Namespace out ("AddBlockEvent" : tl)) = @@ -356,6 +400,10 @@ instance MetaTrace (ChainDB.TraceEvent blk) where documentFor (Namespace out tl :: Namespace (ImmDB.TraceEvent blk)) documentFor (Namespace out ("VolatileDbEvent" : tl)) = documentFor (Namespace out tl :: Namespace (VolDB.TraceEvent blk)) + documentFor (Namespace out ("PerasCertDbEvent" : tl)) = + documentFor (Namespace out tl :: Namespace (PerasCertDB.TraceEvent blk)) + documentFor (Namespace out ("AddPerasCertEvent" : tl)) = + documentFor (Namespace out tl :: Namespace (ChainDB.TraceAddPerasCertEvent blk)) documentFor _ = Nothing allNamespaces = @@ -381,6 +429,10 @@ instance MetaTrace (ChainDB.TraceEvent blk) where (allNamespaces :: [Namespace (ImmDB.TraceEvent blk)]) ++ map (nsPrependInner "VolatileDbEvent") (allNamespaces :: [Namespace (VolDB.TraceEvent blk)]) + ++ map (nsPrependInner "PerasCertDbEvent") + (allNamespaces :: [Namespace (PerasCertDB.TraceEvent blk)]) + ++ map (nsPrependInner "AddPerasCertEvent") + (allNamespaces :: [Namespace (ChainDB.TraceAddPerasCertEvent blk)]) ) @@ -392,7 +444,7 @@ instance MetaTrace (ChainDB.TraceEvent blk) where instance ( LogFormatting (Header blk) , LogFormatting (LedgerEvent blk) , LogFormatting (RealPoint blk) - , LogFormatting (SelectView (BlockProtocol blk)) + , LogFormatting (WeightedSelectView (BlockProtocol blk)) , ConvertRawHash blk , ConvertRawHash (Header blk) , LedgerSupportsProtocol blk @@ -491,10 +543,10 @@ instance ( LogFormatting (Header blk) in mconcat $ [ "kind" .= String "AddedToCurrentChain" , "newtip" .= renderPointForDetails DDetailed (AF.headPoint extended) - , "newTipSelectView" .= forMachine DDetailed (ChainDB.newTipSelectView selChangedInfo) + , "newSuffixSelectView" .= forMachine DDetailed (ChainDB.newSuffixSelectView selChangedInfo) ] - ++ [ "oldTipSelectView" .= forMachine DDetailed oldTipSelectView - | Just oldTipSelectView <- [ChainDB.oldTipSelectView selChangedInfo] + ++ [ "oldSuffixSelectView" .= forMachine DDetailed oldSuffixSelectView + | Just oldSuffixSelectView <- [ChainDB.oldSuffixSelectView selChangedInfo] ] ++ [ "headers" .= toJSON (forMachine DDetailed `map` addedHdrsNewChain base extended) ] @@ -507,10 +559,10 @@ instance ( LogFormatting (Header blk) mconcat $ [ "kind" .= String "AddedToCurrentChain" , "newtip" .= renderPointForDetails dtal (AF.headPoint extended) - , "newTipSelectView" .= forMachine dtal (ChainDB.newTipSelectView selChangedInfo) + , "newSuffixSelectView" .= forMachine dtal (ChainDB.newSuffixSelectView selChangedInfo) ] - ++ [ "oldTipSelectView" .= forMachine dtal oldTipSelectView - | Just oldTipSelectView <- [ChainDB.oldTipSelectView selChangedInfo] + ++ [ "oldSuffixSelectView" .= forMachine dtal oldSuffixSelectView + | Just oldSuffixSelectView <- [ChainDB.oldSuffixSelectView selChangedInfo] ] ++ [ "events" .= toJSON (map (forMachine dtal) events) | not (null events) ] @@ -526,10 +578,10 @@ instance ( LogFormatting (Header blk) in mconcat $ [ "kind" .= String "TraceAddBlockEvent.SwitchedToAFork" , "newtip" .= renderPointForDetails DDetailed (AF.headPoint new) - , "newTipSelectView" .= forMachine DDetailed (ChainDB.newTipSelectView selChangedInfo) + , "newSuffixSelectView" .= forMachine DDetailed (ChainDB.newSuffixSelectView selChangedInfo) ] - ++ [ "oldTipSelectView" .= forMachine DDetailed oldTipSelectView - | Just oldTipSelectView <- [ChainDB.oldTipSelectView selChangedInfo] + ++ [ "oldSuffixSelectView" .= forMachine DDetailed oldSuffixSelectView + | Just oldSuffixSelectView <- [ChainDB.oldSuffixSelectView selChangedInfo] ] ++ [ "headers" .= toJSON (forMachine DDetailed `map` addedHdrsNewChain old new) ] @@ -542,10 +594,10 @@ instance ( LogFormatting (Header blk) mconcat $ [ "kind" .= String "TraceAddBlockEvent.SwitchedToAFork" , "newtip" .= renderPointForDetails dtal (AF.headPoint new) - , "newTipSelectView" .= forMachine dtal (ChainDB.newTipSelectView selChangedInfo) + , "newSuffixSelectView" .= forMachine dtal (ChainDB.newSuffixSelectView selChangedInfo) ] - ++ [ "oldTipSelectView" .= forMachine dtal oldTipSelectView - | Just oldTipSelectView <- [ChainDB.oldTipSelectView selChangedInfo] + ++ [ "oldSuffixSelectView" .= forMachine dtal oldSuffixSelectView + | Just oldSuffixSelectView <- [ChainDB.oldSuffixSelectView selChangedInfo] ] ++ [ "events" .= toJSON (map (forMachine dtal) events) | not (null events) ] @@ -1822,29 +1874,43 @@ instance LogFormatting LedgerDB.TraceForkerEventWithKey where "Forker " <> showT k <> ": " <> forHuman ev instance LogFormatting LedgerDB.TraceForkerEvent where - forMachine _dtals LedgerDB.ForkerOpen = mempty - forMachine _dtals LedgerDB.ForkerCloseUncommitted = mempty - forMachine _dtals LedgerDB.ForkerCloseCommitted = mempty - forMachine _dtals LedgerDB.ForkerReadTablesStart = mempty - forMachine _dtals LedgerDB.ForkerReadTablesEnd = mempty - forMachine _dtals LedgerDB.ForkerRangeReadTablesStart = mempty - forMachine _dtals LedgerDB.ForkerRangeReadTablesEnd = mempty + forMachine _dtals LedgerDB.ForkerOpen = + mconcat [ "kind" .= String "ForkerOpen" ] + forMachine _dtals (LedgerDB.ForkerReadTables e) = + mconcat [ "kind" .= String "ForkerReadTables" + , "edge" .= case e of + RisingEdge -> String "RisingEdge" + FallingEdgeWith t -> toJSON t + ] + forMachine _dtals (LedgerDB.ForkerRangeReadTables e) = + mconcat [ "kind" .= String "ForkerRangeReadTables" + , "edge" .= case e of + RisingEdge -> String "RisingEdge" + FallingEdgeWith t -> toJSON t + ] forMachine _dtals LedgerDB.ForkerReadStatistics = mempty - forMachine _dtals LedgerDB.ForkerPushStart = mempty - forMachine _dtals LedgerDB.ForkerPushEnd = mempty - forMachine _dtals LedgerDB.DanglingForkerClosed = mempty + forMachine _dtals (LedgerDB.ForkerPush e) = + mconcat [ "kind" .= String "ForkerPush" + , "edge" .= case e of + RisingEdge -> String "RisingEdge" + FallingEdgeWith t -> toJSON t + ] + forMachine _dtals (LedgerDB.ForkerClose wc) = + mconcat [ "kind" .= String "ForkerClose" + , "wasCommitted" .= toJSON (wc == LedgerDB.ForkerWasCommitted) + ] forHuman LedgerDB.ForkerOpen = "Opened forker" - forHuman LedgerDB.ForkerCloseUncommitted = "Forker closed without committing" - forHuman LedgerDB.ForkerCloseCommitted = "Forker closed after committing" - forHuman LedgerDB.ForkerReadTablesStart = "Started to read tables" - forHuman LedgerDB.ForkerReadTablesEnd = "Finish reading tables" - forHuman LedgerDB.ForkerRangeReadTablesStart = "Started to range read tables" - forHuman LedgerDB.ForkerRangeReadTablesEnd = "Finish range reading tables" - forHuman LedgerDB.ForkerReadStatistics = "Gathering statistics" - forHuman LedgerDB.ForkerPushStart = "Started to push" - forHuman LedgerDB.ForkerPushEnd = "Pushed" - forHuman LedgerDB.DanglingForkerClosed = "Closed dangling forker" + forHuman (LedgerDB.ForkerReadTables RisingEdge) = "Forker reading tables" + forHuman (LedgerDB.ForkerReadTables (FallingEdgeWith t)) = "Forker read tables, took " <> showT t + forHuman (LedgerDB.ForkerRangeReadTables RisingEdge) = "Forker range reading tables" + forHuman (LedgerDB.ForkerRangeReadTables (FallingEdgeWith t)) = "Forker range read tables, took " <> showT t + forHuman LedgerDB.ForkerReadStatistics = "Forker gathering statistics" + forHuman (LedgerDB.ForkerPush RisingEdge) = "Forker pushing" + forHuman (LedgerDB.ForkerPush (FallingEdgeWith t)) = "Forker pushed, took " <> showT t + forHuman (LedgerDB.ForkerClose wc) = "Closed forker, " <> case wc of + LedgerDB.ForkerWasCommitted -> "was committed" + LedgerDB.ForkerWasUncommitted -> "was discarded" instance MetaTrace LedgerDB.TraceForkerEventWithKey where namespaceFor (LedgerDB.TraceForkerEventWithKey _ ev) = @@ -1858,48 +1924,29 @@ instance MetaTrace LedgerDB.TraceForkerEventWithKey where instance MetaTrace LedgerDB.TraceForkerEvent where namespaceFor LedgerDB.ForkerOpen = Namespace [] ["Open"] - namespaceFor LedgerDB.ForkerCloseUncommitted = Namespace [] ["CloseUncommitted"] - namespaceFor LedgerDB.ForkerCloseCommitted = Namespace [] ["CloseCommitted"] - namespaceFor LedgerDB.ForkerReadTablesStart = Namespace [] ["StartRead"] - namespaceFor LedgerDB.ForkerReadTablesEnd = Namespace [] ["FinishRead"] - namespaceFor LedgerDB.ForkerRangeReadTablesStart = Namespace [] ["StartRangeRead"] - namespaceFor LedgerDB.ForkerRangeReadTablesEnd = Namespace [] ["FinishRangeRead"] + namespaceFor LedgerDB.ForkerReadTables{} = Namespace [] ["Read"] + namespaceFor LedgerDB.ForkerRangeReadTables{} = Namespace [] ["RangeRead"] namespaceFor LedgerDB.ForkerReadStatistics = Namespace [] ["Statistics"] - namespaceFor LedgerDB.ForkerPushStart = Namespace [] ["StartPush"] - namespaceFor LedgerDB.ForkerPushEnd = Namespace [] ["FinishPush"] - namespaceFor LedgerDB.DanglingForkerClosed = Namespace [] ["DanglingForkerClosed"] + namespaceFor LedgerDB.ForkerPush{} = Namespace [] ["Push"] + namespaceFor LedgerDB.ForkerClose{} = Namespace [] ["Close"] severityFor _ _ = Just Debug - documentFor (Namespace _ ("Open" : _tl)) = Just - "A forker is being opened" - documentFor (Namespace _ ("CloseUncommitted" : _tl)) = Just $ - mconcat [ "A forker was closed without being committed." - , " This is usually the case with forkers that are not opened for chain selection," - , " and for forkers on discarded forks"] - documentFor (Namespace _ ("CloseCommitted" : _tl)) = Just "A forker was committed (the LedgerDB was modified accordingly) and closed" - documentFor (Namespace _ ("StartRead" : _tl)) = Just "The process for reading ledger tables started" - documentFor (Namespace _ ("FinishRead" : _tl)) = Just "Values from the ledger tables were read" - documentFor (Namespace _ ("StartRangeRead" : _tl)) = Just "The process for range reading ledger tables started" - documentFor (Namespace _ ("FinishRangeRead" : _tl)) = Just "Values from the ledger tables were range-read" + documentFor (Namespace _ ("Open" : _tl)) = Just "A forker is being opened" + documentFor (Namespace _ ("Read" : _tl)) = Just "A forker is reading values" + documentFor (Namespace _ ("RangeRead" : _tl)) = Just "A forker is range reading values" documentFor (Namespace _ ("Statistics" : _tl)) = Just "Statistics were gathered from the forker" - documentFor (Namespace _ ("StartPush" : _tl)) = Just "A ledger state is going to be pushed to the forker" - documentFor (Namespace _ ("FinishPush" : _tl)) = Just "A ledger state was pushed to the forker" - documentFor (Namespace _ ("DanglingForkerClosed" : _tl)) = Just "A dangling forker was closed" + documentFor (Namespace _ ("Push" : _tl)) = Just "A forker is pushing a new ledger state" + documentFor (Namespace _ ("Close" : _tl)) = Just "A forker was closed" documentFor _ = Nothing allNamespaces = [ Namespace [] ["Open"] - , Namespace [] ["CloseUncommitted"] - , Namespace [] ["CloseCommitted"] - , Namespace [] ["StartRead"] - , Namespace [] ["FinishRead"] - , Namespace [] ["StartRangeRead"] - , Namespace [] ["FinishRangeRead"] + , Namespace [] ["Read"] + , Namespace [] ["RangeRead"] , Namespace [] ["Statistics"] - , Namespace [] ["StartPush"] - , Namespace [] ["FinishPush"] - , Namespace [] ["DanglingForkerClosed"] + , Namespace [] ["Push"] + , Namespace [] ["Close"] ] -------------------------------------------------------------------------------- @@ -1920,52 +1967,93 @@ instance MetaTrace LedgerDB.FlavorImplSpecificTrace where nsPrependInner "V2" (namespaceFor ev) severityFor (Namespace out ("V1" : tl)) Nothing = - severityFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTrace) Nothing + severityFor (Namespace out tl :: Namespace V1.SomeBackendTrace) Nothing severityFor (Namespace out ("V1" : tl)) (Just (LedgerDB.FlavorImplSpecificTraceV1 ev)) = - severityFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTrace) (Just ev) + severityFor (Namespace out tl :: Namespace V1.SomeBackendTrace) (Just ev) severityFor (Namespace out ("V2" : tl)) Nothing = - severityFor (Namespace out tl :: Namespace V2.FlavorImplSpecificTrace) Nothing + severityFor (Namespace out tl :: Namespace V2.LedgerDBV2Trace) Nothing severityFor (Namespace out ("V2" : tl)) (Just (LedgerDB.FlavorImplSpecificTraceV2 ev)) = - severityFor (Namespace out tl :: Namespace V2.FlavorImplSpecificTrace) (Just ev) + severityFor (Namespace out tl :: Namespace V2.LedgerDBV2Trace) (Just ev) severityFor _ _ = Nothing documentFor (Namespace out ("V1" : tl)) = - documentFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTrace) + documentFor (Namespace out tl :: Namespace V1.SomeBackendTrace) documentFor (Namespace out ("V2" : tl)) = - documentFor (Namespace out tl :: Namespace V2.FlavorImplSpecificTrace) + documentFor (Namespace out tl :: Namespace V2.LedgerDBV2Trace) documentFor _ = Nothing allNamespaces = map (nsPrependInner "V1") - (allNamespaces :: [Namespace V1.FlavorImplSpecificTrace]) + (allNamespaces :: [Namespace V1.SomeBackendTrace]) ++ map (nsPrependInner "V2") - (allNamespaces :: [Namespace V2.FlavorImplSpecificTrace]) + (allNamespaces :: [Namespace V2.LedgerDBV2Trace]) -------------------------------------------------------------------------------- -- V1 -------------------------------------------------------------------------------- -instance LogFormatting V1.FlavorImplSpecificTrace where - forMachine dtal (V1.FlavorImplSpecificTraceInMemory ev) = forMachine dtal ev - forMachine dtal (V1.FlavorImplSpecificTraceOnDisk ev) = forMachine dtal ev +unwrapV1Trace :: forall a backend. Typeable backend => (V1.Trace LMDB.LMDB -> a) -> V1.Trace backend -> a +unwrapV1Trace g ev = + case cast @(V1.Trace backend) @(V1.Trace LMDB.LMDB) ev of + Just t -> g t + _ -> error "blah" - forHuman (V1.FlavorImplSpecificTraceInMemory ev) = forHuman ev - forHuman (V1.FlavorImplSpecificTraceOnDisk ev) = forHuman ev +instance LogFormatting V1.SomeBackendTrace where + forMachine dtal (V1.SomeBackendTrace ev) = + unwrapV1Trace (forMachine dtal) ev -instance LogFormatting V1.FlavorImplSpecificTraceInMemory where - forMachine _dtal V1.InMemoryBackingStoreInitialise = mempty - forMachine dtal (V1.InMemoryBackingStoreTrace ev) = forMachine dtal ev + forHuman (V1.SomeBackendTrace ev) = + unwrapV1Trace forHuman ev - forHuman V1.InMemoryBackingStoreInitialise = "Initializing in-memory backing store" - forHuman (V1.InMemoryBackingStoreTrace ev) = forHuman ev +instance MetaTrace V1.SomeBackendTrace where + namespaceFor (V1.SomeBackendTrace ev) = + unwrapV1Trace (nsPrependInner "LMDB" . namespaceFor) ev -instance LogFormatting V1.FlavorImplSpecificTraceOnDisk where - forMachine _dtal (V1.OnDiskBackingStoreInitialise limits) = - mconcat [ "limits" .= showT limits ] - forMachine dtal (V1.OnDiskBackingStoreTrace ev) = forMachine dtal ev + severityFor (Namespace out ("LMDB" : tl)) (Just (V1.SomeBackendTrace ev)) = + unwrapV1Trace (severityFor (Namespace out tl :: Namespace (V1.Trace LMDB.LMDB)) . Just) ev + severityFor (Namespace _ ("LMDB" : _)) Nothing = + Just Debug + severityFor _ _ = Nothing - forHuman (V1.OnDiskBackingStoreInitialise limits) = "Initializing on-disk backing store with limits " <> showT limits - forHuman (V1.OnDiskBackingStoreTrace ev) = forHuman ev + documentFor (Namespace _ ("LMDB" : _)) = + Just "An LMDB trace" + documentFor _ = Nothing + + allNamespaces = + map (nsPrependInner "LMDB") + (allNamespaces :: [Namespace (V1.Trace LMDB.LMDB)]) + +instance LogFormatting (V1.Trace LMDB.LMDB) where + forMachine _dtal (LMDB.OnDiskBackingStoreInitialise limits) = + mconcat [ "kind" .= String "LMDBBackingStoreInitialise", "limits" .= showT limits ] + forMachine dtal (LMDB.OnDiskBackingStoreTrace ev) = forMachine dtal ev + + forHuman (LMDB.OnDiskBackingStoreInitialise limits) = "Initializing LMDB backing store with limits " <> showT limits + forHuman (LMDB.OnDiskBackingStoreTrace ev) = forHuman ev + +instance MetaTrace (V1.Trace LMDB.LMDB) where + namespaceFor LMDB.OnDiskBackingStoreInitialise{} = + Namespace [] ["Initialise"] + namespaceFor (LMDB.OnDiskBackingStoreTrace ev) = + nsPrependInner "BackingStoreEvent" (namespaceFor ev) + + severityFor (Namespace _ ("Initialise" : _)) _ = Just Debug + severityFor (Namespace out ("BackingStoreEvent" : tl)) Nothing = + severityFor (Namespace out tl :: Namespace V1.BackingStoreTrace) Nothing + severityFor (Namespace out ("BackingStoreEvent" : tl)) (Just (LMDB.OnDiskBackingStoreTrace ev)) = + severityFor (Namespace out tl :: Namespace V1.BackingStoreTrace) (Just ev) + severityFor _ _ = Nothing + + documentFor (Namespace _ ("Initialise" : _)) = Just + "Backing store is being initialised" + documentFor (Namespace out ("BackingStoreEvent" : tl)) = + documentFor (Namespace out tl :: Namespace V1.BackingStoreTrace) + documentFor _ = Nothing + + allNamespaces = + Namespace [] ["Initialise"] + : map (nsPrependInner "BackingStoreEvent") + (allNamespaces :: [Namespace V1.BackingStoreTrace]) instance LogFormatting V1.BackingStoreTrace where forMachine _dtals V1.BSOpening = mempty @@ -2005,81 +2093,6 @@ instance LogFormatting V1.BackingStoreValueHandleTrace where forMachine _dtals V1.BSVHStatting = mempty forMachine _dtals V1.BSVHStatted = mempty -instance MetaTrace V1.FlavorImplSpecificTrace where - namespaceFor (V1.FlavorImplSpecificTraceInMemory ev) = - nsPrependInner "InMemory" (namespaceFor ev) - namespaceFor (V1.FlavorImplSpecificTraceOnDisk ev) = - nsPrependInner "OnDisk" (namespaceFor ev) - - severityFor (Namespace out ("InMemory" : tl)) Nothing = - severityFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTraceInMemory) Nothing - severityFor (Namespace out ("InMemory" : tl)) (Just (V1.FlavorImplSpecificTraceInMemory ev)) = - severityFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTraceInMemory) (Just ev) - severityFor (Namespace out ("OnDisk" : tl)) Nothing = - severityFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTraceOnDisk) Nothing - severityFor (Namespace out ("OnDisk" : tl)) (Just (V1.FlavorImplSpecificTraceOnDisk ev)) = - severityFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTraceOnDisk) (Just ev) - severityFor _ _ = Nothing - - documentFor (Namespace out ("InMemory" : tl)) = - documentFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTraceInMemory) - documentFor (Namespace out ("OnDisk" : tl)) = - documentFor (Namespace out tl :: Namespace V1.FlavorImplSpecificTraceOnDisk) - documentFor _ = Nothing - - allNamespaces = - map (nsPrependInner "InMemory") - (allNamespaces :: [Namespace V1.FlavorImplSpecificTraceInMemory]) - ++ map (nsPrependInner "OnDisk") - (allNamespaces :: [Namespace V1.FlavorImplSpecificTraceOnDisk]) - -instance MetaTrace V1.FlavorImplSpecificTraceInMemory where - namespaceFor V1.InMemoryBackingStoreInitialise = Namespace [] ["Initialise"] - namespaceFor (V1.InMemoryBackingStoreTrace bsTrace) = - nsPrependInner "BackingStoreEvent" (namespaceFor bsTrace) - - severityFor (Namespace _ ("Initialise" : _)) _ = Just Debug - severityFor (Namespace out ("BackingStoreEvent" : tl)) Nothing = - severityFor (Namespace out tl :: Namespace V1.BackingStoreTrace) Nothing - severityFor (Namespace out ("BackingStoreEvent" : tl)) (Just (V1.InMemoryBackingStoreTrace ev)) = - severityFor (Namespace out tl :: Namespace V1.BackingStoreTrace) (Just ev) - severityFor _ _ = Nothing - - documentFor (Namespace _ ("Initialise" : _)) = Just - "Backing store is being initialised" - documentFor (Namespace out ("BackingStoreEvent" : tl)) = - documentFor (Namespace out tl :: Namespace V1.BackingStoreTrace) - documentFor _ = Nothing - - allNamespaces = - Namespace [] ["Initialise"] - : map (nsPrependInner "BackingStoreEvent") - (allNamespaces :: [Namespace V1.BackingStoreTrace]) - -instance MetaTrace V1.FlavorImplSpecificTraceOnDisk where - namespaceFor V1.OnDiskBackingStoreInitialise{} = - Namespace [] ["Initialise"] - namespaceFor (V1.OnDiskBackingStoreTrace ev) = - nsPrependInner "BackingStoreEvent" (namespaceFor ev) - - severityFor (Namespace _ ("Initialise" : _)) _ = Just Debug - severityFor (Namespace out ("BackingStoreEvent" : tl)) Nothing = - severityFor (Namespace out tl :: Namespace V1.BackingStoreTrace) Nothing - severityFor (Namespace out ("BackingStoreEvent" : tl)) (Just (V1.OnDiskBackingStoreTrace ev)) = - severityFor (Namespace out tl :: Namespace V1.BackingStoreTrace) (Just ev) - severityFor _ _ = Nothing - - documentFor (Namespace _ ("Initialise" : _)) = Just - "Backing store is being initialised" - documentFor (Namespace out ("BackingStoreEvent" : tl)) = - documentFor (Namespace out tl :: Namespace V1.BackingStoreTrace) - documentFor _ = Nothing - - allNamespaces = - Namespace [] ["Initialise"] - : map (nsPrependInner "BackingStoreEvent") - (allNamespaces :: [Namespace V1.BackingStoreTrace]) - instance MetaTrace V1.BackingStoreTrace where namespaceFor V1.BSOpening = Namespace [] ["Opening"] namespaceFor V1.BSOpened{} = Namespace [] ["Opened"] @@ -2238,42 +2251,87 @@ instance MetaTrace V1.BackingStoreValueHandleTrace where , Namespace [] ["Statted"] ] -instance LogFormatting V2.FlavorImplSpecificTrace where +{------------------------------------------------------------------------------- + V2 +-------------------------------------------------------------------------------} + +instance LogFormatting V2.LedgerDBV2Trace where forMachine _dtal V2.TraceLedgerTablesHandleCreate = mconcat [ "kind" .= String "LedgerTablesHandleCreate" ] forMachine _dtal V2.TraceLedgerTablesHandleClose = mconcat [ "kind" .= String "LedgerTablesHandleClose" ] + forMachine dtal (V2.BackendTrace ev) = forMachine dtal ev forHuman V2.TraceLedgerTablesHandleCreate = "Created a new 'LedgerTablesHandle', potentially by duplicating an existing one" forHuman V2.TraceLedgerTablesHandleClose = "Closed a 'LedgerTablesHandle'" + forHuman (V2.BackendTrace ev) = forHuman ev -instance MetaTrace V2.FlavorImplSpecificTrace where +instance MetaTrace V2.LedgerDBV2Trace where namespaceFor V2.TraceLedgerTablesHandleCreate = Namespace [] ["LedgerTablesHandleCreate"] namespaceFor V2.TraceLedgerTablesHandleClose = Namespace [] ["LedgerTablesHandleClose"] + namespaceFor (V2.BackendTrace ev) = nsPrependInner "BackendTrace" (namespaceFor ev) severityFor (Namespace _ ["LedgerTablesHandleCreate"]) _ = Just Debug severityFor (Namespace _ ["LedgerTablesHandleClose"]) _ = Just Debug + severityFor (Namespace _ ("BackendTrace":_)) _ = Just Debug severityFor _ _ = Nothing - -- suspicious - privacyFor (Namespace _ ["LedgerTablesHandleCreate"]) _ = Just Public - privacyFor (Namespace _ ["LedgerTablesHandleClose"]) _ = Just Public - privacyFor _ _ = Just Public - documentFor (Namespace _ ["LedgerTablesHandleCreate"]) = - Just "An in-memory backing store event" + Just "Created a ledger tables handle" documentFor (Namespace _ ["LedgerTablesHandleClose"]) = - Just "An on-disk backing store event" + Just "Closed a ledger tables handle" documentFor _ = Nothing allNamespaces = [ Namespace [] ["LedgerTablesHandleCreate"] , Namespace [] ["LedgerTablesHandleClose"] - ] + ] ++ map (nsPrependInner "BackendTrace") (allNamespaces :: [Namespace V2.SomeBackendTrace]) + +instance LogFormatting V2.SomeBackendTrace where + forMachine dtal (V2.SomeBackendTrace ev) = unwrapV2Trace (forMachine dtal) ev + + forHuman (V2.SomeBackendTrace ev) = unwrapV2Trace forHuman ev + +instance MetaTrace V2.SomeBackendTrace where + namespaceFor (V2.SomeBackendTrace ev) = + unwrapV2Trace (nsPrependInner "LSM" . namespaceFor) ev + + severityFor (Namespace _ ("LSM" : _)) _ = Just Debug + severityFor _ _ = Nothing + + documentFor (Namespace out ("LSM" : tl)) = documentFor @(V2.Trace LSM.LSM) (Namespace out tl) + documentFor _ = Nothing + + allNamespaces = + map (nsPrependInner "LSM") (allNamespaces :: [Namespace (V2.Trace LSM.LSM)]) + +instance LogFormatting (V2.Trace LSM.LSM) where + forMachine _dtal (LSM.LSMTreeTrace ev) = mconcat [ "kind" .= String "LSMTreeTrace", "content" .= showT ev] + forHuman (LSM.LSMTreeTrace ev) = showT ev + +instance MetaTrace (V2.Trace LSM.LSM) where + namespaceFor LSM.LSMTreeTrace{} = Namespace [] ["LSMTrace"] + severityFor (Namespace _ ["LSMTrace"]) _ = Just Debug + severityFor _ _ = Nothing + + documentFor (Namespace _ ["LSMTrace"]) = + Just "A trace from the LSM-trees backend" + documentFor _ = Nothing + + allNamespaces = [Namespace [] ["LSMTrace"]] + +unwrapV2Trace :: forall a backend. Typeable backend => (V2.Trace LSM.LSM -> a) -> V2.Trace backend -> a +unwrapV2Trace g ev = + case cast @(V2.Trace backend) @(V2.Trace InMemory.Mem) ev of + Just (InMemory.NoTrace v) -> absurd v + Nothing -> + case cast @(V2.Trace backend) @(V2.Trace LSM.LSM) ev of + Just t -> g t + _ -> error "blah" -------------------------------------------------------------------------------- -- ImmDB.TraceEvent @@ -2889,3 +2947,186 @@ instance (Show (PBFT.PBftVerKeyHash c)) [ "kind" .= String "PBftCannotForgeThresholdExceeded" , "numForged" .= numForged ] + +-- PerasCertDB.TraceEvent instances +instance LogFormatting (PerasCertDB.TraceEvent blk) where + forHuman (PerasCertDB.AddedPerasCert _cert _peer) = "Added Peras certificate to database" + forHuman (PerasCertDB.IgnoredCertAlreadyInDB _cert _peer) = "Ignored Peras certificate already in database" + forHuman PerasCertDB.OpenedPerasCertDB = "Opened Peras certificate database" + forHuman PerasCertDB.ClosedPerasCertDB = "Closed Peras certificate database" + forHuman (PerasCertDB.AddingPerasCert _cert _peer) = "Adding Peras certificate to database" + + forMachine _dtal (PerasCertDB.AddedPerasCert cert _peer) = + mconcat ["kind" .= String "AddedPerasCert", + "cert" .= String (Text.pack $ show cert)] + forMachine _dtal (PerasCertDB.IgnoredCertAlreadyInDB cert _peer) = + mconcat ["kind" .= String "IgnoredCertAlreadyInDB", + "cert" .= String (Text.pack $ show cert)] + forMachine _dtal PerasCertDB.OpenedPerasCertDB = + mconcat ["kind" .= String "OpenedPerasCertDB"] + forMachine _dtal PerasCertDB.ClosedPerasCertDB = + mconcat ["kind" .= String "ClosedPerasCertDB"] + forMachine _dtal (PerasCertDB.AddingPerasCert cert _peer) = + mconcat ["kind" .= String "AddingPerasCert", + "cert" .= String (Text.pack $ show cert)] + + asMetrics _ = [] + +-- ChainDB.TraceAddPerasCertEvent instances +instance ConvertRawHash blk => LogFormatting (ChainDB.TraceAddPerasCertEvent blk) where + forHuman (ChainDB.AddedPerasCertToQueue roundNo boostedBlock _queueSize) = + "Added Peras certificate for round " <> Text.pack (show roundNo) <> + " boosting block " <> renderPoint boostedBlock <> " to queue" + forHuman (ChainDB.PoppedPerasCertFromQueue roundNo boostedBlock) = + "Popped Peras certificate for round " <> Text.pack (show roundNo) <> + " boosting block " <> renderPoint boostedBlock <> " from queue" + forHuman (ChainDB.IgnorePerasCertTooOld roundNo boostedBlock immutableSlot) = + "Ignored Peras certificate for round " <> Text.pack (show roundNo) <> + " boosting block " <> renderPoint boostedBlock <> + " (too old, immutable slot: " <> renderPoint (AF.anchorToPoint immutableSlot) <> ")" + forHuman (ChainDB.PerasCertBoostsCurrentChain roundNo boostedBlock) = + "Peras certificate for round " <> Text.pack (show roundNo) <> + " boosts current chain block " <> renderPoint boostedBlock + forHuman (ChainDB.PerasCertBoostsGenesis roundNo) = + "Peras certificate for round " <> Text.pack (show roundNo) <> " boosts Genesis" + forHuman (ChainDB.PerasCertBoostsBlockNotYetReceived roundNo boostedBlock) = + "Peras certificate for round " <> Text.pack (show roundNo) <> + " boosts block " <> renderPoint boostedBlock <> " not yet received" + forHuman (ChainDB.ChainSelectionForBoostedBlock roundNo boostedBlock) = + "Chain selection for block " <> renderPoint boostedBlock <> + " boosted by Peras certificate from round " <> Text.pack (show roundNo) + + forMachine _dtal (ChainDB.AddedPerasCertToQueue roundNo boostedBlock queueSize) = + mconcat ["kind" .= String "AddedPerasCertToQueue", + "round" .= String (Text.pack $ show roundNo), + "boostedBlock" .= String (renderPoint boostedBlock), + "queueSize" .= toJSON queueSize] + forMachine _dtal (ChainDB.PoppedPerasCertFromQueue roundNo boostedBlock) = + mconcat ["kind" .= String "PoppedPerasCertFromQueue", + "round" .= String (Text.pack $ show roundNo), + "boostedBlock" .= String (renderPoint boostedBlock)] + forMachine _dtal (ChainDB.IgnorePerasCertTooOld roundNo boostedBlock immutableSlot) = + mconcat ["kind" .= String "IgnorePerasCertTooOld", + "round" .= String (Text.pack $ show roundNo), + "boostedBlock" .= String (renderPoint boostedBlock), + "immutableSlot" .= String (renderPoint (AF.anchorToPoint immutableSlot))] + forMachine _dtal (ChainDB.PerasCertBoostsCurrentChain roundNo boostedBlock) = + mconcat ["kind" .= String "PerasCertBoostsCurrentChain", + "round" .= String (Text.pack $ show roundNo), + "boostedBlock" .= String (renderPoint boostedBlock)] + forMachine _dtal (ChainDB.PerasCertBoostsGenesis roundNo) = + mconcat ["kind" .= String "PerasCertBoostsGenesis", + "round" .= String (Text.pack $ show roundNo)] + forMachine _dtal (ChainDB.PerasCertBoostsBlockNotYetReceived roundNo boostedBlock) = + mconcat ["kind" .= String "PerasCertBoostsBlockNotYetReceived", + "round" .= String (Text.pack $ show roundNo), + "boostedBlock" .= String (renderPoint boostedBlock)] + forMachine _dtal (ChainDB.ChainSelectionForBoostedBlock roundNo boostedBlock) = + mconcat ["kind" .= String "ChainSelectionForBoostedBlock", + "round" .= String (Text.pack $ show roundNo), + "boostedBlock" .= String (renderPoint boostedBlock)] + + asMetrics _ = [] + +-- PerasCertDB.TraceEvent MetaTrace instance +instance MetaTrace (PerasCertDB.TraceEvent blk) where + namespaceFor (PerasCertDB.AddedPerasCert _ _) = + Namespace [] ["AddedPerasCert"] + namespaceFor (PerasCertDB.IgnoredCertAlreadyInDB _ _) = + Namespace [] ["IgnoredCertAlreadyInDB"] + namespaceFor PerasCertDB.OpenedPerasCertDB = + Namespace [] ["OpenedPerasCertDB"] + namespaceFor PerasCertDB.ClosedPerasCertDB = + Namespace [] ["ClosedPerasCertDB"] + namespaceFor (PerasCertDB.AddingPerasCert _ _) = + Namespace [] ["AddingPerasCert"] + + severityFor (Namespace _ ["AddedPerasCert"]) _ = Just Info + severityFor (Namespace _ ["IgnoredCertAlreadyInDB"]) _ = Just Info + severityFor (Namespace _ ["OpenedPerasCertDB"]) _ = Just Info + severityFor (Namespace _ ["ClosedPerasCertDB"]) _ = Just Info + severityFor (Namespace _ ["AddingPerasCert"]) _ = Just Debug + severityFor _ _ = Nothing + + privacyFor (Namespace _ ["AddedPerasCert"]) _ = Just Public + privacyFor (Namespace _ ["IgnoredCertAlreadyInDB"]) _ = Just Public + privacyFor (Namespace _ ["OpenedPerasCertDB"]) _ = Just Public + privacyFor (Namespace _ ["ClosedPerasCertDB"]) _ = Just Public + privacyFor (Namespace _ ["AddingPerasCert"]) _ = Just Public + privacyFor _ _ = Nothing + + detailsFor (Namespace _ ["AddedPerasCert"]) _ = Just DNormal + detailsFor (Namespace _ ["IgnoredCertAlreadyInDB"]) _ = Just DNormal + detailsFor (Namespace _ ["OpenedPerasCertDB"]) _ = Just DNormal + detailsFor (Namespace _ ["ClosedPerasCertDB"]) _ = Just DNormal + detailsFor (Namespace _ ["AddingPerasCert"]) _ = Just DDetailed + detailsFor _ _ = Nothing + + documentFor (Namespace _ ["AddedPerasCert"]) = Just "Certificate added to Peras certificate database" + documentFor (Namespace _ ["IgnoredCertAlreadyInDB"]) = Just "Certificate ignored as it was already in the database" + documentFor (Namespace _ ["OpenedPerasCertDB"]) = Just "Peras certificate database opened" + documentFor (Namespace _ ["ClosedPerasCertDB"]) = Just "Peras certificate database closed" + documentFor (Namespace _ ["AddingPerasCert"]) = Just "Adding certificate to Peras certificate database" + documentFor _ = Nothing + + allNamespaces = + [Namespace [] ["AddedPerasCert"], + Namespace [] ["IgnoredCertAlreadyInDB"], + Namespace [] ["OpenedPerasCertDB"], + Namespace [] ["ClosedPerasCertDB"], + Namespace [] ["AddingPerasCert"]] + +-- ChainDB.TraceAddPerasCertEvent MetaTrace instance +instance MetaTrace (ChainDB.TraceAddPerasCertEvent blk) where + namespaceFor ChainDB.AddedPerasCertToQueue{} = Namespace [] ["AddedPerasCertToQueue"] + namespaceFor (ChainDB.PoppedPerasCertFromQueue _ _) = Namespace [] ["PoppedPerasCertFromQueue"] + namespaceFor ChainDB.IgnorePerasCertTooOld{} = Namespace [] ["IgnorePerasCertTooOld"] + namespaceFor (ChainDB.PerasCertBoostsCurrentChain _ _) = Namespace [] ["PerasCertBoostsCurrentChain"] + namespaceFor (ChainDB.PerasCertBoostsGenesis _) = Namespace [] ["PerasCertBoostsGenesis"] + namespaceFor (ChainDB.PerasCertBoostsBlockNotYetReceived _ _) = Namespace [] ["PerasCertBoostsBlockNotYetReceived"] + namespaceFor (ChainDB.ChainSelectionForBoostedBlock _ _) = Namespace [] ["ChainSelectionForBoostedBlock"] + + severityFor (Namespace _ ["AddedPerasCertToQueue"]) _ = Just Debug + severityFor (Namespace _ ["PoppedPerasCertFromQueue"]) _ = Just Debug + severityFor (Namespace _ ["IgnorePerasCertTooOld"]) _ = Just Info + severityFor (Namespace _ ["PerasCertBoostsCurrentChain"]) _ = Just Info + severityFor (Namespace _ ["PerasCertBoostsGenesis"]) _ = Just Info + severityFor (Namespace _ ["PerasCertBoostsBlockNotYetReceived"]) _ = Just Info + severityFor (Namespace _ ["ChainSelectionForBoostedBlock"]) _ = Just Info + severityFor _ _ = Nothing + + privacyFor (Namespace _ ["AddedPerasCertToQueue"]) _ = Just Public + privacyFor (Namespace _ ["PoppedPerasCertFromQueue"]) _ = Just Public + privacyFor (Namespace _ ["IgnorePerasCertTooOld"]) _ = Just Public + privacyFor (Namespace _ ["PerasCertBoostsCurrentChain"]) _ = Just Public + privacyFor (Namespace _ ["PerasCertBoostsGenesis"]) _ = Just Public + privacyFor (Namespace _ ["PerasCertBoostsBlockNotYetReceived"]) _ = Just Public + privacyFor (Namespace _ ["ChainSelectionForBoostedBlock"]) _ = Just Public + privacyFor _ _ = Nothing + + detailsFor (Namespace _ ["AddedPerasCertToQueue"]) _ = Just DDetailed + detailsFor (Namespace _ ["PoppedPerasCertFromQueue"]) _ = Just DDetailed + detailsFor (Namespace _ ["IgnorePerasCertTooOld"]) _ = Just DNormal + detailsFor (Namespace _ ["PerasCertBoostsCurrentChain"]) _ = Just DNormal + detailsFor (Namespace _ ["PerasCertBoostsGenesis"]) _ = Just DNormal + detailsFor (Namespace _ ["PerasCertBoostsBlockNotYetReceived"]) _ = Just DNormal + detailsFor (Namespace _ ["ChainSelectionForBoostedBlock"]) _ = Just DNormal + detailsFor _ _ = Nothing + + documentFor (Namespace _ ["AddedPerasCertToQueue"]) = Just "Peras certificate added to processing queue" + documentFor (Namespace _ ["PoppedPerasCertFromQueue"]) = Just "Peras certificate popped from processing queue" + documentFor (Namespace _ ["IgnorePerasCertTooOld"]) = Just "Peras certificate ignored as it is too old compared to immutable slot" + documentFor (Namespace _ ["PerasCertBoostsCurrentChain"]) = Just "Peras certificate boosts a block on the current selection" + documentFor (Namespace _ ["PerasCertBoostsGenesis"]) = Just "Peras certificate boosts the Genesis point" + documentFor (Namespace _ ["PerasCertBoostsBlockNotYetReceived"]) = Just "Peras certificate boosts a block not yet received" + documentFor (Namespace _ ["ChainSelectionForBoostedBlock"]) = Just "Perform chain selection for block boosted by Peras certificate" + documentFor _ = Nothing + + allNamespaces = + [Namespace [] ["AddedPerasCertToQueue"], + Namespace [] ["PoppedPerasCertFromQueue"], + Namespace [] ["IgnorePerasCertTooOld"], + Namespace [] ["PerasCertBoostsCurrentChain"], + Namespace [] ["PerasCertBoostsGenesis"], + Namespace [] ["PerasCertBoostsBlockNotYetReceived"], + Namespace [] ["ChainSelectionForBoostedBlock"]] diff --git a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs index fa4e08f3da6..85f3735b26f 100644 --- a/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs +++ b/cardano-node/src/Cardano/Node/Tracing/Tracers/Consensus.hs @@ -83,7 +83,6 @@ import Data.Time (NominalDiffTime) import Data.Word (Word32, Word64) import Network.TypedProtocol.Core - instance (LogFormatting adr, Show adr) => LogFormatting (ConnectionId adr) where forMachine _dtal (ConnectionId local' remote) = mconcat [ "connectionId" .= String (showT local' diff --git a/cardano-node/src/Cardano/Tracing/HasIssuer.hs b/cardano-node/src/Cardano/Tracing/HasIssuer.hs index 8b74ccdd33b..f41f64a56fe 100644 --- a/cardano-node/src/Cardano/Tracing/HasIssuer.hs +++ b/cardano-node/src/Cardano/Tracing/HasIssuer.hs @@ -69,8 +69,8 @@ instance -- We don't support a "block issuer" key role in @cardano-api@, so we'll -- just convert it to a stake pool key. toStakePoolKey - :: Shelley.VKey 'Shelley.BlockIssuer - -> Shelley.VKey 'Shelley.StakePool + :: Shelley.VKey Shelley.BlockIssuer + -> Shelley.VKey Shelley.StakePool toStakePoolKey vk = Shelley.VKey (Shelley.unVKey vk) issuer = pHeaderIssuer (shelleyHeaderRaw shelleyBlkHdr) diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs index e22cf83c3b7..1e810273c7e 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Consensus.hs @@ -19,6 +19,7 @@ module Cardano.Tracing.OrphanInstances.Consensus () where +import Ouroboros.Consensus.Peras.SelectView import Cardano.Node.Tracing.Tracers.ConsensusStartupException (ConsensusStartupException (..)) import Cardano.Prelude (Typeable, maximumDef) @@ -174,7 +175,6 @@ instance HasSeverityAnnotation (ChainDB.TraceEvent blk) where ChainDB.PoppedReprocessLoEBlocksFromQueue -> Debug ChainDB.ChainSelectionLoEDebug _ _ -> Debug - getSeverityAnnotation (ChainDB.TraceLedgerDBEvent ev) = case ev of LedgerDB.LedgerDBSnapshotEvent ev' -> case ev' of LedgerDB.TookSnapshot {} -> Info @@ -252,6 +252,9 @@ instance HasSeverityAnnotation (ChainDB.TraceEvent blk) where getSeverityAnnotation ChainDB.TraceChainSelStarvationEvent{} = Debug + getSeverityAnnotation ChainDB.TracePerasCertDbEvent{} = Info + getSeverityAnnotation ChainDB.TraceAddPerasCertEvent{} = Info + instance HasSeverityAnnotation (LedgerEvent blk) where getSeverityAnnotation (LedgerUpdate _) = Notice getSeverityAnnotation (LedgerWarning _) = Critical @@ -520,7 +523,7 @@ instance ( ConvertRawHash blk , InspectLedger blk , ToObject (Header blk) , ToObject (LedgerEvent blk) - , ToObject (SelectView (BlockProtocol blk))) + , ToObject (WeightedSelectView (BlockProtocol blk))) => Transformable Text IO (ChainDB.TraceEvent blk) where trTransformer = trStructuredText @@ -785,10 +788,14 @@ instance ( ConvertRawHash blk ChainDB.TraceChainSelStarvationEvent ev -> case ev of ChainDB.ChainSelStarvation RisingEdge -> "Chain Selection was starved." ChainDB.ChainSelStarvation (FallingEdgeWith pt) -> "Chain Selection was unstarved by " <> renderRealPoint pt + ChainDB.TracePerasCertDbEvent ev -> showT ev + ChainDB.TraceAddPerasCertEvent ev -> showT ev where showProgressT :: Int -> Int -> Text showProgressT chunkNo outOf = pack (showFFloat (Just 2) (100 * fromIntegral chunkNo / fromIntegral outOf :: Float) mempty) + + -- -- | instances of @ToObject@ -- @@ -926,7 +933,7 @@ instance ( ConvertRawHash blk , LedgerSupportsProtocol blk , ToObject (Header blk) , ToObject (LedgerEvent blk) - , ToObject (SelectView (BlockProtocol blk))) + , ToObject (WeightedSelectView (BlockProtocol blk))) => ToObject (ChainDB.TraceEvent blk) where toObject _verb ChainDB.TraceLastShutdownUnclean = mconcat [ "kind" .= String "TraceLastShutdownUnclean" ] @@ -971,10 +978,10 @@ instance ( ConvertRawHash blk [ "kind" .= String "TraceAddBlockEvent.AddedToCurrentChain" , "newtip" .= renderPointForVerbosity verb (AF.headPoint extended) , "chainLengthDelta" .= extended `chainLengthΔ` base - , "newTipSelectView" .= toObject verb (ChainDB.newTipSelectView selChangedInfo) + , "newSuffixSelectView" .= toObject verb (ChainDB.newSuffixSelectView selChangedInfo) ] - ++ [ "oldTipSelectView" .= toObject verb oldTipSelectView - | Just oldTipSelectView <- [ChainDB.oldTipSelectView selChangedInfo] + ++ [ "oldSuffixSelectView" .= toObject verb oldSuffixSelectView + | Just oldSuffixSelectView <- [ChainDB.oldSuffixSelectView selChangedInfo] ] ++ [ "headers" .= toJSON (toObject verb `map` addedHdrsNewChain base extended) | verb == MaximalVerbosity ] @@ -987,10 +994,10 @@ instance ( ConvertRawHash blk , "chainLengthDelta" .= new `chainLengthΔ` old -- Check that the SwitchedToAFork event was triggered by a proper fork. , "realFork" .= not (AF.withinFragmentBounds (AF.headPoint old) new) - , "newTipSelectView" .= toObject verb (ChainDB.newTipSelectView selChangedInfo) + , "newSuffixSelectView" .= toObject verb (ChainDB.newSuffixSelectView selChangedInfo) ] - ++ [ "oldTipSelectView" .= toObject verb oldTipSelectView - | Just oldTipSelectView <- [ChainDB.oldTipSelectView selChangedInfo] + ++ [ "oldSuffixSelectView" .= toObject verb oldSuffixSelectView + | Just oldSuffixSelectView <- [ChainDB.oldSuffixSelectView selChangedInfo] ] ++ [ "headers" .= toJSON (toObject verb `map` addedHdrsNewChain old new) | verb == MaximalVerbosity ] @@ -1065,6 +1072,15 @@ instance ( ConvertRawHash blk chainLengthΔ :: AF.AnchoredFragment (Header blk) -> AF.AnchoredFragment (Header blk) -> Int chainLengthΔ = on (-) (fromWithOrigin (-1) . fmap (fromIntegral . unBlockNo) . AF.headBlockNo) + toObject _verb (ChainDB.TracePerasCertDbEvent ev) = + mconcat [ "kind" .= String "TracePerasCertDbEvent" + , "event" .= show ev + ] + toObject _verb (ChainDB.TraceAddPerasCertEvent ev) = + mconcat [ "kind" .= String "TraceAddPerasCertEvent" + , "event" .= show ev + ] + toObject MinimalVerbosity (ChainDB.TraceLedgerDBEvent _ev) = mempty -- no output toObject verb (ChainDB.TraceLedgerDBEvent ev) = case ev of LedgerDB.LedgerDBSnapshotEvent ev' -> case ev' of diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/HardFork.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/HardFork.hs index 8c75604c5cb..1736b04f68c 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/HardFork.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/HardFork.hs @@ -22,7 +22,7 @@ import Cardano.Slotting.Slot (EpochSize (..)) import Cardano.Tracing.OrphanInstances.Common import Cardano.Tracing.OrphanInstances.Consensus () 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 @@ -43,7 +43,7 @@ import Ouroboros.Consensus.Ledger.Inspect (LedgerUpdate, LedgerWarning import Ouroboros.Consensus.Ledger.SupportsMempool (ApplyTxErr) import Ouroboros.Consensus.Node.NetworkProtocolVersion (BlockNodeToClientVersion, BlockNodeToNodeVersion) -import Ouroboros.Consensus.Protocol.Abstract (ValidationErr, SelectView (svTiebreakerView, svBlockNo), ConsensusProtocol (TiebreakerView)) +import Ouroboros.Consensus.Protocol.Abstract (ValidationErr, ConsensusProtocol (TiebreakerView)) import Ouroboros.Consensus.TypeFamilyWrappers import Ouroboros.Consensus.Util.Condense (Condense (..)) @@ -53,6 +53,7 @@ import qualified Data.ByteString.Short as SBS import Data.Proxy (Proxy (..)) import Data.SOP (All, Compose, K (..)) import Data.SOP.Strict +import Ouroboros.Consensus.Peras.SelectView -- @@ -434,10 +435,11 @@ instance (ToJSON (BlockNodeToNodeVersion blk)) => ToJSON (WrapNodeToNodeVersion instance All (ToObject `Compose` WrapTiebreakerView) xs => ToObject (HardForkTiebreakerView xs) where toObject verb = toObject verb . getHardForkTiebreakerView -instance ToObject (TiebreakerView protocol) => ToObject (SelectView protocol) where +instance ToObject (TiebreakerView protocol) => ToObject (WeightedSelectView protocol) where toObject verb sv = mconcat - [ "blockNo" .= svBlockNo sv - , toObject verb (svTiebreakerView sv) + [ "blockNo" .= wsvBlockNo sv + , "weightBoost" .= unPerasWeight (wsvWeightBoost sv) + , toObject verb (wsvTiebreaker sv) ] instance All (ToObject `Compose` WrapTiebreakerView) xs => ToObject (OneEraTiebreakerView xs) where diff --git a/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs b/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs index d8645b49170..11aa6a8c213 100644 --- a/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs +++ b/cardano-node/src/Cardano/Tracing/OrphanInstances/Shelley.hs @@ -38,6 +38,7 @@ import Cardano.Ledger.Chain import Cardano.Ledger.Conway.Governance (govActionIdToText) import Cardano.Ledger.Conway.Rules (ConwayUtxosPredFailure) import qualified Cardano.Ledger.Conway.Rules as Conway +import qualified Cardano.Ledger.Dijkstra.Rules as Dijkstra import qualified Cardano.Ledger.Core as Core import qualified Cardano.Ledger.Core as Ledger import qualified Cardano.Ledger.Hashes as Hashes @@ -237,13 +238,13 @@ instance ToObject (Conway.ConwayDelegPredFailure era) where , "error" .= String "Refund mismatch" ] -instance ToObject (Set (Credential 'Staking)) where +instance ToObject (Set (Credential Staking)) where toObject _verb creds = mconcat [ "kind" .= String "StakeCreds" , "stakeCreds" .= map toJSON (Set.toList creds) ] -instance ToObject (NonEmpty.NonEmpty (KeyHash 'Staking)) where +instance ToObject (NonEmpty.NonEmpty (KeyHash Staking)) where toObject _verb keyHashes = mconcat [ "kind" .= String "StakeKeyHashes" , "stakeKeyHashes" .= toJSON keyHashes @@ -327,6 +328,9 @@ instance ) => ToObject (ShelleyLedgerPredFailure ledgerera) where toObject verb (UtxowFailure f) = toObject verb f toObject verb (DelegsFailure f) = toObject verb f + toObject _verb (ShelleyWithdrawalsMissingAccounts _withdrawals) = undefined -- TODO(geo2a) + toObject _verb (ShelleyIncompleteWithdrawals _payload) = undefined -- TODO(geo2a) + instance ( ToObject (PredicateFailure (Core.EraRule "CERTS" ledgerera)) @@ -334,6 +338,14 @@ instance , ToObject (PredicateFailure (Core.EraRule "GOV" ledgerera)) ) => ToObject (Conway.ConwayLedgerPredFailure ledgerera) where toObject verb (Conway.ConwayUtxowFailure f) = toObject verb f + toObject _ (Conway.ConwayWithdrawalsMissingAccounts missingWithdrawals) = + mconcat [ "kind" .= String "ConwayWithdrawalsMissingAccounts" + , "withdrawals" .= unWithdrawals missingWithdrawals + ] + toObject _ (Conway.ConwayIncompleteWithdrawals _incompleteWithdrawals) = + mconcat [ "kind" .= String "ConwayIncompleteWithdrawals" + -- , "withdrawals" .= undefined -- TODO(geo2a) + ] toObject _ (Conway.ConwayTxRefScriptsSizeTooBig Mismatch {mismatchSupplied, mismatchExpected}) = mconcat [ "kind" .= String "ConwayTxRefScriptsSizeTooBig" , "actual" .= mismatchSupplied @@ -450,6 +462,37 @@ instance mconcat [ "kind" .= String "WithdrawalsNotInRewardsCERTS" , "incorrectWithdrawals" .= unWithdrawals incorrectWithdrawals ] Conway.CertFailure f -> toObject verb f +instance + ( ToObject (PredicateFailure (Core.EraRule "CERTS" ledgerera)) + , ToObject (PredicateFailure (Core.EraRule "UTXOW" ledgerera)) + , ToObject (PredicateFailure (Core.EraRule "GOV" ledgerera)) + ) => ToObject (Dijkstra.DijkstraLedgerPredFailure ledgerera) where + toObject _verb = undefined -- TODO(geo2a) + +instance + (ToObject (PredicateFailure (Core.EraRule "CERTS" ledgerera)) + ) => ToObject (Dijkstra.DijkstraGovCertPredFailure ledgerera) where + toObject _verb = undefined -- TODO(geo2a) + +instance + (ToObject (PredicateFailure (Core.EraRule "CERTS" ledgerera)) + ) => ToObject (Dijkstra.DijkstraGovPredFailure ledgerera) where + toObject _verb = undefined -- TODO(geo2a) + +instance + (ToObject (PredicateFailure (Core.EraRule "UTXOW" ledgerera)) + ) => ToObject (Dijkstra.DijkstraUtxowPredFailure ledgerera) where + toObject _verb = undefined -- TODO(geo2a) + +instance + (ToObject (PredicateFailure (Core.EraRule "CERTS" ledgerera)) + ) => ToObject (Dijkstra.DijkstraBbodyPredFailure ledgerera) where + toObject _verb = undefined -- TODO(geo2a) + +instance + (ToObject (PredicateFailure (Core.EraRule "CERTS" ledgerera)) + ) => ToObject (Dijkstra.DijkstraUtxoPredFailure ledgerera) where + toObject _verb = undefined -- TODO(geo2a) instance ( Api.ShelleyLedgerEra era ~ ledgerera @@ -710,10 +753,6 @@ instance mconcat [ "kind" .= String "DelegateeNotRegisteredDELEG" , "targetPool" .= targetPool ] - toObject _verb (WithdrawalsNotInRewardsDELEGS incorrectWithdrawals) = - mconcat [ "kind" .= String "WithdrawalsNotInRewardsCERTS" - , "incorrectWithdrawals" .= unWithdrawals incorrectWithdrawals - ] toObject verb (DelplFailure f) = toObject verb f diff --git a/cardano-node/src/Cardano/Tracing/Tracers.hs b/cardano-node/src/Cardano/Tracing/Tracers.hs index 7aaf9b03cb4..be7700d7671 100644 --- a/cardano-node/src/Cardano/Tracing/Tracers.hs +++ b/cardano-node/src/Cardano/Tracing/Tracers.hs @@ -74,7 +74,7 @@ import qualified Ouroboros.Consensus.Network.NodeToClient as NodeToClient import qualified Ouroboros.Consensus.Network.NodeToNode as NodeToNode import qualified Ouroboros.Consensus.Node.Run as Consensus (RunNode) import qualified Ouroboros.Consensus.Node.Tracers as Consensus -import Ouroboros.Consensus.Protocol.Abstract (SelectView, ValidationErr) +import Ouroboros.Consensus.Protocol.Abstract (ValidationErr) import qualified Ouroboros.Consensus.Protocol.Ledger.HotKey as HotKey import qualified Ouroboros.Consensus.Storage.ChainDB as ChainDB import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB @@ -135,6 +135,7 @@ import qualified System.Metrics.Counter as Counter import qualified System.Metrics.Gauge as Gauge import qualified System.Metrics.Label as Label import qualified System.Remote.Monitoring.Wai as EKG +import Ouroboros.Consensus.Peras.SelectView {-# OPTIONS_GHC -Wno-redundant-constraints #-} @@ -548,7 +549,7 @@ teeTraceChainTip , InspectLedger blk , ToObject (Header blk) , ToObject (LedgerEvent blk) - , ToObject (SelectView (BlockProtocol blk)) + , ToObject (WeightedSelectView (BlockProtocol blk)) ) => BlockConfig blk -> ForgingStats @@ -572,7 +573,7 @@ teeTraceChainTipElide , InspectLedger blk , ToObject (Header blk) , ToObject (LedgerEvent blk) - , ToObject (SelectView (BlockProtocol blk)) + , ToObject (WeightedSelectView (BlockProtocol blk)) ) => TracingVerbosity -> MVar (Maybe (WithSeverity (ChainDB.TraceEvent blk)), Integer) diff --git a/cardano-submit-api/cardano-submit-api.cabal b/cardano-submit-api/cardano-submit-api.cabal index 9e9cc03aba1..defe54d2422 100644 --- a/cardano-submit-api/cardano-submit-api.cabal +++ b/cardano-submit-api/cardano-submit-api.cabal @@ -39,9 +39,9 @@ library , aeson , async , bytestring - , cardano-api ^>= 10.19 + , cardano-api ^>= 10.20 , cardano-binary - , cardano-cli ^>= 10.13 + , cardano-cli ^>= 10.14 , cardano-crypto-class ^>=2.2.3.2 , http-media , iohk-monitoring diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index c7238d39b58..ed5752670b6 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -41,8 +41,8 @@ library , annotated-exception , ansi-terminal , bytestring - , cardano-api ^>= 10.19 - , cardano-cli:{cardano-cli, cardano-cli-test-lib} ^>= 10.13 + , cardano-api ^>= 10.20 + , cardano-cli:{cardano-cli, cardano-cli-test-lib} ^>= 10.14 , cardano-crypto-class ^>=2.2.3.2 , cardano-crypto-wrapper , cardano-git-rev ^>= 0.2.2 diff --git a/flake.lock b/flake.lock index 4011f7d96a8..12efe3de39d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1764072073, - "narHash": "sha256-ZLlhdnWO8bP5gsbmUKg6U+3oxBX66vZUO6jyirAhgHo=", + "lastModified": 1767347536, + "narHash": "sha256-9TexWy0rix2zjRY8tt6Q+A6Xj4WLuFL6KN7BMlxl6pk=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "be9725d16fb590998020914e0b71f41a23c50ec2", + "rev": "7da010cd68b844ce9a0e2e0db5a0713065da2f76", "type": "github" }, "original": { @@ -306,11 +306,11 @@ "hackageNix_2": { "flake": false, "locked": { - "lastModified": 1761265459, - "narHash": "sha256-7tsC/ZcNBJR1pXWdKsRoh/qlVDhCxb1Ukr7PVd2zieE=", + "lastModified": 1767592469, + "narHash": "sha256-pFYhQurE+X1dbxU+MCL6bWZZwBNFJLhvl4n91Xo0yd0=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "eb8e4d02528b4973cd09450bb62cf34997777226", + "rev": "1739dc714cea6a0db892aab15d8c1541a3041109", "type": "github" }, "original": { diff --git a/nix/haskell.nix b/nix/haskell.nix index 15650924eff..07a654e1935 100644 --- a/nix/haskell.nix +++ b/nix/haskell.nix @@ -21,7 +21,7 @@ let { src = ../.; name = "cardano-node"; - compiler-nix-name = lib.mkDefault "ghc967"; + compiler-nix-name = lib.mkDefault "ghc912"; # Extra-compilers # flake.variants = lib.genAttrs ["ghc$VERSION"] (x: {compiler-nix-name = x;}); cabalProjectLocal = '' @@ -57,9 +57,13 @@ let nix-prefetch-git pkg-config hlint - ghcid haskell-language-server - cabal + # TODO: for some reason it tries to build very old cabal-install and ghcid from source, + # probably because haskell.nix is pinned + # cabal + # ghcid + # use cabal-install from nixpkgs instead for now: + cabal-install actionlint shellcheck stylish-haskell @@ -123,7 +127,7 @@ let modules = [ ({ lib, pkgs, ... }: { - packages.cardano-node-chairman.components.tests.chairman-tests.buildable = lib.mkForce pkgs.stdenv.hostPlatform.isUnix; + # packages.cardano-node-chairman.components.tests.chairman-tests.buildable = lib.mkForce pkgs.stdenv.hostPlatform.isUnix; package-keys = ["plutus-tx-plugin"]; packages.plutus-tx-plugin.components.library.platforms = with lib.platforms; [ linux darwin ]; @@ -218,30 +222,30 @@ let # split data output for ekg to reduce closure size package-keys = ["ekg"]; packages.ekg.components.library.enableSeparateDataOutput = true; - packages.cardano-node-chairman.components.tests.chairman-tests.build-tools = - lib.mkForce [ - pkgs.lsof - config.hsPkgs.cardano-node.components.exes.cardano-node - config.hsPkgs.cardano-cli.components.exes.cardano-cli - config.hsPkgs.cardano-node-chairman.components.exes.cardano-node-chairman - ]; - # cardano-node-chairman depends on cardano-node and cardano-cli, and some config files - packages.cardano-node-chairman.preCheck = - let - # This define files included in the directory that will be passed to `H.getProjectBase` for this test: - filteredProjectBase = incl ../. cardanoTestnetGoldenFiles; - in - # work around 104 chars socket path limit by using a different temporary directory - '' - ${exportCliPath} - ${exportNodePath} - ${exportChairmanPath} - export CARDANO_NODE_SRC=${filteredProjectBase} - # unset TMPDIR, otherwise mktemp will use that as a base - unset TMPDIR - export TMPDIR=$(mktemp -d) - export TMP=$TMPDIR - ''; + # packages.cardano-node-chairman.components.tests.chairman-tests.build-tools = + # lib.mkForce [ + # pkgs.lsof + # config.hsPkgs.cardano-node.components.exes.cardano-node + # config.hsPkgs.cardano-cli.components.exes.cardano-cli + # config.hsPkgs.cardano-node-chairman.components.exes.cardano-node-chairman + # ]; + # # cardano-node-chairman depends on cardano-node and cardano-cli, and some config files + # packages.cardano-node-chairman.preCheck = + # let + # # This define files included in the directory that will be passed to `H.getProjectBase` for this test: + # filteredProjectBase = incl ../. cardanoTestnetGoldenFiles; + # in + # # work around 104 chars socket path limit by using a different temporary directory + # '' + # ${exportCliPath} + # ${exportNodePath} + # ${exportChairmanPath} + # export CARDANO_NODE_SRC=${filteredProjectBase} + # # unset TMPDIR, otherwise mktemp will use that as a base + # unset TMPDIR + # export TMPDIR=$(mktemp -d) + # export TMP=$TMPDIR + # ''; # cardano-testnet depends on cardano-node, cardano-cli, cardano-submit-api and some config files packages.cardano-node.components.tests.cardano-node-test.preCheck = let diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 9e295536b6e..8615dccfd6f 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -36,11 +36,13 @@ in with final; cabal = haskell-nix.cabal-install.${compiler-nix-name}; + # TODO: update? use ${compiler-nix-name}? hlint = haskell-nix.tool "ghc96" "hlint" { version = "3.8"; index-state = "2025-04-22T00:00:00Z"; }; + # TODO: update? ghcid = haskell-nix.tool compiler-nix-name "ghcid" { version = "0.8.7"; index-state = "2024-12-24T12:56:48Z";