From 698a69caee8764aec468dcfbc651767a8d1896e5 Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Mon, 21 Oct 2024 12:49:17 +0200 Subject: [PATCH] Use correct pattern for stake deregistration certs in Conway --- cardano-api/internal/Cardano/Api/Certificate.hs | 14 +++++++++----- cardano-api/internal/Cardano/Api/Genesis.hs | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Certificate.hs b/cardano-api/internal/Cardano/Api/Certificate.hs index b4f442faa0..cfc09a514a 100644 --- a/cardano-api/internal/Cardano/Api/Certificate.hs +++ b/cardano-api/internal/Cardano/Api/Certificate.hs @@ -526,12 +526,10 @@ filterUnRegCreds = Ledger.GenesisDelegTxCert{} -> Nothing ConwayCertificate cEra conwayCert -> conwayEraOnwardsConstraints cEra $ case conwayCert of - Ledger.RegTxCert _ -> Nothing - Ledger.UnRegTxCert cred -> Just cred Ledger.RegPoolTxCert _ -> Nothing Ledger.RetirePoolTxCert _ _ -> Nothing Ledger.RegDepositTxCert _ _ -> Nothing - Ledger.UnRegDepositTxCert _ _ -> Nothing + Ledger.UnRegDepositTxCert cred _ -> Just cred Ledger.DelegTxCert _ _ -> Nothing Ledger.RegDepositDelegTxCert{} -> Nothing Ledger.AuthCommitteeHotKeyTxCert{} -> Nothing @@ -539,6 +537,10 @@ filterUnRegCreds = Ledger.RegDRepTxCert{} -> Nothing Ledger.UnRegDRepTxCert{} -> Nothing Ledger.UpdateDRepTxCert{} -> Nothing + -- those are old shelley patterns + Ledger.RegTxCert _ -> Nothing + -- stake cred deregistration w/o deposit + Ledger.UnRegTxCert cred -> Just cred filterUnRegDRepCreds :: Certificate era -> Maybe (Ledger.Credential Ledger.DRepRole Ledger.StandardCrypto) @@ -546,8 +548,6 @@ filterUnRegDRepCreds = \case ShelleyRelatedCertificate _ _ -> Nothing ConwayCertificate cEra conwayCert -> conwayEraOnwardsConstraints cEra $ case conwayCert of - Ledger.RegTxCert _ -> Nothing - Ledger.UnRegTxCert _ -> Nothing Ledger.RegPoolTxCert _ -> Nothing Ledger.RetirePoolTxCert _ _ -> Nothing Ledger.RegDepositTxCert _ _ -> Nothing @@ -559,6 +559,10 @@ filterUnRegDRepCreds = \case Ledger.RegDRepTxCert{} -> Nothing Ledger.UnRegDRepTxCert cred _ -> Just cred Ledger.UpdateDRepTxCert{} -> Nothing + -- those are old shelley patterns + Ledger.RegTxCert _ -> Nothing + -- stake cred deregistration w/o deposit + Ledger.UnRegTxCert _ -> Nothing -- ---------------------------------------------------------------------------- -- Internal conversion functions diff --git a/cardano-api/internal/Cardano/Api/Genesis.hs b/cardano-api/internal/Cardano/Api/Genesis.hs index 3b3e2038ca..2b3a1325e0 100644 --- a/cardano-api/internal/Cardano/Api/Genesis.hs +++ b/cardano-api/internal/Cardano/Api/Genesis.hs @@ -171,6 +171,7 @@ shelleyGenesisDefaults = -- pot = tx_fees + ρ * remaining_reserves & ppRhoL .~ unsafeBR (1 % 10) -- How much of reserves goes into pot & ppTauL .~ unsafeBR (1 % 10) -- τ * remaining_reserves is sent to treasury every epoch + & ppKeyDepositL .~ 400000 -- require a non-zero deposit when registering keys , -- genesis keys and initial funds sgGenDelegs = M.empty , sgStaking = emptyGenesisStaking