Skip to content

Commit 46d4dbf

Browse files
committed
Remove explicit EncCBOR, ToCBOR instances for ShelleyPParams
in favour of the ones defined for `EraPParams`
1 parent 1056600 commit 46d4dbf

File tree

1 file changed

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

1 file changed

+0
-62
lines changed

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

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ import Cardano.Ledger.BaseTypes (
6363
StrictMaybe (..),
6464
UnitInterval,
6565
invalidKey,
66-
strictMaybeToMaybe,
6766
succVersion,
6867
)
6968
import Cardano.Ledger.Binary (
@@ -75,8 +74,6 @@ import Cardano.Ledger.Binary (
7574
decodeRecordNamed,
7675
decodeWord,
7776
encodeListLen,
78-
encodeMapLen,
79-
encodeWord,
8077
)
8178
import Cardano.Ledger.Binary.Coders (Decode (From, RecD), decode, (<!))
8279
import Cardano.Ledger.Coin (Coin (..))
@@ -99,12 +96,10 @@ import Data.Aeson (
9996
(.=),
10097
)
10198
import qualified Data.Aeson as Aeson
102-
import Data.Foldable (fold)
10399
import Data.Functor.Identity (Identity)
104100
import Data.List (nub)
105101
import Data.Map.Strict (Map)
106102
import qualified Data.Map.Strict as Map
107-
import Data.Maybe (mapMaybe)
108103
import Data.Proxy
109104
import Data.Void
110105
import Data.Word (Word16, Word32)
@@ -210,28 +205,6 @@ instance EraPParams ShelleyEra where
210205

211206
eraPParams = shelleyPParams
212207

213-
instance Era era => EncCBOR (ShelleyPParams Identity era) where
214-
encCBOR
215-
ShelleyPParams {..} =
216-
encodeListLen 17
217-
<> encCBOR sppMinFeeA
218-
<> encCBOR sppMinFeeB
219-
<> encCBOR sppMaxBBSize
220-
<> encCBOR sppMaxTxSize
221-
<> encCBOR sppMaxBHSize
222-
<> encCBOR sppKeyDeposit
223-
<> encCBOR sppPoolDeposit
224-
<> encCBOR sppEMax
225-
<> encCBOR sppNOpt
226-
<> encCBOR sppA0
227-
<> encCBOR sppRho
228-
<> encCBOR sppTau
229-
<> encCBOR sppD
230-
<> encCBOR sppExtraEntropy
231-
<> encCBOR sppProtocolVersion
232-
<> encCBOR sppMinUTxOValue
233-
<> encCBOR sppMinPoolCost
234-
235208
instance Era era => DecCBOR (ShelleyPParams Identity era) where
236209
decCBOR = do
237210
decodeRecordNamed "ShelleyPParams" (const 17) $
@@ -254,9 +227,6 @@ instance Era era => DecCBOR (ShelleyPParams Identity era) where
254227
<*> decCBOR -- sppMinUTxOValue :: Natural
255228
<*> decCBOR -- sppMinPoolCost :: Natural
256229

257-
instance Era era => ToCBOR (ShelleyPParams Identity era) where
258-
toCBOR = toEraCBOR @era
259-
260230
instance Era era => FromCBOR (ShelleyPParams Identity era) where
261231
fromCBOR = fromEraCBOR @era
262232

@@ -376,35 +346,6 @@ data PPUpdateEnv = PPUpdateEnv SlotNo GenDelegs
376346
instance NoThunks PPUpdateEnv
377347

378348
{-# DEPRECATED PPUpdateEnv "As unused" #-}
379-
380-
instance Era era => EncCBOR (ShelleyPParams StrictMaybe era) where
381-
encCBOR ppup =
382-
let l =
383-
mapMaybe
384-
strictMaybeToMaybe
385-
[ encodeMapElement 0 encCBOR =<< sppMinFeeA ppup
386-
, encodeMapElement 1 encCBOR =<< sppMinFeeB ppup
387-
, encodeMapElement 2 encCBOR =<< sppMaxBBSize ppup
388-
, encodeMapElement 3 encCBOR =<< sppMaxTxSize ppup
389-
, encodeMapElement 4 encCBOR =<< sppMaxBHSize ppup
390-
, encodeMapElement 5 encCBOR =<< sppKeyDeposit ppup
391-
, encodeMapElement 6 encCBOR =<< sppPoolDeposit ppup
392-
, encodeMapElement 7 encCBOR =<< sppEMax ppup
393-
, encodeMapElement 8 encCBOR =<< sppNOpt ppup
394-
, encodeMapElement 9 encCBOR =<< sppA0 ppup
395-
, encodeMapElement 10 encCBOR =<< sppRho ppup
396-
, encodeMapElement 11 encCBOR =<< sppTau ppup
397-
, encodeMapElement 12 encCBOR =<< sppD ppup
398-
, encodeMapElement 13 encCBOR =<< sppExtraEntropy ppup
399-
, encodeMapElement 14 encCBOR =<< sppProtocolVersion ppup
400-
, encodeMapElement 15 encCBOR =<< sppMinUTxOValue ppup
401-
, encodeMapElement 16 encCBOR =<< sppMinPoolCost ppup
402-
]
403-
n = fromIntegral $ length l
404-
in encodeMapLen n <> fold l
405-
where
406-
encodeMapElement i encoder x = SJust (encodeWord i <> encoder x)
407-
408349
instance Era era => DecCBOR (ShelleyPParams StrictMaybe era) where
409350
decCBOR = do
410351
mapParts <-
@@ -434,9 +375,6 @@ instance Era era => DecCBOR (ShelleyPParams StrictMaybe era) where
434375
(fail $ "duplicate keys: " <> show fields)
435376
pure $ foldr ($) emptyShelleyPParamsUpdate (snd <$> mapParts)
436377

437-
instance Era era => ToCBOR (ShelleyPParams StrictMaybe era) where
438-
toCBOR = toEraCBOR @era
439-
440378
instance Era era => FromCBOR (ShelleyPParams StrictMaybe era) where
441379
fromCBOR = fromEraCBOR @era
442380

0 commit comments

Comments
 (0)