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

CDDL roundtrip testing #3809

Merged
merged 15 commits into from
Oct 27, 2023
Merged

CDDL roundtrip testing #3809

merged 15 commits into from
Oct 27, 2023

Conversation

lehins
Copy link
Collaborator

@lehins lehins commented Oct 25, 2023

Description

  • Move cddl files to the era packages
  • Switch to using hspec for testing cddl
  • Add roundtrip testing to the cddl tests. Meaning that the value is now checked on the Haskell side that reserialization produces the same value. We already do this kind of test for all of the types, but this one uses CDDL generators, rather QuickCheck's arbitrary, which is just a nice litlle extra.
  • Move CDDL tests for TPraos header to cardano-protocol-tpraos, rather than run it in shelley.
  • Important part is that all of the same functionality is still being tested. No tests were removed. But, no tests have been added for any types that haven't been tested before. We'll need to do that in a separate PR, since current CDDL tests are not exhaustive.

Noticeable speed up in the CDDL testing. This is new:

$ cabal build cardano-protocol-tpraos cardano-ledger-shelley cardano-ledger-allegra cardano-ledger-mary cardano-ledger-alonzo cardano-ledger-babbage cardano-ledger-conway
...
$ time cabal test cardano-protocol-tpraos cardano-ledger-shelley cardano-ledger-allegra cardano-ledger-mary cardano-ledger-alonzo cardano-ledger-babbage cardano-ledger-conway --test-options='-m CDDL' -j1
...
real	2m31.690s
user	2m22.752s
sys	0m10.389s

vs old:

$ cabal build cardano-ledger-shelley-test cardano-ledger-shelley-ma-test cardano-ledger-alonzo-test cardano-ledger-babbage-test cardano-ledger-conway-test
...
$ time cabal test cardano-ledger-shelley-test cardano-ledger-shelley-ma-test cardano-ledger-alonzo-test cardano-ledger-babbage-test cardano-ledger-conway-test --test-options='-p CDDL' -j1
...
real	3m50.625s
user	3m37.120s
sys	0m15.423s

Which means we can add some more CDDL tests.

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

@lehins lehins changed the title Lehins/cddl roundtrip testing CDDL roundtrip testing Oct 25, 2023
@lehins lehins force-pushed the lehins/cddl-roundtrip-testing branch from 52ff181 to 424436a Compare October 25, 2023 22:00
@lehins lehins force-pushed the lehins/cddl-roundtrip-testing branch from 9f9ff8f to d14aafa Compare October 25, 2023 23:33
@lehins lehins marked this pull request as ready for review October 25, 2023 23:33
@lehins lehins force-pushed the lehins/cddl-roundtrip-testing branch from d14aafa to 2d63451 Compare October 26, 2023 00:37
@lehins lehins force-pushed the lehins/cddl-roundtrip-testing branch from 2d63451 to a01f7da Compare October 26, 2023 00:49
@lehins lehins requested review from a team as code owners October 26, 2023 10:48
Copy link
Contributor

@nc6 nc6 left a comment

Choose a reason for hiding this comment

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

One issue with the documentation of readProcessNoFailure, otherwise everything is minor and may be addresssed/dismissed as desired.

Copy link
Contributor

@aniketd aniketd left a comment

Choose a reason for hiding this comment

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

Awesome! 🙌

@lehins lehins enabled auto-merge October 27, 2023 12:30
@lehins lehins force-pushed the lehins/cddl-roundtrip-testing branch from eb50032 to c449047 Compare October 27, 2023 12:30
@lehins lehins merged commit f0fe926 into master Oct 27, 2023
@iohk-bors iohk-bors bot deleted the lehins/cddl-roundtrip-testing branch October 27, 2023 14:57
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.

3 participants