-
Notifications
You must be signed in to change notification settings - Fork 486
Add goldenEvalCekCatchBudget
and change existing cases to use it
#7093
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
Conversation
`goldenEvalCekCatchBudget` combines `goldenBudget` and `goldenEvalCekCatch`. Unlike calling two separately, this will only run CEK once.
84b6f09
to
338617c
Compare
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.
Less noise is always a good thing.
`goldenEvalCekCatchBudget` should be used instead
6e60c79
to
ee083fd
Compare
Now argument is just `toUPlc a => a` not `[a]`
@SeungheonOh I added the "no changelog required" label. It's fine to add it to make CI happy if your changes aren't user facing (like in this case). |
I don't have permission to add labels nor merge anything(even with CI passing and approved review!) yet. For now, please feel free to merge this whenever CI's happy. |
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.
Good work 👍
plutus-tx/testlib/PlutusTx/Test.hs
Outdated
nestedGoldenVsDocM name ".eval" $ do | ||
either (pretty . show) prettyPlcClassicSimple | ||
<$> runExceptT (fst <$> evalRes) | ||
nestedGoldenVsDocM name ".budget" $ ppCatch $ do |
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.
I think it's better to create one file containing both budget and result, instead of two?
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.
I think so too. Budget should go first in case the result is large (can happen for early Plutus versions of if error message is long).
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.
My reasoning here is based on this comment by @Unisay : #6846 (comment)
Having two files will give better feedback: one can easily check if budgeting is broken or evaluator is broken or both are broken from file changes without going over each files
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.
I disagree - you don't need to go over the entire file if the budget changed and the result didn't - the diff would clearly show that, especially if the budget appears before the result like @effectfully said.
Having both in a single file makes it easier to review the change (which benefits both the author and the reviewers): when the budget changes, I always want to verify whether the result changed too. Putting them in separate files means I'd need to look for the corresponding .eval
file, which may not be adjacent to the .budget
file, or included in the PR. With a single file, I can scan through changes much more efficiently.
8e4e4cf
to
6939a9d
Compare
8c81d8f
to
fb34a0a
Compare
fb34a0a
to
44e3826
Compare
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.
There are some golden files that need to be removed, e.g. checkScriptContext2-20.budget.golden
. You can delete all golden files and then re-run the tests.
d3db10c
to
cdd8389
Compare
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.
Try
cabal test plutus-tx-plugin --test-options=--accept
cabal test plutus-benchmark --test-options=--accept
cabal test plutus-ledger-api:plutus-ledger-api-plugin-test --test-options=--accept
cabal test cardano-constitution --test-options=--accept
This should fix all the golden files.
cdd8389
to
e8b1ccd
Compare
e8b1ccd
to
62a968e
Compare
goldenEvalCekCatchBudget
combinesgoldenBudget
andgoldenEvalCekCatch
. Unlike calling two separately, this will only run CEK once.Previous cases that used
goldenBudget
will usegoldenEvalCekCatchBudget
since it's more sensible to test their evaluation result as well.Also, changed some cases to use
goldenBundle'
. Looks like these were missed out from #7057.Closes #6846