-
Notifications
You must be signed in to change notification settings - Fork 158
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
More Alonzo unit tests & clean-up #2272
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
The function collectTwoPhaseScriptInputs should not be looking for plutus data for the 1-phase scripts.
The function shelleyStyleWitness calls the UTXO rule in every era. Moreover, the Alonzo UTXOW rule calls both shelleyStyleWitness and the UTXO rule directly (ignoring the state change in the first call). This results in wasted computation and duplicate predicate failures. We now remove the direct call of the UTXO rule in the alonzo UTOXW and call shelleyStyleWitness at the end.
The function shelleyStyleWitness checks the 1-phase scripts, so the error Phase1ScriptWitnessNotValidating in the Alonzo UTXOW rule is redundant.
This error should never happen in isolation, that would indicate a logic error in the rules. It does, however, occur alongside other errors. I have renamed it to CollectErrors.
Because of https://gitlab.haskell.org/ghc/ghc/-/issues/14630, we get a name shadowing warning when we use named field puns together with pattern synonyms.
It is checked with MissingScriptWitnessesUTXOW in the function shelleyStyleWitness.
polinavino
approved these changes
May 10, 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.
great catches on the double-doing things! and super helpful examples, thanks!
We add an example transaction that has scripts everywhere, including both 1-phase and 2-phase scripts. We add examples of invalid transactions.
JaredCorduan
force-pushed
the
jc/utxow-examples-with-timelocks
branch
from
May 10, 2021 20:49
86722e2
to
0989b33
Compare
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.
This PR might be easiest to review commit by commit.
📏 New examples / unit tests
🧹 Cleanup
AlonzoPredFail
round trip serialization testUTXOW
rule was sneakily calling theUTXO
rule twice. In alonzo, all the predicates that are in common with the previous eras are checked via theshelleyStyleWitness
, which calls theUTXO
rule. But the AlonzoUTXOW
was also callingUTXO
directly. This was only noticeable in the predicate failures, since they were repeated twice (the the state transformation was happen twice, the first results of which were discarded).Phase1ScriptWitnessNotValidating
failure, and once in theshelleyStyleWitness
function.MissingNeededScriptHash
failure, and once in theshelleyStyleWitness
function.ShouldNeverHappenScriptInputsNotFound
toCollectErrors
. This error should never happen in isolation, that would indicate a logic error in the rules. It does, however, occur alongside other errors. Though (hopefully) redundant, it is a nice sanity check.🪲 Bug
collectTwoPhaseScriptInputs
function needs to filter out script hashes for every one that is known to not be a 1-phase script, ie those in the script witnesses which are 1-phase. The formal spec does this in a slightly sneaky way right now by applying a functionlanguage
to the script hashes, which is not defined on 1-phase script hashes.📚 Verbosity
The current examples are very verbose and much of what is visible is noise. My next goal is to find a way to make them much more concise, in a way that highlights what is interesting about each example.