Drop redundant ProtocolParametersUpdate conversion in shelleyToBabbage update#1373
Merged
Jimbo4350 merged 1 commit intoMay 13, 2026
Merged
Conversation
7fa5ac0 to
69c471d
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates cardano-cli to match cardano-api’s removal of ProtocolParametersUpdate, switching rendering and governance flows to the era-indexed replacement while keeping the existing “friendly” JSON/YAML output shape for protocol parameter updates.
Changes:
- Bump
cardano-apidependency and adjust code to use era-indexed protocol parameter update types. - Rewrite
friendlyProtocolParametersUpdateto render from ledgerPParamsUpdateproduced fromEraBasedProtocolParametersUpdate. - Add a golden test + fixtures to pin the YAML output shape for an Alonzo update proposal embedded in a transaction.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
flake.lock |
Updates pinned CHaP revision/hash to align with dependency changes. |
cabal.project |
Advances CHaP index-state to pick up the newer package set. |
cardano-cli/cardano-cli.cabal |
Bumps cardano-api bound and adds cardano-ledger-binary dependency for version rendering. |
cardano-cli/src/Cardano/CLI/Read.hs |
Adds shelleyToBabbageEraConstraints to satisfy new era-indexed UpdateProposal envelope constraints. |
cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs |
Refactors protocol-parameter-update rendering to dispatch by era and emit the legacy flat key set. |
cardano-cli/src/Cardano/CLI/Compatible/Governance/Run.hs |
Removes a redundant conversion round-trip when building Shelley-to-Babbage update proposals. |
cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs |
Adds a new golden test that generates and views an Alonzo tx with an update proposal and compares YAML output. |
cardano-cli/test/cardano-cli-golden/files/input/genesis1.vkey |
Adds a genesis verification key fixture used by the new golden test. |
cardano-cli/test/cardano-cli-golden/files/golden/alonzo/transaction-view-update-proposal.yaml |
Adds the expected YAML output for the new golden test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| protocolVersionPair ppu = | ||
| [ ( \(Ledger.ProtVer major minor) -> | ||
| "protocol version" .= (textShow (getVersion major :: Word) <> "." <> textShow minor) | ||
| ) |
0268b1d to
f029bcb
Compare
`makeShelleyUpdateProposal` (cardano-api ^>=11.1) accepts `EraBasedProtocolParametersUpdate era` directly. The existing code in `shelleyToBabbageProtocolParametersUpdate` constructed that value, converted it to the deprecated `ProtocolParametersUpdate` via `createEraBasedProtocolParamUpdate` / `fromLedgerPParamsUpdate`, and passed the result to `makeShelleyUpdateProposal` — an unnecessary round-trip through the old API. Drop the conversion; pass `eraBasedPParams` directly. No behaviour change.
f029bcb to
30a1ce9
Compare
carbolymer
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
Context
makeShelleyUpdateProposal(cardano-api ^>=11.1, already required on master) acceptsEraBasedProtocolParametersUpdate eradirectly. The existing code inshelleyToBabbageProtocolParametersUpdateconstructed that value, converted it to the deprecatedProtocolParametersUpdateviacreateEraBasedProtocolParamUpdate/fromLedgerPParamsUpdate, then passed the result tomakeShelleyUpdateProposal— an unnecessary round-trip through the old API.No behaviour change: the function still produces the same
UpdateProposal eratext envelope.How to trust this PR
cabal build cardano-cli -j4builds cleanly.Test.Cli.Compatible.Transaction.Buildexercisescompatible <era> governance action create-protocol-parameters-updatefor shelley/allegra/mary/alonzo/babbage and diffs each against a reference produced via the same code path — passing means the produced text envelope is byte-identical to before.Checklist