-
Notifications
You must be signed in to change notification settings - Fork 167
CDDL with typeclasses: mary, alonzo, babbage #5443
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
base: master
Are you sure you want to change the base?
Conversation
* Export `Era` from `Cardano.Ledger.Huddle` so that later eras do not need to depend on core directly; they can just import the previous era. * Add smart-constructors for scripts-related rules and reorganise them.
Repeat the same additions as core and shelley for mary. Update changelogs for shelley and allegra to mention `generate-cddl`.
Repeat the same additions as core, shelley, allegra and mary.
ae10611 to
3920e01
Compare
Repeat the same additions as core, shelley, allegra, mary and alonzo.
3920e01 to
3e363b1
Compare
lehins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very, very nice!
I really like how this new approach to using Huddle is coming along.
| instance HuddleRule "major_protocol_version" MaryEra where | ||
| huddleRule _ = "major_protocol_version" =:= (0 :: Integer) ... (5 :: Integer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be safe to create an instance for all eras like this in cardano-ledger-core, but please confirm that it is indeed the case. If it is not, then we'll need to figure out later how to make it be the case, since that should always be true for all eras, otherwise it would be impossible to transition out of the era.
| instance HuddleRule "major_protocol_version" MaryEra where | |
| huddleRule _ = "major_protocol_version" =:= (0 :: Integer) ... (5 :: Integer) | |
| instance Era era => HuddleRule "major_protocol_version" era where | |
| huddleRule _ = "major_protocol_version" =:= (0 :: Integer) ... lastSupportedEraVersion | |
| where | |
| lastSupportedEraVersion = | |
| getVersion $ errorFail (succVersion (eraProtVerHigh @era)) :: Integer) |
| , transaction_witness_sets : [* transaction_witness_set] | ||
| , auxiliary_data_set : {* transaction_index => auxiliary_data} | ||
| , invalid_transactions : [* transaction_index] | ||
| , invalid_transactions : [* transaction_index] ; new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't new in Babbage era
| , "block_body_size" ==> VUInt //- "merkle triple root" | ||
| , "block_body_hash" ==> huddleRule @"hash32" p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that comment was intended for the block body hash, instead of size
| , "block_body_size" ==> VUInt //- "merkle triple root" | |
| , "block_body_hash" ==> huddleRule @"hash32" p | |
| , "block_body_size" ==> VUInt | |
| , "block_body_hash" ==> huddleRule @"hash32" p //- "merkle triple root" |
Description
New libraries named
cddlfor Mary through Babbage to implement typeclass-based cuddle definitions to generate .cddl files from.Follow-up PRs should implement for Conway.
This is the second phase in our efforts to address #5194
NOTE
codegen on CI is expected to FAIL, and its diff is important to know exactly what has changed in the new implementation.
Checklist
Tests added or updated when needed.CHANGELOG.mdfiles updated for packages with externally visible changes.NOTE: New section is never added with the code changes. (See RELEASING.md).
Versions updated in.cabalandCHANGELOG.mdfiles when necessary, according to theversioning process.
Version bounds in.cabalfiles updated when necessary.NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
scripts/fourmolize.sh).scripts/cabal-format.sh).scripts/gen-cddl.sh)hie.yamlupdated (usescripts/gen-hie.sh).