ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Block.SupportsSanityCheck

Description

This module adds support for sanity checking consensus configuration on node startup. These checks should primarily look for unusual configuration choices that may point to an accidentally-misconfigured node and quietly cause problems, rather than incoherent configurations that will result in fatal errors at a later point.

While in most situations they can be handled as fatal issues, there are situations when intentionally configuring a node "weirdly" can be useful, and so the user should be able to opt out of the sanity checks at their own peril.

Synopsis

Documentation

class BlockSupportsSanityCheck blk where Source #

BlockSupportsSanityCheck provides evidence that a block can be sanity checked for common issues on node startup. sanityCheckConfig, which runs performs each check and returns a list with each SanityCheckIssue found, should be preferred over using these methods directly.

Methods

configAllSecurityParamsTopLevelConfig blk → NonEmpty SecurityParam Source #

Generate a NonEmpty list of security parameters for a given block type. For individual eras' block types, this is simply a singleton list containing the chosen SecurityParam, but combined block types (i.e. the HardForkCombinator) will return all of their constituent eras' configurations' security parameters.

data SanityCheckIssue Source #

An issue found in the consensus configuration. See displayException for human-readable descriptions of each of these cases, especially when presenting these to users.

Constructors

InconsistentSecurityParam (NonEmpty SecurityParam)

Configuration contains multiple security parameters. This may cause strange behaviour around era boundaries.

SnapshotDelayRangeInverted

The configured minimumDelay in SnapshotDelayRange is greater than maximumDelay. The random snapshot delay will be sampled from an inverted range, which is almost certainly a misconfiguration.

Fields

  • !DiffTime

    The configured minimumDelay (the larger value)

  • !DiffTime

    The configured maximumDelay (the smaller value)

SnapshotDelayRangeNegativeMinimum

The configured minimumDelay in SnapshotDelayRange is negative. A negative delay has no meaningful interpretation.

Fields

SnapshotRateLimitDisabled

The configured sfaRateLimit is non-positive, which disables snapshot rate limiting entirely. Without a rate limit, snapshots may be taken very frequently during bulk sync, causing excessive disk I/O.

SnapshotRateLimitSuspiciouslyLarge

The configured sfaRateLimit exceeds 24 hours. At steady state, the node may go more than a day between snapshots, significantly increasing replay time after an unclean restart.

Fields

SnapshotNumZero

The configured number of on-disk snapshots to keep is zero. Snapshots will be written to disk and then immediately deleted, leaving nothing for crash recovery. The node will have to replay from genesis on every unclean restart.

SnapshotIntervalNotDivisorOfEpoch

The configured snapshot interval does not divide 432000 (the Cardano mainnet epoch length in slots). Snapshots will not land on epoch boundaries, breaking Mithril compatibility.

Fields

  • !Word64

    The configured interval in slots

checkSecurityParamConsistencyBlockSupportsSanityCheck blk ⇒ TopLevelConfig blk → Maybe SanityCheckIssue Source #

Check a TopLevelConfig for any inconsistency in constituent choices for SecurityParam (colloquially k). For a block type to be considered "sane" in this regard, its configuration's security parameter as well as all of its childrens' configurations (if applicable) should be the same.

sanityCheckConfigBlockSupportsSanityCheck blk ⇒ TopLevelConfig blk → [SanityCheckIssue] Source #

Run all supported sanity checks on a given TopLevelConfig.