Render Dijkstra certificates in the friendly JSON view - #1430
Conversation
| [ "Drep credential" .= drepCredential | ||
| , "anchor " .= mbAnchor | ||
| ] | ||
| _ -> "unsupported certificate" .= String (T.pack $ show cert) |
There was a problem hiding this comment.
what's hidden in _? Shouldn't that be an error? at least a non-zero error code. This applies to conway as well.
I don't remember why COMPLETE pragma doesn't work here.
There was a problem hiding this comment.
There is a COMPLETE pragma here: https://github.com/IntersectMBO/cardano-ledger/blob/f3104f00f9819ba94de119c38bc3e0109982821f/eras/conway/impl/src/Cardano/Ledger/Conway/TxCert.hs#L358-L371
In the first place, it doesn't work because it is done over DijkstraEra instead of DijkstraTxCert, but that also doesn't seem to work, may be a compiler issue.
So the only way to get it to work would be to recursively pattern match on DijkstraTxCert, but we are not supposed to do that, and is not wat we did for Conway.
And about it being an error instead: I think it is best to just print it uglily than failing if for some reason we miss a certificate
There was a problem hiding this comment.
Pull request overview
This PR extends the transaction view friendly JSON renderer to support Dijkstra-era certificates by adding a Dijkstra-specific certificate renderer and wiring it into the era dispatch, eliminating the previous internal TODO error. It also simplifies simple-script JSON decoding for Conway/Dijkstra and adds a changelog fragment documenting the new behavior.
Changes:
- Add
renderDijkstraCertificateand use it inrenderCertificatefor Dijkstra era. - Refactor simple-script JSON decoding path to share logic between Conway and Dijkstra (upgrading timelocks for Dijkstra).
- Add a
.changes/entry describing the feature.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cardano-cli/src/Cardano/CLI/EraBased/Script/Read/Common.hs | Refactors JSON simple-script decoding to share logic between Conway and Dijkstra (with Dijkstra upgrade). |
| cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs | Implements and hooks up Dijkstra-era certificate rendering for friendly JSON output. |
| .changes/20260827_155708_cardano-cli_palas_dijkstra_friendly_certs.yml | Documents the new Dijkstra certificate rendering behavior in the changelog system. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The friendly renderer hit an error stub for every Dijkstra-era certificate; add renderDijkstraCertificate, the Conway renderer minus the certificate forms the era drops. Co-Authored-By: Konstantinos Lambrou-Latreille <konstantinos.lambrou@iohk.io> Co-Authored-By: Sebastian Nagel <sebastian.nagel@ncoding.at>
ada125a to
94a0866
Compare
The UpdateDRepTxCert arm of renderDijkstraCertificate emitted a JSON field literally named "anchor " (trailing space), unlike every other arm. The Conway renderer it was copied from has the same quirk; that one is left untouched here because changing it affects released output.
Context
The friendly JSON renderer (what
transaction viewprints) hit an error stub for every Dijkstra-era certificate.This PR adds
renderDijkstraCertificate: it is the Conway renderer minus the certificate forms the era drops (Dijkstra no longer has the Shelley-era certificate shapes), so every certificate the era supports renders, and stake pool registrations include their pool parameters.How to trust this PR
It is all straightforward to JSON conversion. The only doubt is whether we are covering all the right certificates (since there is a catch-all that prints
"unsupported certificate". But it can be checked that they match the ones at: https://cardano-ledger.cardano.intersectmbo.org/cardano-ledger-dijkstra/Cardano-Ledger-Dijkstra-TxCert.html#t:DijkstraTxCertChecklist
.changes/