Skip to content

Commit d8885e5

Browse files
committed
Remove explicit FromJSON, ToJSON instances for ShelleyPParams
in favour of the ones defined for `EraPParams`
1 parent 0aae025 commit d8885e5

File tree

1 file changed

+0
-83
lines changed
  • eras/shelley/impl/src/Cardano/Ledger/Shelley

1 file changed

+0
-83
lines changed

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

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,8 @@ import Cardano.Ledger.Shelley.Era (ShelleyEra)
8181
import Cardano.Ledger.Slot (EpochNo (..), SlotNo (..))
8282
import Control.DeepSeq (NFData)
8383
import Data.Aeson (
84-
FromJSON (..),
8584
Key,
86-
KeyValue,
8785
ToJSON (..),
88-
object,
89-
pairs,
90-
(.:),
91-
(.=),
9286
)
9387
import qualified Data.Aeson as Aeson
9488
import Data.Functor.Identity (Identity)
@@ -199,49 +193,6 @@ instance EraPParams ShelleyEra where
199193

200194
eraPParams = shelleyPParams
201195

202-
instance
203-
( EraPParams era
204-
, PParamsHKD Identity era ~ ShelleyPParams Identity era
205-
, ProtVerAtMost era 4
206-
, ProtVerAtMost era 6
207-
, ProtVerAtMost era 8
208-
) =>
209-
ToJSON (ShelleyPParams Identity era)
210-
where
211-
toJSON = object . shelleyPParamsPairs
212-
toEncoding = pairs . mconcat . shelleyPParamsPairs
213-
214-
shelleyPParamsPairs ::
215-
forall era a e.
216-
(EraPParams era, ProtVerAtMost era 4, ProtVerAtMost era 6, ProtVerAtMost era 8, KeyValue e a) =>
217-
PParamsHKD Identity era ->
218-
[a]
219-
shelleyPParamsPairs pp =
220-
uncurry (.=)
221-
<$> shelleyPParamsHKDPairs (Proxy @Identity) pp
222-
223-
instance FromJSON (ShelleyPParams Identity era) where
224-
parseJSON =
225-
Aeson.withObject "ShelleyPParams" $ \obj -> do
226-
ShelleyPParams
227-
<$> obj .: "txFeePerByte"
228-
<*> obj .: "txFeeFixed"
229-
<*> obj .: "maxBlockBodySize"
230-
<*> obj .: "maxTxSize"
231-
<*> obj .: "maxBlockHeaderSize"
232-
<*> obj .: "stakeAddressDeposit"
233-
<*> obj .: "stakePoolDeposit"
234-
<*> obj .: "poolRetireMaxEpoch"
235-
<*> obj .: "stakePoolTargetNum"
236-
<*> obj .: "poolPledgeInfluence"
237-
<*> obj .: "monetaryExpansion"
238-
<*> obj .: "treasuryCut"
239-
<*> obj .: "decentralization"
240-
<*> obj .: "extraPraosEntropy"
241-
<*> obj .: "protocolVersion"
242-
<*> obj .: "minUTxOValue"
243-
<*> obj .: "minPoolCost"
244-
245196
emptyShelleyPParams :: forall era. Era era => ShelleyPParams Identity era
246197
emptyShelleyPParams =
247198
ShelleyPParams
@@ -316,40 +267,6 @@ instance NoThunks PPUpdateEnv
316267

317268
{-# DEPRECATED PPUpdateEnv "As unused" #-}
318269

319-
instance
320-
( EraPParams era
321-
, PParamsHKD StrictMaybe era ~ ShelleyPParams StrictMaybe era
322-
, ProtVerAtMost era 4
323-
, ProtVerAtMost era 6
324-
, ProtVerAtMost era 8
325-
) =>
326-
ToJSON (ShelleyPParams StrictMaybe era)
327-
where
328-
toJSON = object . shelleyPParamsUpdatePairs
329-
toEncoding = pairs . mconcat . shelleyPParamsUpdatePairs
330-
331-
shelleyPParamsUpdatePairs ::
332-
forall era a e.
333-
(EraPParams era, ProtVerAtMost era 4, ProtVerAtMost era 6, ProtVerAtMost era 8, KeyValue e a) =>
334-
PParamsHKD StrictMaybe era ->
335-
[a]
336-
shelleyPParamsUpdatePairs pp =
337-
[ k .= v
338-
| (k, SJust v) <- shelleyPParamsHKDPairs (Proxy @StrictMaybe) pp
339-
]
340-
341-
shelleyPParamsHKDPairs ::
342-
forall f era.
343-
(HKDFunctor f, EraPParams era, ProtVerAtMost era 4, ProtVerAtMost era 6, ProtVerAtMost era 8) =>
344-
Proxy f ->
345-
PParamsHKD f era ->
346-
[(Key, HKD f Aeson.Value)]
347-
shelleyPParamsHKDPairs px pp =
348-
shelleyCommonPParamsHKDPairs px pp
349-
++ shelleyCommonPParamsHKDPairsV6 px pp
350-
++ shelleyCommonPParamsHKDPairsV8 px pp
351-
++ [("minUTxOValue", hkdMap px (toJSON @Coin) (pp ^. hkdMinUTxOValueL @era @f))]
352-
353270
-- | These are the fields that are common only up to major protocol version 6
354271
shelleyCommonPParamsHKDPairsV6 ::
355272
forall f era.

0 commit comments

Comments
 (0)