Merge pull request #142 from input-output-hk/ksaric/CAD-2450
[CAD-2450] Bump up to Mary (Native tokens) support.
[CAD-2450] Bump up to Mary (Native tokens) support.
# Explorer DB Node configuration
NetworkName: launchpad
EnableLogMetrics: False
EnableLogging: True
Protocol: Cardano
# The config file for the node we are connecting to. If this is not the correct
# config, it will likely lead to db-sync throwing up weird error messages from
# the consensus layer.
# The path to the node config file is relative to this config file.
NodeConfigFile: /nix/store/s2z0clsfwci7z2g4167nlvf3i0m2wb6s-config-0.json
# ------------------------------------------------------------------------------
# Logging configuration follows.
# global filter; messages must have at least this severity to pass:
minSeverity: Info
# global file rotation settings:
rotation:
rpLogLimitBytes: 5000000
rpKeepFilesNum: 10
rpMaxAgeHours: 24
# these backends are initialized:
setupBackends:
- AggregationBK
- KatipBK
# - EditorBK
# - EKGViewBK
# if not indicated otherwise, then messages are passed to these backends:
defaultBackends:
- KatipBK
# if wanted, the GUI is listening on this port:
# hasGUI: 12787
# if wanted, the EKG interface is listening on this port:
# hasEKG: 12788
# here we set up outputs of logging in 'katip':
setupScribes:
- scKind: StdoutSK
scName: stdout
scFormat: ScText
scRotation: null
# if not indicated otherwise, then log output is directed to this:
defaultScribes:
- - StdoutSK
- stdout
# more options which can be passed as key-value pairs:
options:
cfokey:
value: "Release-1.0.0"
mapSubtrace:
benchmark:
contents:
- GhcRtsStats
- MonotonicClock
subtrace: ObservableTrace
'#ekgview':
contents:
- - tag: Contains
contents: 'cardano.epoch-validation.benchmark'
- - tag: Contains
contents: .monoclock.basic.
- - tag: Contains
contents: 'cardano.epoch-validation.benchmark'
- - tag: Contains
contents: diff.RTS.cpuNs.timed.
- - tag: StartsWith
contents: '#ekgview.#aggregation.cardano.epoch-validation.benchmark'
- - tag: Contains
contents: diff.RTS.gcNum.timed.
subtrace: FilterTrace
'cardano.epoch-validation.utxo-stats':
# Change the `subtrace` value to `Neutral` in order to log
# `UTxO`-related messages during epoch validation.
subtrace: NoTrace
'#messagecounters.aggregation':
subtrace: NoTrace
'#messagecounters.ekgview':
subtrace: NoTrace
'#messagecounters.switchboard':
subtrace: NoTrace
'#messagecounters.katip':
subtrace: NoTrace
'#messagecounters.monitoring':
subtrace: NoTrace
'cardano.#messagecounters.aggregation':
subtrace: NoTrace
'cardano.#messagecounters.ekgview':
subtrace: NoTrace
'cardano.#messagecounters.switchboard':
subtrace: NoTrace
'cardano.#messagecounters.katip':
subtrace: NoTrace
'cardano.#messagecounters.monitoring':
subtrace: NoTrace
mapBackends:
cardano.epoch-validation.benchmark:
- AggregationBK
'#aggregation.cardano.epoch-validation.benchmark':
- EKGViewBK
mapSeverity:
db-sync-node.Subscription: Error
db-sync-node.Mux: Error
db-sync-node: Info
-> WithOrigin BlockNo
-> DbActionQueue
-> ChainSyncClientPipelined CardanoBlock (Point CardanoBlock) (Tip CardanoBlock) IO ()
chainSyncClient dataLayer metricsLayer trce env queryVar latestPoints currentTip actionQueue = do
chainSyncClient dataLayer metricsLayer trce env queryVar latestPoints currentTip actionQueue = do
ChainSyncClientPipelined $ pure $
-- Notify the core node about the our latest points at which we are
-- synchronised. This client is not persistent and thus it just
Right _val -> return $ Right poolId
, dlAddGenesisMetaBlock = \meta block -> do
-- This whole function has to be atomic!
-- This is a bit tricky, but will do the job.
runExceptT $ do
-- Well, in theory this should be handled differently.
count <- newExceptT (Right <$> (runDbAction tracer $ queryBlockCount))
when (count > 0) $
left $ UnknownError "Shelley.insertValidateGenesisDist: Genesis data mismatch."
metaId <- newExceptT $ runDbAction tracer $ insertMeta $ meta
blockId <- newExceptT $ runDbAction tracer $ insertBlock $ block
-- First wrap it so we chain errors, run it and wrap it again so
-- we match the top level chain of errors.
newExceptT . runDbAction tracer . runExceptT $ do
metaId <- newExceptT $ insertMeta meta
blockId <- newExceptT $ insertBlock block
return (metaId, blockId)
pure (metaId, blockId)
, dlGetSlotHash = \slotNo ->
runDbAction tracer $ querySlotHash slotNo
-- TODO(KS): Needs a @[email protected]
-- TODO(KS): Metrics layer!
runDbThread
:: Trace IO Text
:: HasCallStack
=> Trace IO Text
-> DbSyncEnv
-> DbSyncNodePlugin
-> DbActionQueue
import Cardano.Prelude
import Cardano.BM.Trace (Trace,
logError, logInfo)
import Cardano.BM.Trace (Trace, logError, logInfo)
import Control.Monad.Logger (LoggingT)
import Control.Monad.Trans.Except.Extra (firstExceptT,
newExceptT,
runExceptT)
import Control.Monad.Trans.Reader (ReaderT)
import Control.Monad.Logger (LoggingT)
import Control.Monad.Trans.Except.Extra (firstExceptT, newExceptT,
runExceptT)
import Control.Monad.Trans.Reader (ReaderT)
import Cardano.SMASH.DB (DBFail (..),
DataLayer (..))
import Cardano.SMASH.Offline (fetchInsertNewPoolMetadata)
import Cardano.SMASH.Types (PoolId (..),
PoolMetadataHash (..),
PoolUrl (..))
import Cardano.SMASH.DB (DBFail (..),
DataLayer (..))
import Cardano.SMASH.Offline (fetchInsertNewPoolMetadata)
import Cardano.SMASH.Types (PoolId (..),
PoolMetadataHash (..),
PoolUrl (..))
import qualified Cardano.Chain.Block as Byron
import qualified Cardano.Chain.Block as Byron
import qualified Data.ByteString.Base16 as B16
import qualified Data.ByteString.Base16 as B16
import Database.Persist.Sql (IsolationLevel (..),
SqlBackend,
transactionSaveWithIsolation)
import Database.Persist.Sql (IsolationLevel (..),
SqlBackend,
transactionSaveWithIsolation)
import qualified Cardano.SMASH.DBSync.Db.Insert as DB
import qualified Cardano.SMASH.DBSync.Db.Schema as DB
import qualified Cardano.SMASH.DBSync.Db.Insert as DB
import qualified Cardano.SMASH.DBSync.Db.Schema as DB
import Cardano.DbSync.Config.Types
import Cardano.DbSync.Error
import Cardano.DbSync.Types as DbSync
import Cardano.DbSync.Types as DbSync
import Cardano.DbSync.LedgerState
import Cardano.DbSync (DbSyncNodePlugin (..))
import Cardano.DbSync (DbSyncNodePlugin (..))
import Cardano.DbSync.Util
import qualified Cardano.DbSync.Era.Byron.Util as Byron
import qualified Cardano.DbSync.Era.Shelley.Generic as Shelley
import qualified Cardano.DbSync.Era.Byron.Util as Byron
import qualified Cardano.DbSync.Era.Shelley.Generic as Shelley
import Cardano.Slotting.Block (BlockNo (..))
import Cardano.Slotting.Slot (EpochNo (..),
SlotNo (..))
import Cardano.Slotting.Block (BlockNo (..))
import Cardano.Slotting.Slot (EpochNo (..),
EpochSize (..),
SlotNo (..))
import Shelley.Spec.Ledger.BaseTypes (strictMaybeToMaybe)
import qualified Shelley.Spec.Ledger.BaseTypes as Shelley
import qualified Shelley.Spec.Ledger.TxBody as Shelley
import Shelley.Spec.Ledger.BaseTypes (strictMaybeToMaybe)
import qualified Shelley.Spec.Ledger.BaseTypes as Shelley
import qualified Shelley.Spec.Ledger.TxBody as Shelley
import Ouroboros.Consensus.Byron.Ledger (ByronBlock (..))
import Ouroboros.Consensus.Byron.Ledger (ByronBlock (..))
import Ouroboros.Consensus.Cardano.Block (HardForkBlock (..),
StandardShelley)
import Ouroboros.Consensus.Cardano.Block (HardForkBlock (..),
StandardShelley)
import qualified Cardano.DbSync.Era.Shelley.Generic as Generic
import qualified Cardano.DbSync.Era.Shelley.Generic as Generic
-- |Pass in the @[email protected]
poolMetadataDbSyncNodePlugin :: DataLayer -> DbSyncNodePlugin
liftIO $ do
let epoch = unEpochNo (sdEpochNo details)
slotWithinEpoch = unEpochSlot (sdEpochSlot details)
globalSlot = epoch * (unEpochSize $ sdEpochSize details) + slotWithinEpoch
when (slotWithinEpoch `mod` 1000 == 0) $
logInfo tracer $ mconcat
[ "Insert '", show blockName
, "' block pool info: epoch ", show epoch
, ", slot ", show slotWithinEpoch
, ", block ", show blockNumber
, ", global slot ", show globalSlot
]
lift $ transactionSaveWithIsolation Serializable
external-libsodium-vrf: false
ghc-options:
smash: -Wall -Werror -fwarn-redundant-constraints
#smash-servant-types: -Wall -Werror -fwarn-redundant-constraints
smash: -Wall -Werror -fno-warn-redundant-constraints
#smash-servant-types: -Wall -Werror -fno-warn-redundant-constraints
extra-deps:
- persistent-2.11.0.1
db: Improve the way database inserts are done
2930: Add a self-issued predicate to the Consensus interface r=nfrisby a=nfrisby Fixes #2926. Co-authored-by: Nicolas Frisby <[email protected]>
This new component of the Consensus API satisfies Issue 2926 by providing a predicate for the new node metric that monitors forged blocks that didn't end up on the chain. See CAD-2371.
The old insert, for the most common case, required two round trips for a database insert. This has been reduced to a single trip. Closes: https://github.com/input-output-hk/cardano-db-sync/issues/529
* Consolidate tmp storage between scripts Utilize a common TMP_DIR set in `env` as base dir for temporary files. Scripts may create sub-folders to TMP_DIR(default /tmp/cnode) for further separation. TIMEOUT_LEDGER_STATE set in both cntools and cncli moved to env * Remove leading / from ${TMP_DIR} usage already defined in variable Co-authored-by: Priyank <[email protected]>