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

Add extra type-safety to ensure that all predicate failures have roundtrip tests #4152

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

Soupstraw
Copy link
Contributor

@Soupstraw Soupstraw commented Mar 4, 2024

Description

This PR adds the RuleListEra typeclass, which has an associated type level list with all the (fallible) rules in that era. This gives us a closed world view of the rules and that makes it easier to write tests that iterate over each rule. See roundTripAllPredicateFailures for an example.

resolves #3866

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

@Soupstraw Soupstraw force-pushed the jj/conway-pred-failure-serialization-tests branch 7 times, most recently from ac88a3b to fe1161f Compare March 4, 2024 17:06
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

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

This is looking great!!! 😃

@Soupstraw Soupstraw force-pushed the jj/conway-pred-failure-serialization-tests branch 2 times, most recently from e4a91e6 to ad43c74 Compare March 5, 2024 10:41
@Soupstraw Soupstraw marked this pull request as ready for review March 5, 2024 10:42
@Soupstraw Soupstraw force-pushed the jj/conway-pred-failure-serialization-tests branch 3 times, most recently from 936fae5 to d967111 Compare March 5, 2024 11:06
@Soupstraw Soupstraw force-pushed the jj/conway-pred-failure-serialization-tests branch from d967111 to a7f9ed0 Compare March 5, 2024 11:08
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

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

This looks great. Exactly what I envisioned. However, we need the same testing for all previous eras as well not just Conway.

eras/conway/impl/src/Cardano/Ledger/Conway/Era.hs Outdated Show resolved Hide resolved
@Soupstraw Soupstraw force-pushed the jj/conway-pred-failure-serialization-tests branch 2 times, most recently from bc89a50 to d260713 Compare March 5, 2024 12:37
@Soupstraw Soupstraw requested a review from lehins March 5, 2024 12:37
@Soupstraw Soupstraw force-pushed the jj/conway-pred-failure-serialization-tests branch from d260713 to a782c8d Compare March 5, 2024 12:39
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

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

Beautiful!

@lehins lehins enabled auto-merge (squash) March 5, 2024 20:58
@lehins lehins disabled auto-merge March 5, 2024 23:22
@lehins lehins enabled auto-merge (squash) March 5, 2024 23:22
@lehins lehins disabled auto-merge March 6, 2024 07:27
@lehins lehins force-pushed the jj/conway-pred-failure-serialization-tests branch from 3ba1d94 to fe394c1 Compare March 6, 2024 07:29
@lehins lehins enabled auto-merge March 6, 2024 07:29
@lehins lehins merged commit a0e011b into master Mar 6, 2024
16 checks passed
Soupstraw pushed a commit that referenced this pull request Mar 6, 2024
…ialization-tests

Add extra type-safety to ensure that all predicate failures have roundtrip tests
@Soupstraw Soupstraw deleted the jj/conway-pred-failure-serialization-tests branch March 6, 2024 10:41
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.

Add serialization tests for all Conway predicate failures
2 participants