Skip to content

Remove the unused ByronToAlonzoEra eon and the closed-range Shelley eons - #1260

Open
Jimbo4350 wants to merge 2 commits into
masterfrom
jordan/remove-byrontoalonzoera-eon
Open

Remove the unused ByronToAlonzoEra eon and the closed-range Shelley eons#1260
Jimbo4350 wants to merge 2 commits into
masterfrom
jordan/remove-byrontoalonzoera-eon

Conversation

@Jimbo4350

@Jimbo4350 Jimbo4350 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Changelog

- description: |
    Remove the unused `ByronToAlonzoEra` eon, and remove the closed-range eons `ShelleyToAllegraEra`, `ShelleyToMaryEra` and `ShelleyToAlonzoEra` together with their eliminators `caseShelleyToAllegraOrMaryEraOnwards`, `caseShelleyToMaryOrAlonzoEraOnwards` and `caseShelleyToAlonzoOrBabbageEraOnwards`. The same era-gating is achieved with `forEraInEon`/`inEonForEra` on `toCardanoEra era`, keyed on the surviving `MaryEraOnwards`/`AlonzoEraOnwards`/`BabbageEraOnwards` eon.
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
   - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
   - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...
# uncomment at least one main project this PR is associated with
  projects:
   - cardano-api
  # - cardano-api-gen
  # - cardano-rpc
  # - cardano-wasm

Context

Sunsets the dead closed-range eons in cardano-api. Sister cleanup to the cardano-cli eon removal in IntersectMBO/cardano-cli#1397, which removed the last cardano-cli uses of these eons.

Two commits:

1. Remove the unused ByronToAlonzoEra eon

ByronToAlonzoEra (the Cardano.Api.Era.Internal.Eon.ByronToAlonzoEra module) had zero consumers anywhere — cardano-api, cardano-cli and cardano-node all referenced it only via the re-export. It had no case… eliminator either. Deletes the module, its cardano-api.cabal entry, and the Cardano.Api.Era import/re-export.

2. Replace closed-range eon eliminators with forEraInEon and remove the 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 (modules, Cardano.Api.Era re-exports, cardano-api.cabal entries).

ShelleyToBabbageEra and caseShelleyToBabbageOrConwayEraOnwards are retained — they still have consumers.

Behaviour is unchanged. Two sites needed more than a mechanical swap:

  • fromLedgerValue (Value/Internal)forEraInEon's negative branch cannot supply the L.Value ~ Coin evidence that the ShelleyToAllegraEra lower branch provided, so the pre-Mary branch uses lovelaceToValue (L.coin v) (identity on Coin).
  • LedgerState.extraEntropyppExtraEntropyL needs ProtVerAtMost 6, which forEraInEon cannot supply, so the pre-Babbage eras are matched on ShelleyBasedEra directly.

How to trust this PR

  • git grep -E 'ByronToAlonzoEra|ShelleyToAllegraEra|ShelleyToMaryEra|ShelleyToAlonzoEra|caseShelleyToAllegraOrMaryEraOnwards|caseShelleyToMaryOrAlonzoEraOnwards|caseShelleyToAlonzoOrBabbageEraOnwards' returns nothing after this change.
  • Every rewrite is a like-for-like translation: case<Lower>Or<Upper>EraOnwards l r sbe becomes forEraInEon (toCardanoEra sbe) <l applied to the lower branch> <r>, with the two exceptions called out above.
  • Verified with a clean cabal build cardano-api -j4 (library, gen, cardano-api-test and cardano-api-golden all compile).

Downstream consumers must switch to forEraInEon/inEonForEra on toCardanoEra era, hence type: breaking.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated — none needed; behaviour is unchanged and existing tests cover the rewritten call sites
  • No version bounds need updating; there are no dependency changes
  • Self-reviewed the diff
  • Changelog fragments added in .changes/

@Jimbo4350
Jimbo4350 force-pushed the jordan/remove-byrontoalonzoera-eon branch from 247c755 to 226cd76 Compare July 20, 2026 20:16
@Jimbo4350
Jimbo4350 marked this pull request as ready for review July 20, 2026 20:16
Copilot AI review requested due to automatic review settings July 20, 2026 20:16
@Jimbo4350
Jimbo4350 marked this pull request as draft July 20, 2026 20:18

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 is intended to remove the unused ByronToAlonzoEra closed-range eon from the cardano-api public surface (via Cardano.Api.Era) and from the library build plan.

Changes:

  • Deletes the Cardano.Api.Era.Internal.Eon.ByronToAlonzoEra module and removes its Cardano.Api.Era re-export/import.
  • Updates cardano-api.cabal to stop listing ByronToAlonzoEra in other-modules.
  • Adds a breaking-change changelog fragment in .changes/.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToMaryEra.hs Deleted module (note: currently conflicts with PR description and leaves dangling references elsewhere).
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToAlonzoEra.hs Deleted module (note: currently conflicts with PR description and leaves dangling references elsewhere).
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToAllegraEra.hs Deleted module (note: currently conflicts with PR description and leaves dangling references elsewhere).
cardano-api/src/Cardano/Api/Era/Internal/Eon/ByronToAlonzoEra.hs Deletes the intended unused eon module.
cardano-api/src/Cardano/Api/Era.hs Removes the ByronToAlonzoEra re-export/import, but still references deleted ShelleyTo* eons.
cardano-api/cardano-api.cabal Removes ByronToAlonzoEra from other-modules, but still lists deleted ShelleyTo* eons.
.changes/20260720_remove_byrontoalonzoera_eon.yml Marks the change as breaking, but description no longer matches the effective diff scope.
Comments suppressed due to low confidence (1)

cardano-api/src/Cardano/Api/Era.hs:22

  • This module still re-exports ShelleyToAllegraEra, ShelleyToAlonzoEra, and ShelleyToMaryEra, but those modules do not exist under cardano-api/src/Cardano/Api/Era/Internal/Eon/ in this PR (only ShelleyToBabbageEra is present). This will fail to compile with “Could not find module …”. Either restore the removed eon modules, or remove these re-exports and update any dependent API (e.g. the caseShelleyTo* helpers) accordingly.
  , module Cardano.Api.Era.Internal.Eon.ShelleyToAllegraEra
  , module Cardano.Api.Era.Internal.Eon.ShelleyToAlonzoEra
  , module Cardano.Api.Era.Internal.Eon.ShelleyToBabbageEra
  , module Cardano.Api.Era.Internal.Eon.ShelleyToMaryEra

Comment on lines 80 to 85
import Cardano.Api.Era.Internal.Eon.AllegraEraOnwards
import Cardano.Api.Era.Internal.Eon.AlonzoEraOnwards
import Cardano.Api.Era.Internal.Eon.BabbageEraOnwards
import Cardano.Api.Era.Internal.Eon.ByronToAlonzoEra
import Cardano.Api.Era.Internal.Eon.Convert
import Cardano.Api.Era.Internal.Eon.ConwayEraOnwards
import Cardano.Api.Era.Internal.Eon.MaryEraOnwards
Comment on lines 217 to 222
Cardano.Api.Era.Internal.Eon.AllegraEraOnwards
Cardano.Api.Era.Internal.Eon.AlonzoEraOnwards
Cardano.Api.Era.Internal.Eon.BabbageEraOnwards
Cardano.Api.Era.Internal.Eon.ByronToAlonzoEra
Cardano.Api.Era.Internal.Eon.Convert
Cardano.Api.Era.Internal.Eon.ConwayEraOnwards
Cardano.Api.Era.Internal.Eon.MaryEraOnwards
pr: 1260
kind:
- breaking
description: Remove the unused `ByronToAlonzoEra` eon (the `Cardano.Api.Era.Internal.Eon.ByronToAlonzoEra` module and its `Cardano.Api.Era` re-export); it had no consumers.
@Jimbo4350
Jimbo4350 force-pushed the jordan/remove-byrontoalonzoera-eon branch from 226cd76 to 846c74c Compare July 23, 2026 17:58
Deletes the Cardano.Api.Era.Internal.Eon.ByronToAlonzoEra module together with
its cardano-api.cabal entry and Cardano.Api.Era re-export. The ByronToAlonzoEra
eon has no consumers anywhere (cardano-api, cardano-cli or cardano-node), so
this is a pure removal of dead public API.
…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.
@Jimbo4350
Jimbo4350 force-pushed the jordan/remove-byrontoalonzoera-eon branch from 846c74c to 1dc1616 Compare July 30, 2026 17:00
@Jimbo4350 Jimbo4350 changed the title Remove the unused ByronToAlonzoEra eon Remove the unused ByronToAlonzoEra eon and the closed-range Shelley eons Jul 30, 2026
@Jimbo4350
Jimbo4350 marked this pull request as ready for review July 30, 2026 17:00
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.

2 participants