-
Notifications
You must be signed in to change notification settings - Fork 157
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
Added reporting of why Plutus scripts fail. #2386
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TimSheard
force-pushed
the
ts-plutusScriptFails-document
branch
from
July 16, 2021 20:12
a4b1650
to
8f912d6
Compare
JaredCorduan
approved these changes
Jul 19, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me!
@TimSheard - this is not a WIP anymore, is it? |
nc6
approved these changes
Jul 26, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a couple of suggestions, but in general looks good. I'm assuming no longer WIP
TimSheard
force-pushed
the
ts-plutusScriptFails-document
branch
3 times, most recently
from
July 30, 2021 15:03
f7595cb
to
4b91a8a
Compare
TimSheard
changed the title
WIP Added reporting of why Plutus scripts fail.
Added reporting of why Plutus scripts fail.
Jul 30, 2021
TimSheard
force-pushed
the
ts-plutusScriptFails-document
branch
from
July 30, 2021 16:01
4b91a8a
to
75d22e3
Compare
TimSheard
force-pushed
the
ts-plutusScriptFails-document
branch
from
July 30, 2021 16:56
75d22e3
to
21f49bf
Compare
nc6
added a commit
that referenced
this pull request
May 3, 2022
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
added a commit
that referenced
this pull request
May 4, 2022
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exended UtxosPredicateFailure, by adding a Text field to its constructor ValidationTagMismatch.
Altered the functions runPLCScript and evalScripts return a ScriptResult rather than a Bool.
data ScriptResult = Passes | Fails ![String]
So when evalScripts fails in the Utxos rule, we add the reason why to ValidationTagMismatch.
Right now the text string is a rather crude concatenation of a bunch of show results. In the next step we will construct the Text object by using the PrettyA class, so the result is more informative.