Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only evaluate Plutus scripts in static checks. #2767

Merged
merged 1 commit into from
May 4, 2022
Merged

Only evaluate Plutus scripts in static checks. #2767

merged 1 commit into from
May 4, 2022

Commits on May 4, 2022

  1. Only evaluate Plutus scripts in static checks.

    Initially, Plutus scripts were evaluated using the following:
    ```
          evalScripts @era tx sLst
            ?!## ValidationTagMismatch (getField @"isValid" tx)
    ```
    
    However, as of #2386, additional reporting was added to Plutus script
    failure, and this was changed to the following:
    ```
          case evalScripts @era tx sLst of
            Fails sss -> False ?!## ValidationTagMismatch (getField @"isValidating" tx) (pack (Prelude.unlines sss))
            Passes -> pure ()
    ```
    The problem here: `evalScripts` is no longer gated by the `?!##`
    operator; it must be evaulated at least to WHNF in order to match the
    `Fails` constructor. This means that when reapplying transactions in the
    mempool (as well as when replaying blocks), we are always running all
    Plutus scripts.
    
    The current semantics for using "labeled" predicates is insufficient to
    solve this, since we cannot carry out additional actions (such as
    emitting events) inside the predicate. As such, we introduce additional
    functionality in the STS system to allow gating sections of rules (which
    do not result in a return value) with labels. For the sake of
    consistency, the existing `labeledPred` function et al are updated to
    make use of this new feature.
    
    The entire call to `evalScripts` is now gated by a `nonStatic` label,
    and hence will not be evaulated in any `reapply` scenario.
    nc6 committed May 4, 2022
    Configuration menu
    Copy the full SHA
    e3ab11a View commit details
    Browse the repository at this point in the history