Complete the era eons for Dijkstra - #1298
Conversation
a1bfe46 to
cb50408
Compare
There was a problem hiding this comment.
Pull request overview
This PR completes the “era eon” coverage for DijkstraEra across cardano-api so that era-dispatching code paths no longer hit TODO stubs, and updates transaction-building behavior to reflect ledger changes in Dijkstra (required signer hashes replaced by guards). It also updates constraint bundles to reflect that Dijkstra no longer supports ShelleyEraTxCert / TxCert ~ ConwayTxCert, and includes a changelog fragment marking the change as breaking.
Changes:
- Implement Dijkstra branches in era-dispatch helpers and eon instances (so Dijkstra participates wherever era dispatch happens, while still not being added to bounded era enumeration).
- Adjust tx-body handling for extra key witnesses in Dijkstra by translating them into key-hash guards; stub the required-signer-hashes lens for Dijkstra like the ledger does.
- Update eon constraint bundles to drop
ShelleyEraTxCert/TxCert ~ ConwayTxCertwhere Dijkstra cannot satisfy them; add a.changes/fragment marking this asbreaking.
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 |
|---|---|
| cardano-api/src/Cardano/Api/Tx/Internal/Output.hs | Add Dijkstra support to TxOut conversion to/from ledger types. |
| cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs | Stub required-signer-hashes lens for Dijkstra; use common constraints for Conway/Dijkstra governance-related lenses. |
| cardano-api/src/Cardano/Api/Tx/Internal/Body.hs | Translate TxExtraKeyWitnesses into Dijkstra tx-body guards instead of required signer hashes. |
| cardano-api/src/Cardano/Api/LedgerState.hs | Add Dijkstra branch for nonce/entropy selection in leadership-slot calculation. |
| cardano-api/src/Cardano/Api/Internal/Orphans/Serialisation.hs | Add ToJSON instance for Dijkstra ledger predicate failures. |
| cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Compatible.hs | Tighten certificate helper constraints (but still contains a Dijkstra-era TODO stub). |
| cardano-api/src/Cardano/Api/Experimental/Era.hs | Add Dijkstra handling to experimental-era eon dispatch. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs | Enable Dijkstra in Shelley-based eon witness equality and constraints dispatch; remove ShelleyEraTxCert from the shared bundle. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/MaryEraOnwards.hs | Enable Dijkstra in Mary-era onwards eon and relax constraints to exclude ShelleyEraTxCert. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ConwayEraOnwards.hs | Enable Dijkstra in Conway-era onwards eon and remove ShelleyEraTxCert / TxCert ~ ConwayTxCert constraints. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/BabbageEraOnwards.hs | Enable Dijkstra in Babbage-era onwards eon and adjust cert constraints to use EraTxCert. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/AlonzoEraOnwards.hs | Add IsAlonzoBasedEra DijkstraEra instance. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/AllegraEraOnwards.hs | Enable Dijkstra in Allegra-era onwards eon and adjust cert constraints to use EraTxCert. |
| cardano-api/src/Cardano/Api/Era/Internal/Core.hs | Add TestEquality support for DijkstraEra. |
| cardano-api/src/Cardano/Api/Era/Internal/Case.hs | Route Dijkstra through existing era-case helpers and add a new case helper name. |
| cardano-api/src/Cardano/Api/Era.hs | Re-export the new era-case helper. |
| .changes/20260818_120100_cardano-api_palas_dijkstra_eon_completion.yml | Changelog fragment documenting feature + breaking constraint-bundle change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dc66805 to
7dcad4d
Compare
There was a problem hiding this comment.
We need a new eons ending at Conway for that, because there are breaking changes in Dijkstra. But I guess @Jimbo4350 would not like that.
| , L.EraGov (ShelleyLedgerEra era) | ||
| , L.ShelleyEraTxCert (ShelleyLedgerEra era) | ||
| , FromCBOR (Consensus.ChainDepState (ConsensusProtocol era)) | ||
| , -- L.ShelleyEraTxCert dropped: gated by AtMostEra "Conway" in the ledger, so |
There was a problem hiding this comment.
I'm not seeing a Dijkstra ShelleyEraTxCert instance in cardano-ledger. Where are you getting the "gated by AtMostEra "Conway" in the ledger" from? Have you asked the ledger about the implementation of this instance?
There was a problem hiding this comment.
I haven't asked, but it is here: https://cardano-ledger.cardano.intersectmbo.org/cardano-ledger-shelley/Cardano-Ledger-Shelley-TxCert.html#t:ShelleyEraTxCert
Documentation also says: All of the Shelley related certificate functionality that has been fully deprecated in Dijkstra.
Mostly interpolation of the previous eras: every eon dictionary and case eliminator gets its Dijkstra arm (the Allegra/Mary/Babbage/Conway-onwards dictionaries return `id`), plus the `IsAllegra/Mary/Alonzo/BabbageBasedEra` instances, `TestEquality` on `CardanoEra`, the experimental `Era`'s `Eon` instance, the `ToJSON` `DijkstraLedgerPredFailure` instance the `ShelleyBasedEra` bundle needs, the Dijkstra arms in the `TxOut` conversions and tx-body lenses that the relaxation below makes reachable, and a Dijkstra arm mirroring Conway in `makeStakeAddressDelegationCertificate`. Two real changes. First, the ledger gates Shelley-style certificates to `AtMostEra "Conway"`, so the eon constraint bundles no longer provide `ShelleyEraTxCert` or `TxCert ~ ConwayTxCert` (breaking); call sites that need them now require them explicitly. Second, Dijkstra replaced required signer hashes with guards, so `reqSignerHashesTxBodyL` has no working Dijkstra arm (mirroring the ledger's own gate) and `createTransactionBody` instead translates `TxExtraKeyWitnesses` into appended key-hash guards. Simple scripts stay unsupported in Dijkstra: they need the era's new guard construct in `SimpleScript` first. That also keeps `txOutParseJson` unsupported, since Dijkstra tx outs can carry reference scripts of the new native-script type. Co-Authored-By: Sebastian Nagel <sebastian.nagel@ncoding.at> Co-Authored-By: kderme <k.dermenz@gmail.com> Co-Authored-By: Konstantinos Lambrou-Latreille <konstantinos.lambrou@iohk.io> Co-Authored-By: John Lotoski <john.lotoski@iohk.io> Co-Authored-By: Mateusz Galazyn <mateusz.galazyn@iohk.io>
7dcad4d to
d8ba5e9
Compare
Drop the four constraint comments, deprecate cardano-api's reqSignerHashesTxBodyL in favour of the ledger's lens and getter (the old-API construction site now uses the ledger lens per era), pattern match explicitly instead of using a wildcard in createTransactionBody's required-signers case, and fix the Enum (Some Era) roundtrip (toEnum 1 = Some DijkstraEra) while keeping maxBound at Conway.
Every wrapper that just re-dresses a ledger lens is deprecated in favour of the ledger's own, and createTransactionBody now uses the ledger lenses directly. Cardano.Api.Ledger gains the re-exports the migration needs: the era tx-body classes, the affected lenses, valueTxOutL and coinTxOutL. Kept undeprecated: the validity-interval compatibility lenses, adaAssetL and multiAssetL, which have no ledger equivalent (and adaAssetL is still used by cardano-testnet).
| in monoidForEraInEonA era $ \w -> case w of | ||
| -- Dijkstra replaced required signer hashes with guards, and a key-hash | ||
| -- guard makes the ledger demand that key's signature: translate, appending | ||
| -- so any other guards stay intact. | ||
| AlonzoEraOnwardsDijkstra -> | ||
| pure . Endo $ | ||
| A.txBodyL . L.guardsTxBodyL | ||
| %~ (<> OSet.fromSet (Set.map Shelley.KeyHashObj keyWits)) | ||
| AlonzoEraOnwardsAlonzo -> | ||
| pure $ Endo $ A.txBodyL . L.reqSignerHashesTxBodyL .~ keyWits | ||
| AlonzoEraOnwardsBabbage -> | ||
| pure $ Endo $ A.txBodyL . L.reqSignerHashesTxBodyL .~ keyWits | ||
| AlonzoEraOnwardsConway -> | ||
| pure $ Endo $ A.txBodyL . L.reqSignerHashesTxBodyL .~ keyWits |
After the lens migration, mScriptIntegrityHash's only type-fixing use sits under alonzoEraOnwardsConstraints, and older GHCs refuse to unify the outer type variable there (it is untouchable under the constraint implication); GHC 9.12+ solves it anyway. Pin the type at the binder instead.
Context
Make
DijkstraEraa first-class era incardano-api: everywhere the API dispatches on eras, Dijkstra now takes a real branch instead of hitting a TODO stub.This is groundwork: it adds no Dijkstra-specific features, it makes them possible to build. Dijkstra stays hidden from era enumeration (maxBound is still Conway); exposing it there comes in a later PR.
One known gap is left on purpose: simple scripts remain unsupported in Dijkstra: they need the era's new guard construct in
SimpleScriptfirst, which deserves its own design discussion.How to trust this PR
Almost all of this is interpolation of the previous eras. Two exceptions:
ShelleyEraTxCert/TxCert ~ ConwayTxCert(Dijkstra dropped those certificates), so a few call sites now require them explicitly. This is the breaking part.createTransactionBodytranslatesTxExtraKeyWitnessesinto key-hash guards (Body.hs,Body/Lens.hs).Checklist
.changes/