Skip to content

Stop using Summands from Coders for PV12+#5860

Open
aniketd wants to merge 7 commits into
masterfrom
aniketd/coders
Open

Stop using Summands from Coders for PV12+#5860
aniketd wants to merge 7 commits into
masterfrom
aniketd/coders

Conversation

@aniketd
Copy link
Copy Markdown
Contributor

@aniketd aniketd commented May 24, 2026

Description

This is the final part to complete the addressal of #5718

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.

@aniketd aniketd requested review from lehins and teodanciu May 24, 2026 17:49
@aniketd aniketd requested a review from a team as a code owner May 24, 2026 17:49
@aniketd aniketd changed the title Aniketd/coders Stop using Summands from Coders for PV12+ May 24, 2026
@aniketd aniketd force-pushed the aniketd/coders-safe branch from 7026d37 to d66d954 Compare May 25, 2026 13:59
@aniketd aniketd force-pushed the aniketd/coders-safe branch from d66d954 to ecaf94a Compare May 26, 2026 13:26
@aniketd aniketd force-pushed the aniketd/coders-safe branch from ecaf94a to a9c2f7e Compare May 27, 2026 08:23
Base automatically changed from aniketd/coders-safe to master May 27, 2026 11:17
@aniketd aniketd requested a review from Soupstraw May 28, 2026 13:46
Comment thread eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxWits.hs
Copy link
Copy Markdown

Copilot AI left a comment

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 completes the PV12+ migration away from Coders-based Summands/SparseKeyed decoding for on-chain types (per #5718), switching to the newer plain decoder helpers while preserving pre-PV12 decoding via ifDecoderVersionAtLeast.

Changes:

  • Introduce PV12+ decoders using decodeRecordSum, decodeRecordNamed, and decodeSparseKeyed, while keeping legacy Coders decoding for earlier protocol versions.
  • Update multiple core/conway/alonzo/dijkstra decoding paths to use version-gated decoding behavior.
  • Adjust testlib modules and cabal dependencies (add cardano-base) to support TypeName in decodeSparseKeyed.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libs/cardano-ledger-core/src/Cardano/Ledger/Plutus/Data.hs Add PV12+ Datum decoder using decodeRecordSum behind ifDecoderVersionAtLeast.
libs/cardano-ledger-core/src/Cardano/Ledger/DRep.hs Add PV12+ DRep decoder via decodeRecordSum behind version gating.
libs/cardano-ledger-core/src/Cardano/Ledger/Credential.hs Add PV12+ Credential decoder via decodeRecordSum behind version gating.
libs/cardano-ledger-core/src/Cardano/Ledger/Core/PParams.hs Update PParamsUpdate field decoding to avoid field helper and use PV12+ decoders where applicable.
libs/cardano-ledger-core/src/Cardano/Ledger/BaseTypes.hs Add PV12+ Nonce decoding via decodeRecordSum behind version gating.
eras/dijkstra/impl/testlib/Test/Cardano/Ledger/Dijkstra/Binary/Annotator.hs Replace Coders SparseKeyed decoding with decodeSparseKeyed and explicit per-key decoders.
eras/dijkstra/impl/src/Cardano/Ledger/Dijkstra/Scripts.hs Replace Coders Summands decoding with decodeRecordSum for native scripts.
eras/dijkstra/impl/cardano-ledger-dijkstra.cabal Add cardano-base dependency for testlib (TypeName).
eras/conway/impl/src/Cardano/Ledger/Conway/TxCert.hs Add PV12+ Delegatee decoder via decodeRecordSum behind version gating.
eras/conway/impl/src/Cardano/Ledger/Conway/Governance/Procedures.hs Add PV12+ decoders for Committee and GovAction behind version gating.
eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Binary/Annotator.hs Add PV12+ record/sparse decoding paths for Alonzo tx/auxdata/wits/script decoding.
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxWits.hs Export alonzoPlutusScriptDecoder.
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxAuxData.hs Add PV12+ Shelley-token-type auxdata decoding path.
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Tx.hs Add PV12+ tx decoder using decodeRecordNamed and version gating.
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Scripts.hs Add PV12+ AlonzoScript decoder via decodeRecordSum behind version gating.
eras/alonzo/impl/CHANGELOG.md Document the new alonzoPlutusScriptDecoder export.
eras/alonzo/impl/cardano-ledger-alonzo.cabal Add cardano-base dependency for testlib (TypeName).

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

Comment on lines 50 to 55
encodeTag,
fromPlainDecoder,
fromPlainEncoding,
ifDecoderVersionAtLeast,
natVersion,
)
Comment on lines 102 to 116
import Cardano.Ledger.Binary (
Annotator,
DecCBOR (..),
Decoder,
EncCBOR (encCBOR),
Encoding,
ToCBOR (..),
decodeNullStrictMaybe,
encodeListLen,
encodeNullStrictMaybe,
ifDecoderVersionAtLeast,
natVersion,
serialize,
serialize',
)
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