Skip to content

Replace closed-range eon eliminators with forEraInEon in cardano-cli#1397

Open
Jimbo4350 wants to merge 1 commit into
masterfrom
jordan/remove-eon-query-printabledatum
Open

Replace closed-range eon eliminators with forEraInEon in cardano-cli#1397
Jimbo4350 wants to merge 1 commit into
masterfrom
jordan/remove-eon-query-printabledatum

Conversation

@Jimbo4350

@Jimbo4350 Jimbo4350 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Context

Part of removing eon witnesses from cardano-cli in favour of ShelleyBasedEra era / the experimental Era era.

This PR rewrites the four cardano-cli call sites of the closed-range eon eliminators to use forEraInEon on the CardanoEra, keyed on the surviving *EraOnwards eon:

site was now
Compatible/Transaction/TxOut.hs toTxOutValueInShelleyBasedEra caseShelleyToAllegraOrMaryEraOnwards forEraInEon (MaryEraOnwards)
EraBased/Query/Run.hs printableDatum caseShelleyToAlonzoOrBabbageEraOnwards forEraInEon (BabbageEraOnwards)
Compatible/Transaction/Option.hs pTxOutDatum caseShelleyToMaryOrAlonzoEraOnwards forEraInEon (AlonzoEraOnwards)
EraBased/Governance/Actions/Option.hs pCostModelsFile caseShelleyToMaryOrAlonzoEraOnwards forEraInEon (AlonzoEraOnwards)

This removes the last cardano-cli uses of ShelleyToAllegraEra, ShelleyToAlonzoEra and ShelleyToMaryEra, which unblocks deleting those (consumerless) eons from cardano-api.

How to trust this PR

Behaviour is unchanged at every site — forEraInEon's negative branch fires for exactly the same sub-cutoff eras the caseShelleyToXOr… lower branch did.

Verified with cabal build cardano-cli -j4 (lib, exe, and golden tests compile and link).

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Self-reviewed the diff
  • Changelog fragment added in .changes/

@Jimbo4350 Jimbo4350 changed the title Remove eon usage in utxoToText datum rendering (ShelleyBasedEra match) Replace closed-range eon eliminators with forEraInEon in cardano-cli Jul 20, 2026
@Jimbo4350
Jimbo4350 force-pushed the jordan/remove-eon-query-printabledatum branch from 7b8d3e5 to c40539c Compare July 20, 2026 19:51
@Jimbo4350
Jimbo4350 marked this pull request as ready for review July 23, 2026 16:58
@Jimbo4350
Jimbo4350 requested a review from newhoggy as a code owner July 23, 2026 16:58
Copilot AI review requested due to automatic review settings July 23, 2026 16:58

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 refactors cardano-cli to stop using the deprecated/consumerless closed-range eon eliminators and instead dispatch via forEraInEon on CardanoEra, keyed off the remaining *EraOnwards witnesses. This aligns with the broader effort to remove eon witnesses in favor of ShelleyBasedEra era / experimental Era era, and unblocks deletion of the now-unused ShelleyTo* eons from cardano-api.

Changes:

  • Replaced caseShelleyTo*Or*EraOnwards eliminator usage with forEraInEon across the four remaining call sites.
  • Updated the Shelley/Allegra “coin-only” branch in toTxOutValueInShelleyBasedEra to use lovelaceToTxOutValue (since forEraInEon’s negative branch doesn’t refine the ledger value type via the removed eon witness).
  • Added explicit constraint bring-into-scope where the old eliminators implicitly provided it (e.g., maryEraOnwardsConstraints).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cardano-cli/src/Cardano/CLI/EraBased/Query/Run.hs Switches datum rendering era-dispatch to forEraInEon with BabbageEraOnwards constraints.
cardano-cli/src/Cardano/CLI/EraBased/Governance/Actions/Option.hs Updates cost-models parser gating to use forEraInEon keyed by AlonzoEraOnwards.
cardano-cli/src/Cardano/CLI/Compatible/Transaction/TxOut.hs Refactors TxOut value era gating to forEraInEon, using lovelaceToTxOutValue in the pre-Mary branch and explicit maryEraOnwardsConstraints in the Mary+ branch.
cardano-cli/src/Cardano/CLI/Compatible/Transaction/Option.hs Refactors tx-out datum parsing era gating to forEraInEon keyed by AlonzoEraOnwards.
.changes/remove-closed-range-eon-eliminators.yml Adds changelog fragment documenting the refactor and motivation.

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

Jimbo4350 added a commit to IntersectMBO/cardano-api that referenced this pull request Jul 23, 2026
…eons

Rewrites the cardano-api call sites of caseShelleyToAllegraOrMaryEraOnwards,
caseShelleyToMaryOrAlonzoEraOnwards and caseShelleyToAlonzoOrBabbageEraOnwards
to forEraInEon on the CardanoEra, keyed on the surviving MaryEraOnwards,
AlonzoEraOnwards and BabbageEraOnwards eons, then deletes the three eliminators
and the now-consumerless ShelleyToAllegraEra, ShelleyToAlonzoEra and
ShelleyToMaryEra eons (their modules, Cardano.Api.Era re-exports and
cardano-api.cabal entries).

Behaviour is unchanged. Mirrors IntersectMBO/cardano-cli#1397, which removed the
last cardano-cli uses of these eons. ShelleyToBabbageEra and
caseShelleyToBabbageOrConwayEraOnwards are retained.

Two sites needed more than a mechanical swap:

- fromLedgerValue (Value/Internal): forEraInEon's negative branch cannot supply
  the L.Value ~ Coin evidence the ShelleyToAllegraEra lower branch provided, so
  the pre-Mary branch uses lovelaceToValue (L.coin v) (identity on Coin).
- LedgerState.extraEntropy: ppExtraEntropyL needs ProtVerAtMost 6, which
  forEraInEon cannot supply, so the pre-Babbage eras are matched on
  ShelleyBasedEra directly.
Replace the caseShelleyToAllegraOrMaryEraOnwards, caseShelleyToAlonzoOrBabbageEraOnwards and caseShelleyToMaryOrAlonzoEraOnwards eon eliminators with forEraInEon in transaction, query and governance option parsing. No behavioural change. This removes the last cardano-cli uses of the ShelleyToAllegraEra, ShelleyToAlonzoEra and ShelleyToMaryEra eons.
@Jimbo4350
Jimbo4350 force-pushed the jordan/remove-eon-query-printabledatum branch from c40539c to d376ca1 Compare July 23, 2026 20:07

@palas palas 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.

👍

@Jimbo4350
Jimbo4350 added this pull request to the merge queue Jul 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 24, 2026
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.

4 participants