From 6a0fa9477eae5cafb139ccc424109cdea3c1c64d Mon Sep 17 00:00:00 2001 From: teodanciu Date: Wed, 24 May 2023 21:41:08 +0100 Subject: [PATCH] Rename `TxCertMir` pattern to `MirTxCert` for consistency --- .../impl/src/Cardano/Ledger/Allegra/TxCert.hs | 6 ++--- .../impl/src/Cardano/Ledger/Alonzo/TxCert.hs | 6 ++--- .../impl/src/Cardano/Ledger/Babbage/TxCert.hs | 6 ++--- .../impl/src/Cardano/Ledger/Conway/TxCert.hs | 4 +-- .../impl/src/Cardano/Ledger/Mary/TxCert.hs | 6 ++--- .../impl/src/Cardano/Ledger/Shelley/Core.hs | 2 +- .../src/Cardano/Ledger/Shelley/Rules/Deleg.hs | 2 +- .../impl/src/Cardano/Ledger/Shelley/TxCert.hs | 26 +++++++++---------- .../Ledger/Shelley/Examples/Consensus.hs | 2 +- .../Ledger/Shelley/Generator/TxCert.hs | 4 +-- .../Cardano/Ledger/Shelley/Rules/Deleg.hs | 4 +-- .../Cardano/Ledger/Shelley/Rules/TestChain.hs | 2 +- .../Ledger/Shelley/Examples/MirTransfer.hs | 4 +-- .../Shelley/Serialisation/Golden/Encoding.hs | 4 +-- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/eras/allegra/impl/src/Cardano/Ledger/Allegra/TxCert.hs b/eras/allegra/impl/src/Cardano/Ledger/Allegra/TxCert.hs index 8596b5f74c7..6a7199ac12e 100644 --- a/eras/allegra/impl/src/Cardano/Ledger/Allegra/TxCert.hs +++ b/eras/allegra/impl/src/Cardano/Ledger/Allegra/TxCert.hs @@ -49,7 +49,7 @@ instance Crypto c => ShelleyEraTxCert (AllegraEra c) where getGenesisDelegTxCert (ShelleyTxCertGenesisDeleg c) = Just c getGenesisDelegTxCert _ = Nothing - mkTxCertMir = ShelleyTxCertMir + mkMirTxCert = ShelleyTxCertMir - getTxCertMir (ShelleyTxCertMir c) = Just c - getTxCertMir _ = Nothing + getMirTxCert (ShelleyTxCertMir c) = Just c + getMirTxCert _ = Nothing diff --git a/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxCert.hs b/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxCert.hs index 3bbc2f22ce6..36d417fced9 100644 --- a/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxCert.hs +++ b/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxCert.hs @@ -49,7 +49,7 @@ instance Crypto c => ShelleyEraTxCert (AlonzoEra c) where getGenesisDelegTxCert (ShelleyTxCertGenesisDeleg c) = Just c getGenesisDelegTxCert _ = Nothing - mkTxCertMir = ShelleyTxCertMir + mkMirTxCert = ShelleyTxCertMir - getTxCertMir (ShelleyTxCertMir c) = Just c - getTxCertMir _ = Nothing + getMirTxCert (ShelleyTxCertMir c) = Just c + getMirTxCert _ = Nothing diff --git a/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxCert.hs b/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxCert.hs index fb6f2c30902..89297622a8c 100644 --- a/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxCert.hs +++ b/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxCert.hs @@ -49,7 +49,7 @@ instance Crypto c => ShelleyEraTxCert (BabbageEra c) where getGenesisDelegTxCert (ShelleyTxCertGenesisDeleg c) = Just c getGenesisDelegTxCert _ = Nothing - mkTxCertMir = ShelleyTxCertMir + mkMirTxCert = ShelleyTxCertMir - getTxCertMir (ShelleyTxCertMir c) = Just c - getTxCertMir _ = Nothing + getMirTxCert (ShelleyTxCertMir c) = Just c + getMirTxCert _ = Nothing diff --git a/eras/conway/impl/src/Cardano/Ledger/Conway/TxCert.hs b/eras/conway/impl/src/Cardano/Ledger/Conway/TxCert.hs index edf19b4f272..2a41acaa715 100644 --- a/eras/conway/impl/src/Cardano/Ledger/Conway/TxCert.hs +++ b/eras/conway/impl/src/Cardano/Ledger/Conway/TxCert.hs @@ -100,8 +100,8 @@ instance Crypto c => ShelleyEraTxCert (ConwayEra c) where mkGenesisDelegTxCert = notSupportedInThisEra getGenesisDelegTxCert _ = Nothing - mkTxCertMir = notSupportedInThisEra - getTxCertMir = const Nothing + mkMirTxCert = notSupportedInThisEra + getMirTxCert = const Nothing class ShelleyEraTxCert era => ConwayEraTxCert era where mkConwayTxCertDeleg :: ConwayDelegCert (EraCrypto era) -> TxCert era diff --git a/eras/mary/impl/src/Cardano/Ledger/Mary/TxCert.hs b/eras/mary/impl/src/Cardano/Ledger/Mary/TxCert.hs index c5f3be2e4c8..bcaacd1671b 100644 --- a/eras/mary/impl/src/Cardano/Ledger/Mary/TxCert.hs +++ b/eras/mary/impl/src/Cardano/Ledger/Mary/TxCert.hs @@ -57,7 +57,7 @@ instance Crypto c => ShelleyEraTxCert (MaryEra c) where getGenesisDelegTxCert (ShelleyTxCertGenesisDeleg c) = Just c getGenesisDelegTxCert _ = Nothing - mkTxCertMir = ShelleyTxCertMir + mkMirTxCert = ShelleyTxCertMir - getTxCertMir (ShelleyTxCertMir c) = Just c - getTxCertMir _ = Nothing + getMirTxCert (ShelleyTxCertMir c) = Just c + getMirTxCert _ = Nothing diff --git a/eras/shelley/impl/src/Cardano/Ledger/Shelley/Core.hs b/eras/shelley/impl/src/Cardano/Ledger/Shelley/Core.hs index 99d2241edff..397fb99d0b5 100644 --- a/eras/shelley/impl/src/Cardano/Ledger/Shelley/Core.hs +++ b/eras/shelley/impl/src/Cardano/Ledger/Shelley/Core.hs @@ -8,7 +8,7 @@ module Cardano.Ledger.Shelley.Core ( ShelleyEraTxBody (..), - pattern TxCertMir, + pattern MirTxCert, ShelleyEraTxCert (..), Withdrawals (..), Wdrl, diff --git a/eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs b/eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs index 7c11107b8af..723f2f5678b 100644 --- a/eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs +++ b/eras/shelley/impl/src/Cardano/Ledger/Shelley/Rules/Deleg.hs @@ -327,7 +327,7 @@ delegationTransition = do RegPoolTxCert _ -> do failBecause WrongCertificateTypeDELEG -- this always fails pure ds - _ | Just (MIRCert targetPot mirTarget) <- getTxCertMir c -> do + _ | Just (MIRCert targetPot mirTarget) <- getMirTxCert c -> do checkSlotNotTooLate slot case mirTarget of StakeAddressesMIR credCoinMap -> do diff --git a/eras/shelley/impl/src/Cardano/Ledger/Shelley/TxCert.hs b/eras/shelley/impl/src/Cardano/Ledger/Shelley/TxCert.hs index 287e2a27d5c..5f7c225679c 100644 --- a/eras/shelley/impl/src/Cardano/Ledger/Shelley/TxCert.hs +++ b/eras/shelley/impl/src/Cardano/Ledger/Shelley/TxCert.hs @@ -24,7 +24,7 @@ module Cardano.Ledger.Shelley.TxCert ( ShelleyEraTxCert (..), - pattern TxCertMir, + pattern MirTxCert, pattern GenesisDelegTxCert, pattern RegTxCert, pattern UnRegTxCert, @@ -137,8 +137,8 @@ class EraTxCert era => ShelleyEraTxCert era where mkGenesisDelegTxCert :: GenesisDelegCert (EraCrypto era) -> TxCert era getGenesisDelegTxCert :: TxCert era -> Maybe (GenesisDelegCert (EraCrypto era)) - mkTxCertMir :: ProtVerAtMost era 8 => MIRCert (EraCrypto era) -> TxCert era - getTxCertMir :: TxCert era -> Maybe (MIRCert (EraCrypto era)) + mkMirTxCert :: ProtVerAtMost era 8 => MIRCert (EraCrypto era) -> TxCert era + getMirTxCert :: TxCert era -> Maybe (MIRCert (EraCrypto era)) instance Crypto c => ShelleyEraTxCert (ShelleyEra c) where {-# SPECIALIZE instance ShelleyEraTxCert (ShelleyEra StandardCrypto) #-} @@ -163,10 +163,10 @@ instance Crypto c => ShelleyEraTxCert (ShelleyEra c) where getGenesisDelegTxCert (ShelleyTxCertGenesisDeleg c) = Just c getGenesisDelegTxCert _ = Nothing - mkTxCertMir = ShelleyTxCertMir + mkMirTxCert = ShelleyTxCertMir - getTxCertMir (ShelleyTxCertMir c) = Just c - getTxCertMir _ = Nothing + getMirTxCert (ShelleyTxCertMir c) = Just c + getMirTxCert _ = Nothing pattern RegTxCert :: ShelleyEraTxCert era => StakeCredential (EraCrypto era) -> TxCert era pattern RegTxCert c <- (getRegTxCert -> Just c) @@ -187,10 +187,10 @@ pattern DelegStakeTxCert c kh <- (getDelegStakeTxCert -> Just (c, kh)) where DelegStakeTxCert c kh = mkDelegStakeTxCert c kh -pattern TxCertMir :: (ShelleyEraTxCert era, ProtVerAtMost era 8) => MIRCert (EraCrypto era) -> TxCert era -pattern TxCertMir d <- (getTxCertMir -> Just d) +pattern MirTxCert :: (ShelleyEraTxCert era, ProtVerAtMost era 8) => MIRCert (EraCrypto era) -> TxCert era +pattern MirTxCert d <- (getMirTxCert -> Just d) where - TxCertMir d = mkTxCertMir d + MirTxCert d = mkMirTxCert d pattern GenesisDelegTxCert :: ShelleyEraTxCert era => @@ -462,15 +462,15 @@ isRetirePool (RetirePoolTxCert _ _) = True isRetirePool _ = False isInstantaneousRewards :: ShelleyEraTxCert era => TxCert era -> Bool -isInstantaneousRewards = isJust . getTxCertMir +isInstantaneousRewards = isJust . getMirTxCert isReservesMIRCert :: ShelleyEraTxCert era => TxCert era -> Bool -isReservesMIRCert x = case getTxCertMir x of +isReservesMIRCert x = case getMirTxCert x of Just (MIRCert ReservesMIR _) -> True _ -> False isTreasuryMIRCert :: ShelleyEraTxCert era => TxCert era -> Bool -isTreasuryMIRCert x = case getTxCertMir x of +isTreasuryMIRCert x = case getMirTxCert x of Just (MIRCert TreasuryMIR _) -> True _ -> False @@ -482,7 +482,7 @@ isTreasuryMIRCert x = case getTxCertMir x of -- `getVKeyWitnessTxCert` instead. requiresVKeyWitness :: (ShelleyEraTxCert era, ProtVerAtMost era 8) => TxCert era -> Bool requiresVKeyWitness (RegTxCert _) = False -requiresVKeyWitness x = isNothing $ getTxCertMir x +requiresVKeyWitness x = isNothing $ getMirTxCert x {-# DEPRECATED requiresVKeyWitness "In favor of `getVKeyWitnessTxCert`" #-} getScriptWitnessShelleyTxCert :: diff --git a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Examples/Consensus.hs b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Examples/Consensus.hs index 83df25e5210..4dbf9499ad6 100644 --- a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Examples/Consensus.hs +++ b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Examples/Consensus.hs @@ -472,7 +472,7 @@ exampleCerts = StrictSeq.fromList [ RegTxCert (keyToCredential exampleStakeKey) , RegPoolTxCert examplePoolParams - , TxCertMir $ + , MirTxCert $ MIRCert ReservesMIR $ StakeAddressesMIR $ Map.fromList diff --git a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Generator/TxCert.hs b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Generator/TxCert.hs index c8dfe40659d..f1aa3937e2b 100644 --- a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Generator/TxCert.hs +++ b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Generator/TxCert.hs @@ -504,7 +504,7 @@ genInstantaneousRewardsAccounts s genesisDelegatesByHash pparams accountState de then Nothing else Just - ( TxCertMir (MIRCert pot (StakeAddressesMIR credCoinMap)) + ( MirTxCert (MIRCert pot (StakeAddressesMIR credCoinMap)) , DelegateCred (aikCold <$> coreSigners) ) @@ -542,7 +542,7 @@ genInstantaneousRewardsTransfer s genesisDelegatesByHash pparams accountState de then Nothing else Just - ( TxCertMir (MIRCert pot (SendToOppositePotMIR $ Coin amount)) + ( MirTxCert (MIRCert pot (SendToOppositePotMIR $ Coin amount)) , DelegateCred (aikCold <$> coreSigners) ) diff --git a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/Deleg.hs b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/Deleg.hs index f3100dacd56..5d5a537e1cb 100644 --- a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/Deleg.hs +++ b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/Deleg.hs @@ -178,7 +178,7 @@ checkInstantaneousRewards denv SourceSignalTarget {source, signal, target} = case signal of - TxCertMir (MIRCert ReservesMIR (StakeAddressesMIR irwd)) -> + MirTxCert (MIRCert ReservesMIR (StakeAddressesMIR irwd)) -> conjoin [ counterexample "a ReservesMIR certificate should add all entries to the `irwd` mapping" @@ -198,7 +198,7 @@ checkInstantaneousRewards == fold (iRReserves $ dsIRewards target) ) ] - TxCertMir (MIRCert TreasuryMIR (StakeAddressesMIR irwd)) -> + MirTxCert (MIRCert TreasuryMIR (StakeAddressesMIR irwd)) -> conjoin [ counterexample "a TreasuryMIR certificate should add all entries to the `irwd` mapping" diff --git a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs index 57baddaf407..e14257e1635 100644 --- a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs +++ b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs @@ -233,7 +233,7 @@ delegTraceFromBlock chainSt block = delegCert (RegTxCert _) = True delegCert (UnRegTxCert _) = True delegCert (DelegStakeTxCert _ _) = True - delegCert (TxCertMir _) = True + delegCert (MirTxCert _) = True delegCert _ = False -- | Reconstruct a POOL trace from the transactions in a Block and ChainState diff --git a/eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Examples/MirTransfer.hs b/eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Examples/MirTransfer.hs index c5a24c42816..ed683fccb4c 100644 --- a/eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Examples/MirTransfer.hs +++ b/eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Examples/MirTransfer.hs @@ -71,12 +71,12 @@ testMirTransfer :: Assertion testMirTransfer pv pot target ir acnt (Right expected) = do checkTrace @(ShelleyDELEG ShelleyTest) runShelleyBase (env pv acnt) $ - (pure (def {dsIRewards = ir})) .- (TxCertMir (MIRCert pot target)) .->> (def {dsIRewards = expected}) + (pure (def {dsIRewards = ir})) .- (MirTxCert (MIRCert pot target)) .->> (def {dsIRewards = expected}) testMirTransfer pv pot target ir acnt predicateFailure@(Left _) = do let st = runShelleyBase $ applySTSTest @(ShelleyDELEG ShelleyTest) - (TRC (env pv acnt, def {dsIRewards = ir}, TxCertMir (MIRCert pot target))) + (TRC (env pv acnt, def {dsIRewards = ir}, MirTxCert (MIRCert pot target))) (ignoreAllButIRWD st) @?= predicateFailure alice :: Credential 'Staking C_Crypto diff --git a/eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Serialisation/Golden/Encoding.hs b/eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Serialisation/Golden/Encoding.hs index 748eae7cef0..14eb60db543 100644 --- a/eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Serialisation/Golden/Encoding.hs +++ b/eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Serialisation/Golden/Encoding.hs @@ -113,8 +113,8 @@ import Cardano.Ledger.Shelley.TxBody ( import Cardano.Ledger.Shelley.TxCert ( pattern DelegStakeTxCert, pattern GenesisDelegTxCert, + pattern MirTxCert, pattern RegTxCert, - pattern TxCertMir, pattern UnRegTxCert, ) import Cardano.Ledger.Shelley.TxWits (ShelleyTxWits, addrWits, scriptWits) @@ -639,7 +639,7 @@ tests = in checkEncodingCBOR shelleyProtVer "mir" - (TxCertMir @C (MIRCert ReservesMIR rws)) + (MirTxCert @C (MIRCert ReservesMIR rws)) ( T ( TkListLen 2 . TkWord 6 -- make instantaneous rewards cert