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

Reduce duplication in Conway UTXOW rule #4056

Merged
merged 4 commits into from
Feb 7, 2024
Merged

Conversation

lehins
Copy link
Contributor

@lehins lehins commented Feb 6, 2024

Description

Fixes #3916

The only difference between Conway's and Babbage's UTXOW rule implementation is that latter has MIR certificate witness validation.

This PR extract MIR validation into a separate action and uses it only in Babbage, while the rest of the logic is reused in Conway.

This PR also fixes a small issue in Alonzo spec, where costmdls was applied to tx instead of pp, which was noted in the rule.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

Copy link
Contributor

@TimSheard TimSheard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but it breaks from a pattern that we have used before. of defining a function like

validateXXX::
EraTx era =>
Tx era -> .. -> Test (SomePredFailure era)

and then calling

runTest $ validateXXX

Is there a reason we did not do this here?

@lehins lehins force-pushed the lehins/cleanup-conway-utxow branch from 3314107 to 3b222c7 Compare February 6, 2024 20:24
@lehins
Copy link
Contributor Author

lehins commented Feb 6, 2024

Is there a reason we did not do this here?

Yes, because this approach is not going to work in this scenario. We need to abstract a collection of rules and reuse them as a whole.

In other words, the approach of using validations (i.e. the runTest) is using them like building blocks, where we can use a whole bunch of similar blocks to construct different walls.

In this case however we want to reuse the whole wall, without one block. Which means we need to split up a rule into a slightly smaller rule, that we can later reuse verbatim in the next era.

@lehins lehins enabled auto-merge February 6, 2024 20:58
@lehins lehins force-pushed the lehins/cleanup-conway-utxow branch from 3b222c7 to 4995e47 Compare February 6, 2024 21:51
@lehins lehins merged commit eb17daf into master Feb 7, 2024
11 of 15 checks passed
@neilmayhew neilmayhew deleted the lehins/cleanup-conway-utxow branch March 8, 2024 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce duplication in the ConwayUTXOW rule
2 participants