Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- lblStatic :: Label
- (?!#) :: Bool -> PredicateFailure sts -> Rule sts ctx ()
- (?!#:) :: Either e () -> (e -> PredicateFailure sts) -> Rule sts ctx ()
- failBecauseS :: PredicateFailure sts -> Rule sts ctx ()
- applySTSNonStatic :: forall s m rtype. ( STS s, RuleTypeRep rtype, m ~ BaseM s) => RuleContext rtype s -> m ( Either [ PredicateFailure s] ( State s))
- applySTSValidateSuchThat :: forall s m rtype. ( STS s, RuleTypeRep rtype, m ~ BaseM s) => ([ Label ] -> Bool ) -> RuleContext rtype s -> m ( Either [ PredicateFailure s] ( State s))
- mapMaybeValidation :: (e -> Maybe e') -> Validation ( NonEmpty e) () -> Validation ( NonEmpty e') ()
-
class
Inject
t s
where
- inject :: t -> s
-
class
InjectMaybe
t s
where
- injectMaybe :: t -> Maybe s
- type Test failure = Validation ( NonEmpty failure) ()
- runTest :: Inject t ( PredicateFailure sts) => Test t -> Rule sts ctx ()
- runTestMaybe :: InjectMaybe t ( PredicateFailure sts) => Test t -> Rule sts ctx ()
- runTestOnSignal :: Inject t ( PredicateFailure sts) => Test t -> Rule sts ctx ()
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.
Indicates that this check depends only upon the signal to the transition, not the state or environment.
(?!#) :: Bool -> PredicateFailure 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.
(?!#:) :: 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 :: PredicateFailure sts -> Rule sts ctx () Source #
Fail, if static checks are enabled.
applySTSNonStatic :: forall s m rtype. ( STS s, RuleTypeRep rtype, m ~ BaseM s) => RuleContext rtype s -> m ( Either [ PredicateFailure s] ( State s)) Source #
Apply an STS system and do not validate any static checks.
applySTSValidateSuchThat :: forall s m rtype. ( STS s, RuleTypeRep rtype, m ~ BaseM s) => ([ Label ] -> Bool ) -> RuleContext rtype s -> m ( Either [ PredicateFailure s] ( State s)) Source #
Interface with validation-selective libarary
mapMaybeValidation :: (e -> Maybe e') -> Validation ( NonEmpty e) () -> Validation ( NonEmpty e') () Source #
Helper function to filter out unused failures
Interface for independent Tests
class InjectMaybe t s where Source #
injectMaybe :: t -> Maybe s Source #
type Test failure = Validation ( NonEmpty failure) () Source #
runTestMaybe :: InjectMaybe t ( PredicateFailure sts) => Test t -> Rule sts ctx () Source #
runTestOnSignal :: Inject t ( PredicateFailure sts) => Test t -> Rule sts ctx () Source #