Skip to content

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

Draft
Jimbo4350 wants to merge 3 commits into
masterfrom
jordan/remove-eon-query-printabledatum
Draft

Replace closed-range eon eliminators with forEraInEon in cardano-cli#1397
Jimbo4350 wants to merge 3 commits 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.

Two non-obvious details worth a reviewer's eye:

  • toTxOutValueInShelleyBasedEra: the old lower branch relied on the ShelleyToAllegraEra witness to refine L.Value (ShelleyLedgerEra era) ~ Coin. forEraInEon's negative branch has no such evidence, so TxOutValueShelleyBased sbe l no longer typechecks — replaced with lovelaceToTxOutValue sbe l, which injects the coin under shelleyBasedEraConstraints.
  • toTxOutValueInShelleyBasedEra positive branch: the case… eliminator brought its handler's constraints into scope automatically; forEraInEon does not, so the MaryEraOnwards body now needs an explicit maryEraOnwardsConstraints w $ ….

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/

…atch in utxoToText

Renders the inline datum in query UTxO output by matching on ShelleyBasedEra
directly instead of routing through the caseShelleyToAlonzoOrBabbageEraOnwards
eon eliminator. Behaviour is unchanged (Babbage-onwards show the ledger datum,
earlier eras show an empty placeholder). Part of removing eon witnesses from
cardano-cli in favour of ShelleyBasedEra / experimental Era.
@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
…InEon

Rewrites the four cardano-cli call sites of the closed-range eon eliminators
(caseShelleyToAllegraOrMaryEraOnwards, caseShelleyToAlonzoOrBabbageEraOnwards,
caseShelleyToMaryOrAlonzoEraOnwards) to use forEraInEon on the CardanoEra,
keyed on the surviving *EraOnwards eon. Behaviour is unchanged. Removes the
last cardano-cli uses of ShelleyToAllegraEra, ShelleyToAlonzoEra and
ShelleyToMaryEra, unblocking their removal from cardano-api.
@Jimbo4350
Jimbo4350 force-pushed the jordan/remove-eon-query-printabledatum branch from 7b8d3e5 to c40539c Compare July 20, 2026 19:51
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.

1 participant