Skip to content

Commit

Permalink
Add deprecation stanzas to ProtocolParameters and functions producing…
Browse files Browse the repository at this point in the history
… them
  • Loading branch information
smelc committed May 30, 2024
1 parent f1531bc commit 2d3eddd
Showing 1 changed file with 10 additions and 2 deletions.
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 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 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 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 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 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 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 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 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 type instead of ProtocolParameters." #-}
fromConwayPParams :: BabbageEraPParams ledgerera
=> PParams ledgerera
-> ProtocolParameters
fromConwayPParams = fromBabbagePParams

{-# DEPRECATED checkProtocolParameters "Use the ledger's PParams type instead of ProtocolParameters. PParams natively enforce these checks." #-}
checkProtocolParameters :: ()
=> ShelleyBasedEra era
-> ProtocolParameters
Expand Down

0 comments on commit 2d3eddd

Please sign in to comment.