From a46e502df8c9abc2fa141b41564a6d4efb3a9ae0 Mon Sep 17 00:00:00 2001 From: John Ky Date: Fri, 20 Oct 2023 11:25:54 +1100 Subject: [PATCH 1/5] New Cardano.Api.Ledger.Lens module and invalidBeforeL and invalidHereAfterL functions --- cardano-api/internal/Cardano/Api/Ledger/Lens.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cardano-api/internal/Cardano/Api/Ledger/Lens.hs b/cardano-api/internal/Cardano/Api/Ledger/Lens.hs index 95cc630f70..218950af9e 100644 --- a/cardano-api/internal/Cardano/Api/Ledger/Lens.hs +++ b/cardano-api/internal/Cardano/Api/Ledger/Lens.hs @@ -81,6 +81,7 @@ invalidHereAfterL :: Lens' L.ValidityInterval (Maybe SlotNo) invalidHereAfterL = invalidHereAfterStrictL . strictMaybeL -- | Lens to access the 'invalidBefore' field of a 'ValidityInterval' as a 'StrictMaybe SlotNo'. +-- Ideally this should be defined in cardano-ledger invalidBeforeStrictL :: Lens' L.ValidityInterval (StrictMaybe SlotNo) invalidBeforeStrictL = lens g s where @@ -91,6 +92,7 @@ invalidBeforeStrictL = lens g s s (L.ValidityInterval _ b) a = L.ValidityInterval a b -- | Lens to access the 'invalidHereAfter' field of a 'ValidityInterval' as a 'StrictMaybe SlotNo'. +-- Ideally this should be defined in cardano-ledger invalidHereAfterStrictL :: Lens' L.ValidityInterval (StrictMaybe SlotNo) invalidHereAfterStrictL = lens g s where From ab8f9904157754e9dcd406da86593b69b460cc5a Mon Sep 17 00:00:00 2001 From: John Ky Date: Tue, 24 Oct 2023 21:00:14 +1100 Subject: [PATCH 2/5] Delete ProtocolUTxOCostPerWordFeature and all related code --- cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs | 2 - .../Cardano/Api/ProtocolParameters.hs | 95 ++----------------- cardano-api/src/Cardano/Api.hs | 3 - 3 files changed, 9 insertions(+), 91 deletions(-) diff --git a/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs b/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs index 846aedc70c..940c1aa6f2 100644 --- a/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs +++ b/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs @@ -898,7 +898,6 @@ genProtocolParameters era = do protocolParamPoolPledgeInfluence <- genRationalInt64 protocolParamMonetaryExpansion <- genRational protocolParamTreasuryCut <- genRational - protocolParamUTxOCostPerWord <- inEonForEra @ProtocolUTxOCostPerWordFeature (pure Nothing) (const (Just <$> genLovelace)) era protocolParamCostModels <- pure mempty --TODO: Babbage figure out how to deal with -- asymmetric cost model JSON instances @@ -935,7 +934,6 @@ genProtocolParametersUpdate era = do protocolUpdatePoolPledgeInfluence <- Gen.maybe genRationalInt64 protocolUpdateMonetaryExpansion <- Gen.maybe genRational protocolUpdateTreasuryCut <- Gen.maybe genRational - protocolUpdateUTxOCostPerWord <- inEonForEra @ProtocolUTxOCostPerWordFeature (pure Nothing) (const (Just <$> genLovelace)) era let protocolUpdateCostModels = mempty -- genCostModels --TODO: Babbage figure out how to deal with -- asymmetric cost model JSON instances diff --git a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs index a82f6b17fc..100301b034 100644 --- a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs +++ b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs @@ -92,7 +92,6 @@ module Cardano.Api.ProtocolParameters ( AsType(..), -- ** Era-dependent protocol features - ProtocolUTxOCostPerWordFeature(..), ) where import Cardano.Api.Address @@ -562,11 +561,6 @@ data ProtocolParameters = -- protocolParamTreasuryCut :: Rational, - -- | Cost in ada per word of UTxO storage. - -- - -- /Introduced in Alonzo/ - protocolParamUTxOCostPerWord :: Maybe Lovelace, - -- | Cost models for script languages that use them. -- -- /Introduced in Alonzo/ @@ -633,7 +627,6 @@ instance FromJSON ProtocolParameters where <*> o .: "poolPledgeInfluence" <*> o .: "monetaryExpansion" <*> o .: "treasuryCut" - <*> o .:? "utxoCostPerWord" <*> (fmap unCostModels <$> o .:? "costModels") .!= Map.empty <*> o .:? "executionUnitPrices" <*> o .:? "maxTxExecutionUnits" @@ -665,7 +658,6 @@ instance ToJSON ProtocolParameters where , "txFeeFixed" .= protocolParamTxFeeFixed , "txFeePerByte" .= protocolParamTxFeePerByte -- Alonzo era: - , "utxoCostPerWord" .= protocolParamUTxOCostPerWord , "costModels" .= CostModels protocolParamCostModels , "executionUnitPrices" .= protocolParamPrices , "maxTxExecutionUnits" .= protocolParamMaxTxExUnits @@ -799,13 +791,6 @@ data ProtocolParametersUpdate = -- Introduced in Alonzo, - -- | Cost in ada per word of UTxO storage. - -- - -- /Introduced in Alonzo, obsoleted in Babbage by 'protocolUpdateUTxOCostPerByte'/ - protocolUpdateUTxOCostPerWord :: Maybe Lovelace, - - -- Introduced in Alonzo, - -- | Cost models for script languages that use them. -- -- /Introduced in Alonzo/ @@ -844,7 +829,7 @@ data ProtocolParametersUpdate = -- | Cost in ada per byte of UTxO storage. -- - -- /Introduced in Babbage. Supercedes 'protocolUpdateUTxOCostPerWord'/ + -- /Introduced in Babbage/ protocolUpdateUTxOCostPerByte :: Maybe Lovelace } deriving (Eq, Show) @@ -870,7 +855,6 @@ instance Semigroup ProtocolParametersUpdate where , protocolUpdateMonetaryExpansion = merge protocolUpdateMonetaryExpansion , protocolUpdateTreasuryCut = merge protocolUpdateTreasuryCut -- Introduced in Alonzo below. - , protocolUpdateUTxOCostPerWord = merge protocolUpdateUTxOCostPerWord , protocolUpdateCostModels = mergeMap protocolUpdateCostModels , protocolUpdatePrices = merge protocolUpdatePrices , protocolUpdateMaxTxExUnits = merge protocolUpdateMaxTxExUnits @@ -910,7 +894,6 @@ instance Monoid ProtocolParametersUpdate where , protocolUpdatePoolPledgeInfluence = Nothing , protocolUpdateMonetaryExpansion = Nothing , protocolUpdateTreasuryCut = Nothing - , protocolUpdateUTxOCostPerWord = Nothing , protocolUpdateCostModels = mempty , protocolUpdatePrices = Nothing , protocolUpdateMaxTxExUnits = Nothing @@ -941,7 +924,6 @@ instance ToCBOR ProtocolParametersUpdate where <> toCBOR protocolUpdatePoolPledgeInfluence <> toCBOR protocolUpdateMonetaryExpansion <> toCBOR protocolUpdateTreasuryCut - <> toCBOR protocolUpdateUTxOCostPerWord <> toCBOR protocolUpdateCostModels <> toCBOR protocolUpdatePrices <> toCBOR protocolUpdateMaxTxExUnits @@ -980,32 +962,6 @@ instance FromCBOR ProtocolParametersUpdate where <*> fromCBOR <*> fromCBOR <*> fromCBOR - <*> fromCBOR - --- | A representation of whether the era supports the 'UTxO Cost Per Word' --- protocol parameter. --- --- The Babbage and subsequent eras support such a protocol parameter. --- -data ProtocolUTxOCostPerWordFeature era where - ProtocolUpdateUTxOCostPerWordInAlonzoEra :: ProtocolUTxOCostPerWordFeature AlonzoEra - -deriving instance Eq (ProtocolUTxOCostPerWordFeature era) -deriving instance Show (ProtocolUTxOCostPerWordFeature era) - -instance Eon ProtocolUTxOCostPerWordFeature where - inEonForEra no yes = \case - ByronEra -> no - ShelleyEra -> no - AllegraEra -> no - MaryEra -> no - AlonzoEra -> yes ProtocolUpdateUTxOCostPerWordInAlonzoEra - BabbageEra -> no - ConwayEra -> no - -instance ToCardanoEra ProtocolUTxOCostPerWordFeature where - toCardanoEra = \case - ProtocolUpdateUTxOCostPerWordInAlonzoEra -> AlonzoEra -- ---------------------------------------------------------------------------- -- Praos nonce @@ -1345,16 +1301,12 @@ toAlonzoPParamsUpdate :: Ledger.Crypto crypto toAlonzoPParamsUpdate protocolParametersUpdate@ProtocolParametersUpdate { protocolUpdateDecentralization - , protocolUpdateUTxOCostPerWord } = do ppuAlonzoCommon <- toAlonzoCommonPParamsUpdate protocolParametersUpdate d <- mapM (boundRationalEither "D") protocolUpdateDecentralization let ppuAlonzo = ppuAlonzoCommon & ppuDL .~ noInlineMaybeToStrictMaybe d - & ppuCoinsPerUTxOWordL .~ - (CoinPerWord . toShelleyLovelace <$> - noInlineMaybeToStrictMaybe protocolUpdateUTxOCostPerWord) pure ppuAlonzo @@ -1458,7 +1410,6 @@ fromShelleyCommonPParamsUpdate ppu = strictMaybeToMaybe (ppu ^. ppuRhoL) , protocolUpdateTreasuryCut = Ledger.unboundRational <$> strictMaybeToMaybe (ppu ^. ppuTauL) - , protocolUpdateUTxOCostPerWord = Nothing , protocolUpdateCostModels = mempty , protocolUpdatePrices = Nothing , protocolUpdateMaxTxExUnits = Nothing @@ -1488,10 +1439,10 @@ fromShelleyPParamsUpdate ppu = strictMaybeToMaybe (ppu ^. ppuMinUTxOValueL) } -fromAlonzoCommonPParamsUpdate :: AlonzoEraPParams ledgerera +fromAlonzoPParamsUpdate :: AlonzoEraPParams ledgerera => PParamsUpdate ledgerera -> ProtocolParametersUpdate -fromAlonzoCommonPParamsUpdate ppu = +fromAlonzoPParamsUpdate ppu = (fromShelleyCommonPParamsUpdate ppu) { protocolUpdateCostModels = maybe mempty fromAlonzoCostModels (strictMaybeToMaybe (ppu ^. ppuCostModelsL)) @@ -1507,21 +1458,11 @@ fromAlonzoCommonPParamsUpdate ppu = , protocolUpdateUTxOCostPerByte = Nothing } - -fromAlonzoPParamsUpdate :: Ledger.Crypto crypto - => PParamsUpdate (Ledger.AlonzoEra crypto) - -> ProtocolParametersUpdate -fromAlonzoPParamsUpdate ppu = - (fromAlonzoCommonPParamsUpdate ppu) { - protocolUpdateUTxOCostPerWord = fromShelleyLovelace . unCoinPerWord <$> - strictMaybeToMaybe (ppu ^. ppuCoinsPerUTxOWordL) - } - fromBabbagePParamsUpdate :: BabbageEraPParams ledgerera => PParamsUpdate ledgerera -> ProtocolParametersUpdate fromBabbagePParamsUpdate ppu = - (fromAlonzoCommonPParamsUpdate ppu) { + (fromAlonzoPParamsUpdate ppu) { protocolUpdateUTxOCostPerByte = fromShelleyLovelace . unCoinPerByte <$> strictMaybeToMaybe (ppu ^. ppuCoinsPerUTxOByteL) } @@ -1657,7 +1598,6 @@ toAlonzoPParams :: Ledger.Crypto crypto toAlonzoPParams protocolParameters@ProtocolParameters { protocolParamDecentralization - , protocolParamUTxOCostPerWord } = do ppAlonzoCommon <- toAlonzoCommonPParams protocolParameters -- QUESTION? This is strange, why do we need to construct Alonzo Tx with Babbage PParams? @@ -1676,12 +1616,9 @@ toAlonzoPParams -- d <- requireParam "protocolParamDecentralization" -- (boundRationalEither "D") -- protocolParamDecentralization - utxoCostPerWord <- - requireParam "protocolParamUTxOCostPerWord" Right protocolParamUTxOCostPerWord let ppAlonzo = ppAlonzoCommon & ppDL .~ d - & ppCoinsPerUTxOWordL .~ CoinPerWord (toShelleyLovelace utxoCostPerWord) pure ppAlonzo @@ -1741,7 +1678,6 @@ fromShelleyCommonPParams pp = , protocolParamPoolPledgeInfluence = Ledger.unboundRational (pp ^. ppA0L) , protocolParamMonetaryExpansion = Ledger.unboundRational (pp ^. ppRhoL) , protocolParamTreasuryCut = Ledger.unboundRational (pp ^. ppTauL) - , protocolParamUTxOCostPerWord = Nothing -- Obsolete from Babbage onwards , protocolParamCostModels = mempty -- Only from Alonzo onwards , protocolParamPrices = Nothing -- Only from Alonzo onwards , protocolParamMaxTxExUnits = Nothing -- Only from Alonzo onwards @@ -1769,10 +1705,10 @@ fromShelleyPParams pp = } -fromAlonzoCommonPParams :: AlonzoEraPParams ledgerera +fromAlonzoPParams :: AlonzoEraPParams ledgerera => PParams ledgerera -> ProtocolParameters -fromAlonzoCommonPParams pp = +fromAlonzoPParams pp = (fromShelleyCommonPParams pp) { protocolParamCostModels = fromAlonzoCostModels $ pp ^. ppCostModelsL , protocolParamPrices = Just . fromAlonzoPrices $ pp ^. ppPricesL @@ -1783,21 +1719,11 @@ fromAlonzoCommonPParams pp = , protocolParamMaxCollateralInputs = Just $ pp ^. ppMaxCollateralInputsL } - -fromAlonzoPParams :: Ledger.Crypto crypto - => PParams (Ledger.AlonzoEra crypto) - -> ProtocolParameters -fromAlonzoPParams pp = - (fromAlonzoCommonPParams pp) { - protocolParamUTxOCostPerWord = Just . fromShelleyLovelace . unCoinPerWord $ - pp ^. ppCoinsPerUTxOWordL - } - fromBabbagePParams :: BabbageEraPParams ledgerera => PParams ledgerera -> ProtocolParameters fromBabbagePParams pp = - (fromAlonzoCommonPParams pp) { + (fromAlonzoPParams pp) { protocolParamUTxOCostPerByte = Just . fromShelleyLovelace . unCoinPerByte $ pp ^. ppCoinsPerUTxOByteL } @@ -1822,7 +1748,6 @@ checkProtocolParameters sbe ProtocolParameters{..} = where era = shelleyBasedToCardanoEra sbe - costPerWord = isJust protocolParamUTxOCostPerWord cModel = not $ Map.null protocolParamCostModels prices = isJust protocolParamPrices maxTxUnits = isJust protocolParamMaxTxExUnits @@ -1836,8 +1761,7 @@ checkProtocolParameters sbe ProtocolParameters{..} = alonzoPParamFieldsRequirements :: [Bool] alonzoPParamFieldsRequirements = - [ costPerWord - , cModel + [ cModel , prices , maxTxUnits , maxBlockExUnits @@ -1849,8 +1773,7 @@ checkProtocolParameters sbe ProtocolParameters{..} = babbagePParamFieldsRequirements :: [Bool] babbagePParamFieldsRequirements = - [ not costPerWord - , cModel + [ cModel , prices , maxTxUnits , maxBlockExUnits diff --git a/cardano-api/src/Cardano/Api.hs b/cardano-api/src/Cardano/Api.hs index 2f996a840e..1555934213 100644 --- a/cardano-api/src/Cardano/Api.hs +++ b/cardano-api/src/Cardano/Api.hs @@ -403,9 +403,6 @@ module Cardano.Api ( BuildTx, ViewTx, - -- ** Era-dependent protocol features - ProtocolUTxOCostPerWordFeature(..), - -- ** Fee calculation LedgerEpochInfo(..), transactionFee, From 29c68872a6c8340df90181e72485775f9ab9bf03 Mon Sep 17 00:00:00 2001 From: John Ky Date: Tue, 24 Oct 2023 21:23:47 +1100 Subject: [PATCH 3/5] Delete ShelleyToAlonzoPParams and createDeprecatedAfterAlonzoPParams --- .../Cardano/Api/ProtocolParameters.hs | 22 ++----------------- cardano-api/src/Cardano/Api/Shelley.hs | 1 - 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs index 100301b034..cf2edceaa1 100644 --- a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs +++ b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs @@ -41,7 +41,6 @@ module Cardano.Api.ProtocolParameters ( AlonzoOnwardsPParams(..), CommonProtocolParametersUpdate(..), DeprecatedAfterMaryPParams(..), - ShelleyToAlonzoPParams(..), ShelleyToAlonzoPParams'(..), IntroducedInBabbagePParams(..), IntroducedInConwayPParams(..), @@ -214,7 +213,6 @@ data EraBasedProtocolParametersUpdate era where :: CommonProtocolParametersUpdate -> ShelleyToAlonzoPParams' AlonzoEra -> AlonzoOnwardsPParams AlonzoEra - -> ShelleyToAlonzoPParams AlonzoEra -> EraBasedProtocolParametersUpdate AlonzoEra BabbageEraBasedProtocolParametersUpdate @@ -286,12 +284,11 @@ createEraBasedProtocolParamUpdate sbe eraPParamsUpdate = Ledger.PParamsUpdate depAfterAlonzo' = createDeprecatedAfterAlonzoPParams' sbe depAfterAlonzo in Ledger.PParamsUpdate $ common <> depAfterMary' <> depAfterAlonzo' - AlonzoEraBasedProtocolParametersUpdate c depAfterAlonzoA introInAlon depAfterAlonzoB -> + AlonzoEraBasedProtocolParametersUpdate c depAfterAlonzoA introInAlon -> let Ledger.PParamsUpdate common = createCommonPParamsUpdate c Ledger.PParamsUpdate preAl' = createPParamsUpdateIntroducedInAlonzo AlonzoEraOnwardsAlonzo introInAlon Ledger.PParamsUpdate depAfterAlonzoA' = createDeprecatedAfterAlonzoPParams' sbe depAfterAlonzoA - Ledger.PParamsUpdate depAfterAlonzoB' = createDeprecatedAfterAlonzoPParams sbe depAfterAlonzoB - in Ledger.PParamsUpdate $ common <> preAl' <> depAfterAlonzoA' <> depAfterAlonzoB' + in Ledger.PParamsUpdate $ common <> preAl' <> depAfterAlonzoA' BabbageEraBasedProtocolParametersUpdate c introInAlonzo introInBabbage -> let Ledger.PParamsUpdate common = createCommonPParamsUpdate c @@ -360,21 +357,6 @@ createDeprecatedAfterMaryPParams createDeprecatedAfterMaryPParams _ (DeprecatedAfterMaryPParams minUtxoVal) = Ledger.emptyPParamsUpdate & Ledger.ppuMinUTxOValueL .~ minUtxoVal -newtype ShelleyToAlonzoPParams ledgerera - = ShelleyToAlonzoPParams (StrictMaybe CoinPerWord) -- ^ Coins per UTxO word - deriving Show - --- We had to duplicate ShelleyToAlonzoPParams because --- of type class constraints. -createDeprecatedAfterAlonzoPParams - :: AlonzoEraPParams (ShelleyLedgerEra era) - => Ledger.ProtVerAtLeast (ShelleyLedgerEra era) 5 - => Ledger.ProtVerAtMost (ShelleyLedgerEra era) 6 - => ShelleyBasedEra era -> ShelleyToAlonzoPParams era -> Ledger.PParamsUpdate (ShelleyLedgerEra era) -createDeprecatedAfterAlonzoPParams _ (ShelleyToAlonzoPParams alCoinsPerUTxOWord) = - Ledger.emptyPParamsUpdate - & Ledger.ppuCoinsPerUTxOWordL .~ alCoinsPerUTxOWord - data ShelleyToAlonzoPParams' ledgerera = ShelleyToAlonzoPParams' (StrictMaybe Ledger.Nonce) -- ^ Extra entropy diff --git a/cardano-api/src/Cardano/Api/Shelley.hs b/cardano-api/src/Cardano/Api/Shelley.hs index e35fd337b5..43327d5648 100644 --- a/cardano-api/src/Cardano/Api/Shelley.hs +++ b/cardano-api/src/Cardano/Api/Shelley.hs @@ -115,7 +115,6 @@ module Cardano.Api.Shelley CommonProtocolParametersUpdate(..), AlonzoOnwardsPParams(..), DeprecatedAfterMaryPParams(..), - ShelleyToAlonzoPParams(..), ShelleyToAlonzoPParams'(..), IntroducedInBabbagePParams(..), IntroducedInConwayPParams(..), From 43c16f2e44708c596b6c7e988cb8e8b84349d679 Mon Sep 17 00:00:00 2001 From: John Ky Date: Tue, 24 Oct 2023 21:24:49 +1100 Subject: [PATCH 4/5] Rename createDeprecatedAfterAlonzoPParams' to -createDeprecatedAfterAlonzoPParams --- .../internal/Cardano/Api/ProtocolParameters.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs index cf2edceaa1..a427af9ad6 100644 --- a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs +++ b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs @@ -269,25 +269,25 @@ createEraBasedProtocolParamUpdate sbe eraPParamsUpdate = ShelleyEraBasedProtocolParametersUpdate c depAfterMary depAfterAlonzo -> let Ledger.PParamsUpdate common = createCommonPParamsUpdate c Ledger.PParamsUpdate depAfterMary' = createDeprecatedAfterMaryPParams sbe depAfterMary - Ledger.PParamsUpdate depAfterAlonzo' = createDeprecatedAfterAlonzoPParams' sbe depAfterAlonzo + Ledger.PParamsUpdate depAfterAlonzo' = createDeprecatedAfterAlonzoPParams sbe depAfterAlonzo in Ledger.PParamsUpdate $ common <> depAfterMary' <> depAfterAlonzo' AllegraEraBasedProtocolParametersUpdate c depAfterMary depAfterAlonzo -> let Ledger.PParamsUpdate common = createCommonPParamsUpdate c Ledger.PParamsUpdate depAfterMary' = createDeprecatedAfterMaryPParams sbe depAfterMary - Ledger.PParamsUpdate depAfterAlonzo' = createDeprecatedAfterAlonzoPParams' sbe depAfterAlonzo + Ledger.PParamsUpdate depAfterAlonzo' = createDeprecatedAfterAlonzoPParams sbe depAfterAlonzo in Ledger.PParamsUpdate $ common <> depAfterMary' <> depAfterAlonzo' MaryEraBasedProtocolParametersUpdate c depAfterMary depAfterAlonzo -> let Ledger.PParamsUpdate common = createCommonPParamsUpdate c Ledger.PParamsUpdate depAfterMary' = createDeprecatedAfterMaryPParams sbe depAfterMary - Ledger.PParamsUpdate depAfterAlonzo' = createDeprecatedAfterAlonzoPParams' sbe depAfterAlonzo + Ledger.PParamsUpdate depAfterAlonzo' = createDeprecatedAfterAlonzoPParams sbe depAfterAlonzo in Ledger.PParamsUpdate $ common <> depAfterMary' <> depAfterAlonzo' AlonzoEraBasedProtocolParametersUpdate c depAfterAlonzoA introInAlon -> let Ledger.PParamsUpdate common = createCommonPParamsUpdate c Ledger.PParamsUpdate preAl' = createPParamsUpdateIntroducedInAlonzo AlonzoEraOnwardsAlonzo introInAlon - Ledger.PParamsUpdate depAfterAlonzoA' = createDeprecatedAfterAlonzoPParams' sbe depAfterAlonzoA + Ledger.PParamsUpdate depAfterAlonzoA' = createDeprecatedAfterAlonzoPParams sbe depAfterAlonzoA in Ledger.PParamsUpdate $ common <> preAl' <> depAfterAlonzoA' BabbageEraBasedProtocolParametersUpdate c introInAlonzo introInBabbage -> @@ -366,13 +366,13 @@ data ShelleyToAlonzoPParams' ledgerera type MaxAlonzoEra ledgerera = Ledger.ProtVerAtMost ledgerera 6 -createDeprecatedAfterAlonzoPParams' +createDeprecatedAfterAlonzoPParams :: EraPParams (ShelleyLedgerEra era) => MaxAlonzoEra (ShelleyLedgerEra era) => ShelleyBasedEra era -> ShelleyToAlonzoPParams' era -> Ledger.PParamsUpdate (ShelleyLedgerEra era) -createDeprecatedAfterAlonzoPParams' _ (ShelleyToAlonzoPParams' extraEntropy decentralization) = +createDeprecatedAfterAlonzoPParams _ (ShelleyToAlonzoPParams' extraEntropy decentralization) = Ledger.emptyPParamsUpdate & Ledger.ppuExtraEntropyL .~ extraEntropy & Ledger.ppuDL .~ decentralization From 0c299d1c8979433d894d6f4459ba195171b3a52d Mon Sep 17 00:00:00 2001 From: John Ky Date: Tue, 24 Oct 2023 21:30:45 +1100 Subject: [PATCH 5/5] Rename ShelleyToAlonzoPParams' to ShelleyToAlonzoPParams --- .../internal/Cardano/Api/ProtocolParameters.hs | 18 +++++++++--------- cardano-api/src/Cardano/Api/Shelley.hs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs index a427af9ad6..c6a2145769 100644 --- a/cardano-api/internal/Cardano/Api/ProtocolParameters.hs +++ b/cardano-api/internal/Cardano/Api/ProtocolParameters.hs @@ -41,7 +41,7 @@ module Cardano.Api.ProtocolParameters ( AlonzoOnwardsPParams(..), CommonProtocolParametersUpdate(..), DeprecatedAfterMaryPParams(..), - ShelleyToAlonzoPParams'(..), + ShelleyToAlonzoPParams(..), IntroducedInBabbagePParams(..), IntroducedInConwayPParams(..), createEraBasedProtocolParamUpdate, @@ -194,24 +194,24 @@ data EraBasedProtocolParametersUpdate era where ShelleyEraBasedProtocolParametersUpdate :: CommonProtocolParametersUpdate -> DeprecatedAfterMaryPParams ShelleyEra - -> ShelleyToAlonzoPParams' ShelleyEra + -> ShelleyToAlonzoPParams ShelleyEra -> EraBasedProtocolParametersUpdate ShelleyEra AllegraEraBasedProtocolParametersUpdate :: CommonProtocolParametersUpdate -> DeprecatedAfterMaryPParams AllegraEra - -> ShelleyToAlonzoPParams' AllegraEra + -> ShelleyToAlonzoPParams AllegraEra -> EraBasedProtocolParametersUpdate AllegraEra MaryEraBasedProtocolParametersUpdate :: CommonProtocolParametersUpdate -> DeprecatedAfterMaryPParams MaryEra - -> ShelleyToAlonzoPParams' MaryEra + -> ShelleyToAlonzoPParams MaryEra -> EraBasedProtocolParametersUpdate MaryEra AlonzoEraBasedProtocolParametersUpdate :: CommonProtocolParametersUpdate - -> ShelleyToAlonzoPParams' AlonzoEra + -> ShelleyToAlonzoPParams AlonzoEra -> AlonzoOnwardsPParams AlonzoEra -> EraBasedProtocolParametersUpdate AlonzoEra @@ -357,8 +357,8 @@ createDeprecatedAfterMaryPParams createDeprecatedAfterMaryPParams _ (DeprecatedAfterMaryPParams minUtxoVal) = Ledger.emptyPParamsUpdate & Ledger.ppuMinUTxOValueL .~ minUtxoVal -data ShelleyToAlonzoPParams' ledgerera - = ShelleyToAlonzoPParams' +data ShelleyToAlonzoPParams ledgerera + = ShelleyToAlonzoPParams (StrictMaybe Ledger.Nonce) -- ^ Extra entropy (StrictMaybe Ledger.UnitInterval) -- ^ Decentralization parameter deriving Show @@ -370,9 +370,9 @@ createDeprecatedAfterAlonzoPParams :: EraPParams (ShelleyLedgerEra era) => MaxAlonzoEra (ShelleyLedgerEra era) => ShelleyBasedEra era - -> ShelleyToAlonzoPParams' era + -> ShelleyToAlonzoPParams era -> Ledger.PParamsUpdate (ShelleyLedgerEra era) -createDeprecatedAfterAlonzoPParams _ (ShelleyToAlonzoPParams' extraEntropy decentralization) = +createDeprecatedAfterAlonzoPParams _ (ShelleyToAlonzoPParams extraEntropy decentralization) = Ledger.emptyPParamsUpdate & Ledger.ppuExtraEntropyL .~ extraEntropy & Ledger.ppuDL .~ decentralization diff --git a/cardano-api/src/Cardano/Api/Shelley.hs b/cardano-api/src/Cardano/Api/Shelley.hs index 43327d5648..e2ffc024aa 100644 --- a/cardano-api/src/Cardano/Api/Shelley.hs +++ b/cardano-api/src/Cardano/Api/Shelley.hs @@ -115,7 +115,7 @@ module Cardano.Api.Shelley CommonProtocolParametersUpdate(..), AlonzoOnwardsPParams(..), DeprecatedAfterMaryPParams(..), - ShelleyToAlonzoPParams'(..), + ShelleyToAlonzoPParams(..), IntroducedInBabbagePParams(..), IntroducedInConwayPParams(..), createEraBasedProtocolParamUpdate,