Skip to content

Enable Dijkstra Twiddling tests, relax some decoders in PV12 - #5862

Merged
Soupstraw merged 1 commit into
masterfrom
jj/dijkstra-twiddling
Aug 13, 2026
Merged

Enable Dijkstra Twiddling tests, relax some decoders in PV12#5862
Soupstraw merged 1 commit into
masterfrom
jj/dijkstra-twiddling

Conversation

@Soupstraw

@Soupstraw Soupstraw commented May 27, 2026

Copy link
Copy Markdown
Contributor

Description

This PR enables twiddle testing in Dijkstra and fixes some decoders to accept indefinite encodings starting with protocol version 12.

Resolves #5513

Checklist

  • Commits in meaningful sequence and with useful messages.
  • Tests added or updated when needed.
  • CHANGELOG.md files updated for packages with externally visible changes.
    NOTE: New section is never added with the code changes. (See RELEASING.md).
  • Versions updated in .cabal and CHANGELOG.md files when necessary, according to the
    versioning process.
  • Version bounds in .cabal files updated when necessary.
    NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
  • Code formatted (use scripts/fourmolize.sh).
  • Cabal files formatted (use scripts/cabal-format.sh).
  • CDDL files are up to date (use scripts/gen-cddl.sh)
  • hie.yaml updated (use scripts/gen-hie.sh).
  • Self-reviewed the diff.

@Soupstraw Soupstraw changed the title Jj/dijkstra twiddling Enable Dijkstra Twiddling tests, relax some decoders in PV12 May 28, 2026
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch 2 times, most recently from 99a8140 to 13391db Compare May 28, 2026 11:26
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/DecCBOR.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/DecCBOR.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/DecCBOR.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Decoder.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Decoder.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Decoder.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Decoder.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Decoder.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Decoder.hs Outdated
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Decoder.hs Outdated
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch 12 times, most recently from 5b706a6 to 4d865f8 Compare May 29, 2026 12:29
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch from 13dde78 to 1093b1c Compare June 16, 2026 12:12
neilmayhew
neilmayhew previously approved these changes Jun 17, 2026
Comment thread libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Crypto.hs Outdated
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch 2 times, most recently from 9edcad0 to 5ada1eb Compare June 17, 2026 13:53
@neilmayhew
neilmayhew dismissed their stale review June 17, 2026 14:24

I intended to comment, not approve

@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch 3 times, most recently from 1fccce3 to a119896 Compare July 8, 2026 14:11
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch from a119896 to 68510d1 Compare July 10, 2026 13:08
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch 5 times, most recently from a2f3f87 to 9b0cd64 Compare August 3, 2026 15:15
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch 5 times, most recently from a8f1c09 to ec954a7 Compare August 4, 2026 10:58
@Soupstraw
Soupstraw marked this pull request as ready for review August 4, 2026 10:59
@Soupstraw
Soupstraw requested a review from a team as a code owner August 4, 2026 10:59
@Soupstraw
Soupstraw requested review from lehins and a lite review from Copilot August 4, 2026 10:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates CBOR decoding behavior for protocol version 12 (PV12) by adding helpers for indefinite-length encodings, relaxing some DecCBOR instances to accept indefinite-length forms, and tightening metadata bytes decoding to require definite-length chunks within indefinite-length bytestrings. It also enables Dijkstra “twiddling” in the era CDDL/Huddle tests and bumps cardano-ledger-binary to 1.10.0.0 with corresponding dependency-bound updates.

Changes:

  • Add/adjust CBOR decoders in cardano-ledger-binary (incl. new indefinite-length helpers, relaxed Text and tuple decoding for PV12, and moving IPv4/IPv6 decoders into DecCBOR).
  • Update decodeMetadatum to enforce definite-length chunks inside indefinite-length bytestrings (and bump cardano-ledger-core’s cardano-ledger-binary bound accordingly).
  • Enable twiddling in Dijkstra CDDL tests and update cabal dependencies/bounds across affected packages.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libs/cardano-ledger-repl-environment/cardano-ledger-repl-environment.cabal Add testlib sublibrary deps for Alonzo/Dijkstra to support REPL environment usage.
libs/cardano-ledger-core/src/Cardano/Ledger/Metadata.hs Tighten metadata decoding for indefinite-length bytestrings via new bytearray indefinite helper.
libs/cardano-ledger-core/CHANGELOG.md Document the decodeMetadatum behavior change.
libs/cardano-ledger-core/cardano-ledger-core.cabal Bump cardano-ledger-binary bound to ^>=1.10.
libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Decoder.hs Add reusable *IndefLen / *DefOrIndef helpers; remove IPv4/IPv6 from this module.
libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/DecCBOR.hs Host IPv4/IPv6 decoders; relax tuple and Text DecCBOR instances for PV12.
libs/cardano-ledger-binary/CHANGELOG.md Record new API/behavior changes and module move for IP decoders.
libs/cardano-ledger-binary/cardano-ledger-binary.cabal Bump package version to 1.10.0.0.
eras/shelley/impl/cardano-ledger-shelley.cabal Update cardano-ledger-binary bound to ^>=1.10.
eras/dijkstra/impl/test/Test/Cardano/Ledger/Dijkstra/Binary/CddlSpec.hs Enable twiddling by removing noTwiddle.
eras/dijkstra/impl/cardano-ledger-dijkstra.cabal Update cardano-ledger-binary bound to ^>=1.10.
eras/conway/impl/cardano-ledger-conway.cabal Update cardano-ledger-binary bound to ^>=1.10.
eras/alonzo/impl/cardano-ledger-alonzo.cabal Update cardano-ledger-binary bound to ^>=1.10.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/cardano-ledger-core/src/Cardano/Ledger/Metadata.hs Outdated
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch from ec954a7 to 416151f Compare August 4, 2026 11:10
@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch 8 times, most recently from 1180d74 to b600acb Compare August 13, 2026 10:59

@aniketd aniketd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work! 🙌

@github-actions

Copy link
Copy Markdown

Test Failures

cardano-ledger-dijkstra:test:tests

Test Compiler Seed
/Dijkstra/Era-specific spec/CDDL/Huddle/CertRB/block_body: DijkstraBlockBody DijkstraEra/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/CertRB/block_body: DijkstraBlockBody DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/Generate bytestring from CDDL and decode -> encode/header: MemoBytes (HeaderRaw StandardCrypto)/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/Generate bytestring from CDDL and decode -> encode/header_body: HeaderBody StandardCrypto/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/TxsRB/block_body: DijkstraBlockBody DijkstraEra/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/TxsRB/block_body: DijkstraBlockBody DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/account_balance_intervals: Map AccountId (AccountBalanceInterval DijkstraEra)/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/auxiliary_data: MemoBytes (AlonzoTxAuxDataRaw DijkstraEra)/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/auxiliary_data: MemoBytes (AlonzoTxAuxDataRaw DijkstraEra)/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/certificate: DijkstraTxCert DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/certificates: OSet (DijkstraTxCert DijkstraEra)/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/datum_option: Datum DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/eb_announcement: EbAnnouncement/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/gov_action: GovAction DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/header: Annotator (MemoBytes (HeaderRaw StandardCrypto))/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/native_script: DijkstraNativeScript DijkstraEra/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/native_script: DijkstraNativeScript DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/proposal_procedure: ProposalProcedure DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/proposal_procedures: OSet (ProposalProcedure DijkstraEra)/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/script: AlonzoScript DijkstraEra/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/script: AlonzoScript DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/sub_transaction_body: MemoBytes (DijkstraTxBodyRaw SubTx DijkstraEra)/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/sub_transaction_body: MemoBytes (DijkstraTxBodyRaw SubTx DijkstraEra)/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/transaction: DijkstraTx TopTx DijkstraEra/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/transaction: DijkstraTx TopTx DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/transaction_body: MemoBytes (DijkstraTxBodyRaw TopTx DijkstraEra)/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/transaction_body: MemoBytes (DijkstraTxBodyRaw TopTx DijkstraEra)/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/transaction_output: BabbageTxOut DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/transaction_witness_set: MemoBytes (AlonzoTxWitsRaw DijkstraEra)/Generate bytestring from CDDL and decode (annotator) -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/transaction_witness_set: MemoBytes (AlonzoTxWitsRaw DijkstraEra)/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/value: MaryValue/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/voting_procedure: VotingProcedure DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239
/Dijkstra/Era-specific spec/CDDL/Huddle/voting_procedures: VotingProcedures DijkstraEra/Generate bytestring from CDDL and decode -> encode/ 9.6.7 1601918239

@Soupstraw
Soupstraw force-pushed the jj/dijkstra-twiddling branch from b600acb to 46a6280 Compare August 13, 2026 14:25
@Soupstraw
Soupstraw enabled auto-merge August 13, 2026 14:25
@Soupstraw
Soupstraw merged commit e5d1d1c into master Aug 13, 2026
52 checks passed
@Soupstraw
Soupstraw deleted the jj/dijkstra-twiddling branch August 13, 2026 16:38
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.

Indefinite length decoding support for Bytes

5 participants