cardano-ledger icon indicating copy to clipboard operation
cardano-ledger copied to clipboard

Address issues in auto-generated CDDL specification

Open nc6 opened this issue 1 year ago • 1 comments

Description

This addresses issue https://github.com/IntersectMBO/cardano-ledger/issues/4462

  • Moves some core type CDDL definitions to cardano-ledger-core
  • Defines Shelley CDDL types through Huddle
  • Adds huddle-based testing in Shelley
  • Moves the Shelley CDDL to being auto-generated via the Huddle def
  • Updates Conway to use some definitions from Shelley where they were unchanged
  • Updates the gen-cddl.sh script to check Shelley definitions

One unexpected change: the huddle definition for protocol_param_updates has a size limit on the max block header size. This is consistent with the Haskell serialisers and data structure.

In addition, we add a couple of extra commits solving two issues:

  • #4522 - we reintroduce the long explanations of various types which were subsequently not included in the generated CDDL.
  • #4535 - we add a root element as the first element in the generated CDDL

Note that this PR now incorporates the contents of #4552

Checklist

  • [x] Commit sequence broadly makes sense and commits have useful messages
  • [ ] New tests are added if needed and existing tests are updated
  • [ ] 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)
  • [ ] When applicable, versions are updated in .cabal and CHANGELOG.md files according to the versioning process.
  • [x] 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)
  • [x] Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • [x] Cabal files are formatted (use scripts/cabal-format.sh)
  • [x] hie.yaml has been updated (use scripts/gen-hie.sh)
  • [x] Self-reviewed the diff

nc6 avatar Aug 16 '24 11:08 nc6

Note that this is now out-of-date with #4552 - I'll update after that one is merged.

nc6 avatar Aug 19 '24 10:08 nc6

In addition to documentation comments, is it possible to regroup definitions please. For example, currently the conway certificates definitions are all over the place. It seems they are sorted alphabetically, which isn’t useful.

mpizenberg avatar Sep 07 '24 12:09 mpizenberg

Rebased on master, to remove the master-merge commit

teodanciu avatar Sep 23 '24 19:09 teodanciu