cardano-ledger-core-1.22.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellNone
LanguageHaskell2010

Cardano.Ledger.Rules.ValidationMode

Description

Describes modes under which we might validate certain rules in the ledger.

What does this mean? Sometimes, we will want to check only certain conditions specified in the rules. For example, when replaying a previously validated chain, we do not care about rerunning _any_ checks, only making the relevant changes to the ledger state.

Synopsis

Documentation

Static checks are used to indicate that a particular predicate depends only on the signal to the transition, rather than the state or environment. This is particularly relevant where the signal is something such as a transaction, which is fixed, whereas the state and environment depend upon the chain tip upon which we are trying to build a block.

lblStaticLabel Source #

Indicates that this check depends only upon the signal to the transition, not the state or environment.

(?!#) ∷ ∀ sts (ctx ∷ RuleType). BoolPredicateFailure sts → Rule sts ctx () infix 1 Source #

Construct a static predicate check.

The choice of # as a postfix here is made because often these are crypto checks.

(?!#:) ∷ ∀ e sts (ctx ∷ RuleType). Either e () → (e → PredicateFailure sts) → Rule sts ctx () infix 1 Source #

Construct a static predicate check with an explanation.

The choice of # as a postfix here is made because often these are crypto checks.

failBecauseS ∷ ∀ sts (ctx ∷ RuleType). PredicateFailure sts → Rule sts ctx () Source #

Fail, if static checks are enabled.

Interface for independent Tests

class Inject t s where Source #

Methods

inject ∷ t → s Source #

Instances

Instances details
Inject Coin DeltaCoin Source # 
Instance details

Defined in Cardano.Ledger.Coin

Methods

injectCoinDeltaCoin Source #

Inject a a Source # 
Instance details

Defined in Cardano.Ledger.BaseTypes

Methods

inject ∷ a → a Source #

type Test failure = Validation (NonEmpty failure) () Source #

runTest ∷ ∀ (rule ∷ Symbol) f era (ctx ∷ RuleType). InjectRuleFailure rule f era ⇒ Test (f era) → Rule (EraRule rule era) ctx () Source #

runTestOnSignal ∷ ∀ (rule ∷ Symbol) f era (ctx ∷ RuleType). InjectRuleFailure rule f era ⇒ Test (f era) → Rule (EraRule rule era) ctx () Source #

failOnJustStatic ∷ ∀ a sts (ctx ∷ RuleType). Maybe a → (a → PredicateFailure sts) → Rule sts ctx () Source #

Validation with injection of predicate failures

(?!.) ∷ ∀ (rule ∷ Symbol) t era sts (ctx ∷ RuleType). (InjectRuleFailure rule t era, PredicateFailure sts ~ EraRuleFailure rule era) ⇒ Bool → t era → Rule sts ctx () infix 1 Source #

Same as ?!, except accepts injectable predicate failure

checkFailOnJust ∷ ∀ (rule ∷ Symbol) t era sts a (ctx ∷ RuleType). (InjectRuleFailure rule t era, PredicateFailure sts ~ EraRuleFailure rule era) ⇒ Maybe a → (a → t era) → Rule sts ctx () Source #

Same as failOnJust, except accepts injectable predicate failure

checkFailOnNonEmpty ∷ ∀ (rule ∷ Symbol) t era sts f a (ctx ∷ RuleType). (InjectRuleFailure rule t era, PredicateFailure sts ~ EraRuleFailure rule era, Foldable f) ⇒ f a → (NonEmpty a → t era) → Rule sts ctx () Source #

Same as failOnNonEmpty, except accepts injectable predicate failure

checkFailOnNonEmptySet ∷ ∀ (rule ∷ Symbol) t era sts f a (ctx ∷ RuleType). (InjectRuleFailure rule t era, PredicateFailure sts ~ EraRuleFailure rule era, Foldable f, Ord a) ⇒ f a → (NonEmptySet a → t era) → Rule sts ctx () Source #

Same as failOnNonEmptySet, except accepts injectable predicate failure

checkFailOnNonEmptyMap ∷ ∀ (rule ∷ Symbol) t era sts k v (ctx ∷ RuleType). (InjectRuleFailure rule t era, PredicateFailure sts ~ EraRuleFailure rule era) ⇒ Map k v → (NonEmptyMap k v → t era) → Rule sts ctx () Source #

Same as failOnNonEmptyMap, except accepts injectable predicate failure

Static

(?!#.) ∷ ∀ (rule ∷ Symbol) t era sts (ctx ∷ RuleType). (InjectRuleFailure rule t era, PredicateFailure sts ~ EraRuleFailure rule era) ⇒ Bool → t era → Rule sts ctx () infix 1 Source #

Same as ?!#, except accepts injectable predicate failure

checkFailOnLeftStatic ∷ ∀ (rule ∷ Symbol) t era sts e (ctx ∷ RuleType). (InjectRuleFailure rule t era, PredicateFailure sts ~ EraRuleFailure rule era) ⇒ Either e () → (e → t era) → Rule sts ctx () Source #

Same as ?!#:, except accepts injectable predicate failure and is not designed to be used as infix operator

checkFailOnJustStatic ∷ ∀ (rule ∷ Symbol) t era sts a (ctx ∷ RuleType). (InjectRuleFailure rule t era, PredicateFailure sts ~ EraRuleFailure rule era) ⇒ Maybe a → (a → t era) → Rule sts ctx () Source #

Same as failOnJustStatic, except accepts injectable predicate failure