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

Auto-generate Conway CDDL using Cuddle #4510

Merged
merged 7 commits into from
Jul 31, 2024
Merged

Auto-generate Conway CDDL using Cuddle #4510

merged 7 commits into from
Jul 31, 2024

Conversation

nc6
Copy link
Contributor

@nc6 nc6 commented Jul 26, 2024

Description

This PR resolves #4125 by adding a new conway executable utility, huddle-cddl, which will auto-generate the Conway CDDL (as a single file) from the Huddle specification. Consequently, the existing specifications have been removed.

The existing CDDL tests have been remapped to be based upon the generated file and confirmed to work correctly.

In addition, it resolves the remaining comments from #4437, namely:

  • The issue with / and // has been resolved. There is now only the / operator in Huddle, and its usage is carefully documented.
  • header has been reformatted
  • Deprecation warnings have been added to stake_registration, stake_deregistration, and redeemers.
  • Duplicate comments have been removed
  • The "n" argument for script_n_of_k has now been properly sized as an int64.

Checklist

  • [x ] Commit sequence broadly makes sense and commits have useful messages
  • [x ] 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

@nc6 nc6 requested a review from lehins July 26, 2024 09:50
@nc6 nc6 force-pushed the nc/4461 branch 3 times, most recently from 9f85df2 to 450c940 Compare July 26, 2024 13:26
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. One major thing I don't like is addition of a new package: it is totally unnecessary.

eras/conway/impl/cddl-files/conway-merged.cddl Outdated Show resolved Hide resolved
scripts/gen-cddl.sh Outdated Show resolved Hide resolved
libs/cardano-cddl/app/Main.hs Outdated Show resolved Hide resolved
libs/cardano-cddl/app/Main.hs Outdated Show resolved Hide resolved
libs/cardano-cddl/app/Main.hs Outdated Show resolved Hide resolved
libs/cardano-cddl/app/Main.hs Outdated Show resolved Hide resolved
@nc6 nc6 force-pushed the nc/4461 branch 5 times, most recently from 66adb98 to a16933d Compare July 30, 2024 09:41
@nc6 nc6 requested a review from lehins July 30, 2024 14:05
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 beautiful! Thank you!

nc6 and others added 7 commits July 31, 2024 12:05
This addresses issue #4461

We add two things:
- A haskell tool to generate the CDDL files
- A script which verifies if any Cuddle specs have
  changed, and invokes the tool if so.

Both of these would need to be updated in case
additional Cuddle specs were added.

The tool can be invoked with `cabal run cardano-cddl`.
This additionally bumps the Huddle version to
include a change to how choices are processed.
Needed to pull in the latest release of cuddle
- Rename conway-merged.cddl to conway.cddl
- Add a newline at the end of generated CDDL files
- Remove the use of ImportQualifiedPost
- Fix the search/replace failure with https://
- Format cabal files using cabal-format
Each era will now have its own executable for generating CDDL files.

A utility function (writeSpec) has been moved into
cardano-ledger-binary:testlib for this purpose.
- Bump c-l-b to 1.3.4.0
- Add changelog entries
- Add lower bound in cardano-ledger-binary to reflect the use of
writeSpec
@nc6 nc6 merged commit bca8e2b into master Jul 31, 2024
126 of 128 checks passed
@nc6 nc6 deleted the nc/4461 branch July 31, 2024 23:53
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.

Start using huddle for defining cddl
2 participants