From 94a0866e94558ef7064480485685a0800ed2a81e Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Wed, 26 Aug 2026 12:38:45 +0000 Subject: [PATCH 1/2] Render Dijkstra certificates in the friendly JSON view 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 Co-Authored-By: Sebastian Nagel --- ...dano-cli_palas_dijkstra_friendly_certs.yml | 6 ++ .../Cardano/CLI/Compatible/Json/Friendly.hs | 91 ++++++++++++++++++- 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 .changes/20260827_155708_cardano-cli_palas_dijkstra_friendly_certs.yml diff --git a/.changes/20260827_155708_cardano-cli_palas_dijkstra_friendly_certs.yml b/.changes/20260827_155708_cardano-cli_palas_dijkstra_friendly_certs.yml new file mode 100644 index 0000000000..6f42f2d163 --- /dev/null +++ b/.changes/20260827_155708_cardano-cli_palas_dijkstra_friendly_certs.yml @@ -0,0 +1,6 @@ +description: | + `transaction view` now renders Dijkstra-era certificates instead of failing with an internal TODO error. +kind: +- feature +pr: 1430 +project: cardano-cli diff --git a/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs index 3717faed9e..4fce5a102b 100644 --- a/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs @@ -554,7 +554,7 @@ renderCertificate renderCertificate era (Exp.Certificate c) = case era of Exp.ConwayEra -> renderConwayCertificate c - Exp.DijkstraEra -> error "renderCertificate: TODO Dijkstra era not supported" + Exp.DijkstraEra -> renderDijkstraCertificate c renderDrepCredential :: () @@ -681,6 +681,95 @@ renderConwayCertificate cert = ] _ -> "unsupported certificate" .= String (T.pack $ show cert) +renderDijkstraCertificate + :: Ledger.DijkstraTxCert (Exp.LedgerEra DijkstraEra) -> (Aeson.Key, Aeson.Value) +renderDijkstraCertificate cert = + case cert of + L.RegDRepTxCert credential coin mAnchor -> + "Drep registration certificate" + .= object + [ "deposit" .= coin + , "certificate" .= renderDrepCredential credential + , "anchor" .= mAnchor + ] + L.UnRegDRepTxCert credential coin -> + "Drep unregistration certificate" + .= object + [ "refund" .= coin + , "certificate" .= renderDrepCredential credential + ] + L.AuthCommitteeHotKeyTxCert coldCred hotCred + | L.ScriptHashObj sh <- coldCred -> + "Cold committee authorization" + .= object + ["script hash" .= sh] + | L.ScriptHashObj sh <- hotCred -> + "Hot committee authorization" + .= object + ["script hash" .= sh] + | L.KeyHashObj ck@L.KeyHash{} <- coldCred + , L.KeyHashObj hk@L.KeyHash{} <- hotCred -> + "Constitutional committee member hot key registration" + .= object + [ "cold key hash" .= ck + , "hot key hash" .= hk + ] + L.ResignCommitteeColdTxCert cred anchor -> case cred of + L.ScriptHashObj sh -> + "Cold committee resignation" + .= object + [ "script hash" .= sh + , "anchor" .= anchor + ] + L.KeyHashObj ck@L.KeyHash{} -> + "Constitutional committee cold key resignation" + .= object + [ "cold key hash" .= ck + ] + L.RegDepositTxCert stakeCredential deposit -> + "Stake address registration" + .= object + [ "stake credential" .= stakeCredential + , "deposit" .= deposit + ] + L.UnRegDepositTxCert stakeCredential refund -> + "Stake address deregistration" + .= object + [ "stake credential" .= stakeCredential + , "refund" .= refund + ] + L.DelegTxCert stakeCredential delegatee -> + "Stake address delegation" + .= object + [ "stake credential" .= stakeCredential + , "delegatee" .= delegateeJson delegatee + ] + L.RegDepositDelegTxCert stakeCredential delegatee deposit -> + "Stake address registration and delegation" + .= object + [ "stake credential" .= stakeCredential + , "delegatee" .= delegateeJson delegatee + , "deposit" .= deposit + ] + L.RegPoolTxCert poolParams -> + "Pool registration" + .= object + [ "pool params" .= poolParams + ] + L.RetirePoolTxCert kh@L.KeyHash{} epoch -> + "Pool retirement" + .= object + [ "stake pool key hash" .= kh + , "epoch" .= epoch + ] + L.UpdateDRepTxCert drepCredential mbAnchor -> + "Drep certificate update" + .= object + [ "Drep credential" .= drepCredential + , "anchor " .= mbAnchor + ] + _ -> "unsupported certificate" .= String (T.pack $ show cert) + friendlyStakeCredential :: L.Credential L.Staking -> Aeson.Pair friendlyStakeCredential = \case From a1c0428055bb337f8d9740f2e609365aca075849 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Fri, 28 Aug 2026 16:42:37 +0000 Subject: [PATCH 2/2] Remove a trailing space from the anchor key in the Dijkstra view 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. --- cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs index 4fce5a102b..daaeeef34b 100644 --- a/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs @@ -766,7 +766,7 @@ renderDijkstraCertificate cert = "Drep certificate update" .= object [ "Drep credential" .= drepCredential - , "anchor " .= mbAnchor + , "anchor" .= mbAnchor ] _ -> "unsupported certificate" .= String (T.pack $ show cert)