Skip to content

Commit c95e8dd

Browse files
committed
Remove explicit FromJSON, ToJSON instances for BabbagePParams
in favour of the ones defined for `EraPParams`
1 parent f42140d commit c95e8dd

File tree

2 files changed

+0
-89
lines changed
  • eras

2 files changed

+0
-89
lines changed

eras/babbage/impl/src/Cardano/Ledger/Babbage/PParams.hs

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ module Cardano.Ledger.Babbage.PParams (
3535
encodeLangViews,
3636
coinsPerUTxOWordToCoinsPerUTxOByte,
3737
coinsPerUTxOByteToCoinsPerUTxOWord,
38-
babbagePParamsHKDPairs,
3938
babbageCommonPParamsHKDPairs,
4039
ppCoinsPerUTxOByte,
4140
) where
@@ -72,13 +71,8 @@ import Control.DeepSeq (NFData)
7271
import Data.Aeson as Aeson (
7372
FromJSON (..),
7473
Key,
75-
KeyValue ((.=)),
7674
ToJSON (..),
7775
Value,
78-
object,
79-
pairs,
80-
withObject,
81-
(.:),
8276
)
8377
import Data.Functor.Identity (Identity (..))
8478
import Data.Proxy (Proxy (Proxy))
@@ -273,48 +267,6 @@ instance EraGov BabbageEra where
273267

274268
obligationGovState = const mempty
275269

276-
instance
277-
(PParamsHKD Identity era ~ BabbagePParams Identity era, BabbageEraPParams era, ProtVerAtMost era 8) =>
278-
ToJSON (BabbagePParams Identity era)
279-
where
280-
toJSON = object . babbagePParamsPairs
281-
toEncoding = pairs . mconcat . babbagePParamsPairs
282-
283-
babbagePParamsPairs ::
284-
forall era a e.
285-
(BabbageEraPParams era, KeyValue e a, ProtVerAtMost era 8) =>
286-
PParamsHKD Identity era ->
287-
[a]
288-
babbagePParamsPairs pp =
289-
uncurry (.=) <$> babbagePParamsHKDPairs (Proxy @Identity) pp
290-
291-
instance FromJSON (BabbagePParams Identity era) where
292-
parseJSON =
293-
withObject "PParams" $ \obj ->
294-
BabbagePParams
295-
<$> obj .: "txFeePerByte"
296-
<*> obj .: "txFeeFixed"
297-
<*> obj .: "maxBlockBodySize"
298-
<*> obj .: "maxTxSize"
299-
<*> obj .: "maxBlockHeaderSize"
300-
<*> obj .: "stakeAddressDeposit"
301-
<*> obj .: "stakePoolDeposit"
302-
<*> obj .: "poolRetireMaxEpoch"
303-
<*> obj .: "stakePoolTargetNum"
304-
<*> obj .: "poolPledgeInfluence"
305-
<*> obj .: "monetaryExpansion"
306-
<*> obj .: "treasuryCut"
307-
<*> obj .: "protocolVersion"
308-
<*> obj .: "minPoolCost"
309-
<*> obj .: "utxoCostPerByte"
310-
<*> obj .: "costModels"
311-
<*> obj .: "executionUnitPrices"
312-
<*> obj .: "maxTxExecutionUnits"
313-
<*> obj .: "maxBlockExecutionUnits"
314-
<*> obj .: "maxValueSize"
315-
<*> obj .: "collateralPercentage"
316-
<*> obj .: "maxCollateralInputs"
317-
318270
-- | Returns a basic "empty" `PParams` structure with all zero values.
319271
emptyBabbagePParams :: forall era. Era era => BabbagePParams Identity era
320272
emptyBabbagePParams =
@@ -370,36 +322,6 @@ emptyBabbagePParamsUpdate =
370322
, bppMaxCollateralInputs = SNothing
371323
}
372324

373-
instance
374-
( PParamsHKD StrictMaybe era ~ BabbagePParams StrictMaybe era
375-
, BabbageEraPParams era
376-
, ProtVerAtMost era 8
377-
) =>
378-
ToJSON (BabbagePParams StrictMaybe era)
379-
where
380-
toJSON = object . babbagePParamsUpdatePairs
381-
toEncoding = pairs . mconcat . babbagePParamsUpdatePairs
382-
383-
babbagePParamsUpdatePairs ::
384-
forall era a e.
385-
(BabbageEraPParams era, KeyValue e a, ProtVerAtMost era 8) =>
386-
PParamsHKD StrictMaybe era ->
387-
[a]
388-
babbagePParamsUpdatePairs pp =
389-
[ k .= v
390-
| (k, SJust v) <- babbagePParamsHKDPairs (Proxy @StrictMaybe) pp
391-
]
392-
393-
babbagePParamsHKDPairs ::
394-
forall era f.
395-
(BabbageEraPParams era, HKDFunctor f, ProtVerAtMost era 8) =>
396-
Proxy f ->
397-
PParamsHKD f era ->
398-
[(Key, HKD f Aeson.Value)]
399-
babbagePParamsHKDPairs px pp =
400-
babbageCommonPParamsHKDPairs px pp
401-
<> shelleyCommonPParamsHKDPairsV8 px pp -- for "protocolVersion"
402-
403325
-- | These are the fields that are common across all eras starting with Babbage.
404326
babbageCommonPParamsHKDPairs ::
405327
forall era f.

eras/shelley/impl/src/Cardano/Ledger/Shelley/PParams.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module Cardano.Ledger.Shelley.PParams (
3333

3434
-- * JSON helpers
3535
shelleyCommonPParamsHKDPairs,
36-
shelleyCommonPParamsHKDPairsV8,
3736

3837
-- * PParam
3938
ppA0,
@@ -266,16 +265,6 @@ instance NoThunks PPUpdateEnv
266265

267266
{-# DEPRECATED PPUpdateEnv "As unused" #-}
268267

269-
shelleyCommonPParamsHKDPairsV8 ::
270-
forall f era.
271-
(HKDFunctor f, EraPParams era, ProtVerAtMost era 8) =>
272-
Proxy f ->
273-
PParamsHKD f era ->
274-
[(Key, HKD f Aeson.Value)]
275-
shelleyCommonPParamsHKDPairsV8 px pp =
276-
[ ("protocolVersion", hkdMap px (toJSON @ProtVer) (pp ^. hkdProtocolVersionL @era @f))
277-
]
278-
279268
-- | These are the fields that are common across all eras
280269
shelleyCommonPParamsHKDPairs ::
281270
forall f era.

0 commit comments

Comments
 (0)