Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare deprecation of ProtocolParameters #547

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions cardano-api/internal/Cardano/Api/ProtocolParameters.hs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ instance IsShelleyBasedEra era => Eq (LedgerProtocolParameters era) where
shelleyBasedEraConstraints (shelleyBasedEra @era)
$ a == b

-- TODO: Conway era - remove me when we begin relying on the JSON
-- instances of Ledger.PParams
{-# DEPRECATED convertToLedgerProtocolParameters "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters." #-}
convertToLedgerProtocolParameters
:: ShelleyBasedEra era
-> ProtocolParameters
Expand Down Expand Up @@ -465,6 +464,7 @@ createIntroducedInBabbagePParams w (IntroducedInBabbagePParams coinsPerUTxOByte)
--
-- There are also parameters fixed in the Genesis file. See 'GenesisParameters'.
--
{-# DEPRECATED ProtocolParameters "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters" #-}
data ProtocolParameters =
ProtocolParameters {

Expand Down Expand Up @@ -1669,6 +1669,7 @@ toConwayPParams = toBabbagePParams
-- Conversion functions: protocol parameters from ledger types
--

{-# DEPRECATED fromLedgerPParams "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters." #-}
fromLedgerPParams
:: ShelleyBasedEra era
-> Ledger.PParams (ShelleyLedgerEra era)
Expand All @@ -1681,6 +1682,7 @@ fromLedgerPParams ShelleyBasedEraBabbage = fromBabbagePParams
fromLedgerPParams ShelleyBasedEraConway = fromConwayPParams


{-# DEPRECATED fromShelleyCommonPParams "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters." #-}
fromShelleyCommonPParams :: EraPParams ledgerera
=> PParams ledgerera
-> ProtocolParameters
Expand Down Expand Up @@ -1714,6 +1716,7 @@ fromShelleyCommonPParams pp =
, protocolParamMinUTxOValue = Nothing -- Obsolete from Alonzo onwards
}

{-# DEPRECATED fromShelleyPParams "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters." #-}
fromShelleyPParams :: ( EraPParams ledgerera
, Ledger.AtMostEra Ledger.MaryEra ledgerera
, Ledger.AtMostEra Ledger.AlonzoEra ledgerera
Expand All @@ -1728,6 +1731,7 @@ fromShelleyPParams pp =
}


{-# DEPRECATED fromAlonzoPParams "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters." #-}
fromAlonzoPParams :: AlonzoEraPParams ledgerera
=> PParams ledgerera
-> ProtocolParameters
Expand All @@ -1743,6 +1747,7 @@ fromAlonzoPParams pp =
, protocolParamMaxCollateralInputs = Just $ pp ^. ppMaxCollateralInputsL
}

{-# DEPRECATED fromExactlyAlonzoPParams "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters." #-}
fromExactlyAlonzoPParams :: (AlonzoEraPParams ledgerera, Ledger.ExactEra Ledger.AlonzoEra ledgerera)
=> PParams ledgerera
-> ProtocolParameters
Expand All @@ -1751,6 +1756,7 @@ fromExactlyAlonzoPParams pp =
protocolParamUTxOCostPerByte = Just . unCoinPerWord $ pp ^. ppCoinsPerUTxOWordL
}

{-# DEPRECATED fromBabbagePParams "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters." #-}
fromBabbagePParams :: BabbageEraPParams ledgerera
=> PParams ledgerera
-> ProtocolParameters
Expand All @@ -1760,11 +1766,13 @@ fromBabbagePParams pp =
, protocolParamDecentralization = Nothing
}

{-# DEPRECATED fromConwayPParams "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters." #-}
fromConwayPParams :: BabbageEraPParams ledgerera
=> PParams ledgerera
-> ProtocolParameters
fromConwayPParams = fromBabbagePParams

{-# DEPRECATED checkProtocolParameters "Use the ledger's PParams (from module Cardano.Api.Ledger) type instead of ProtocolParameters. PParams natively enforce these checks." #-}
checkProtocolParameters :: ()
=> ShelleyBasedEra era
-> ProtocolParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- TODO remove me when ProtocolParameters is deleted
{-# OPTIONS_GHC -Wno-deprecations #-}

module Test.Golden.Cardano.Api.ProtocolParameters
( test_golden_ProtocolParameters
, test_golden_ProtocolParameters_to_PParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}

-- TODO remove me when ProtocolParameters is deleted
{-# OPTIONS_GHC -Wno-deprecations #-}

module Test.Cardano.Api.ProtocolParameters
( tests
) where
Expand Down
Loading