Skip to content

Commit a3ccd0f

Browse files
committed
Remove explicit DecCBOR, FromCBOR instances for ShelleyPParams
in favour of the ones defined in `EraPParams`
1 parent 8a64ca0 commit a3ccd0f

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
@@ -62,17 +62,13 @@ import Cardano.Ledger.BaseTypes (
6262
ProtVer (..),
6363
StrictMaybe (..),
6464
UnitInterval,
65-
invalidKey,
6665
succVersion,
6766
)
6867
import Cardano.Ledger.Binary (
6968
DecCBOR (..),
7069
EncCBOR (..),
7170
FromCBOR (..),
7271
ToCBOR (..),
73-
decodeMapContents,
74-
decodeRecordNamed,
75-
decodeWord,
7672
encodeListLen,
7773
)
7874
import Cardano.Ledger.Binary.Coders (Decode (From, RecD), decode, (<!))
@@ -84,7 +80,6 @@ import Cardano.Ledger.Orphans ()
8480
import Cardano.Ledger.Shelley.Era (ShelleyEra)
8581
import Cardano.Ledger.Slot (EpochNo (..), SlotNo (..))
8682
import Control.DeepSeq (NFData)
87-
import Control.Monad (unless)
8883
import Data.Aeson (
8984
FromJSON (..),
9085
Key,
@@ -97,7 +92,6 @@ import Data.Aeson (
9792
)
9893
import qualified Data.Aeson as Aeson
9994
import Data.Functor.Identity (Identity)
100-
import Data.List (nub)
10195
import Data.Map.Strict (Map)
10296
import qualified Data.Map.Strict as Map
10397
import Data.Proxy
@@ -205,31 +199,6 @@ instance EraPParams ShelleyEra where
205199

206200
eraPParams = shelleyPParams
207201

208-
instance Era era => DecCBOR (ShelleyPParams Identity era) where
209-
decCBOR = do
210-
decodeRecordNamed "ShelleyPParams" (const 17) $
211-
ShelleyPParams @Identity
212-
<$> decCBOR -- sppMinFeeA :: Integer
213-
<*> decCBOR -- sppMinFeeB :: Natural
214-
<*> decCBOR -- sppMaxBBSize :: Natural
215-
<*> decCBOR -- sppMaxTxSize :: Natural
216-
<*> decCBOR -- sppMaxBHSize :: Natural
217-
<*> decCBOR -- sppKeyDeposit :: Coin
218-
<*> decCBOR -- sppPoolDeposit :: Coin
219-
<*> decCBOR -- sppEMax :: EpochNo
220-
<*> decCBOR -- sppNOpt :: Natural
221-
<*> decCBOR -- sppA0 :: NonNegativeInterval
222-
<*> decCBOR -- sppRho :: UnitInterval
223-
<*> decCBOR -- sppTau :: UnitInterval
224-
<*> decCBOR -- sppD :: UnitInterval
225-
<*> decCBOR -- sppExtraEntropy :: Nonce
226-
<*> decCBOR -- sppProtocolVersion :: ProtVer
227-
<*> decCBOR -- sppMinUTxOValue :: Natural
228-
<*> decCBOR -- sppMinPoolCost :: Natural
229-
230-
instance Era era => FromCBOR (ShelleyPParams Identity era) where
231-
fromCBOR = fromEraCBOR @era
232-
233202
instance
234203
( EraPParams era
235204
, PParamsHKD Identity era ~ ShelleyPParams Identity era
@@ -346,37 +315,6 @@ data PPUpdateEnv = PPUpdateEnv SlotNo GenDelegs
346315
instance NoThunks PPUpdateEnv
347316

348317
{-# DEPRECATED PPUpdateEnv "As unused" #-}
349-
instance Era era => DecCBOR (ShelleyPParams StrictMaybe era) where
350-
decCBOR = do
351-
mapParts <-
352-
decodeMapContents $
353-
decodeWord >>= \case
354-
0 -> decCBOR >>= \x -> pure (0, \up -> up {sppMinFeeA = SJust x})
355-
1 -> decCBOR >>= \x -> pure (1, \up -> up {sppMinFeeB = SJust x})
356-
2 -> decCBOR >>= \x -> pure (2, \up -> up {sppMaxBBSize = SJust x})
357-
3 -> decCBOR >>= \x -> pure (3, \up -> up {sppMaxTxSize = SJust x})
358-
4 -> decCBOR >>= \x -> pure (4, \up -> up {sppMaxBHSize = SJust x})
359-
5 -> decCBOR >>= \x -> pure (5, \up -> up {sppKeyDeposit = SJust x})
360-
6 -> decCBOR >>= \x -> pure (6, \up -> up {sppPoolDeposit = SJust x})
361-
7 -> decCBOR >>= \x -> pure (7, \up -> up {sppEMax = SJust x})
362-
8 -> decCBOR >>= \x -> pure (8, \up -> up {sppNOpt = SJust x})
363-
9 -> decCBOR >>= \x -> pure (9, \up -> up {sppA0 = SJust x})
364-
10 -> decCBOR >>= \x -> pure (10, \up -> up {sppRho = SJust x})
365-
11 -> decCBOR >>= \x -> pure (11, \up -> up {sppTau = SJust x})
366-
12 -> decCBOR >>= \x -> pure (12, \up -> up {sppD = SJust x})
367-
13 -> decCBOR >>= \x -> pure (13, \up -> up {sppExtraEntropy = SJust x})
368-
14 -> decCBOR >>= \x -> pure (14, \up -> up {sppProtocolVersion = SJust x})
369-
15 -> decCBOR >>= \x -> pure (15, \up -> up {sppMinUTxOValue = SJust x})
370-
16 -> decCBOR >>= \x -> pure (16, \up -> up {sppMinPoolCost = SJust x})
371-
k -> invalidKey k
372-
let fields = fst <$> mapParts :: [Int]
373-
unless
374-
(nub fields == fields)
375-
(fail $ "duplicate keys: " <> show fields)
376-
pure $ foldr ($) emptyShelleyPParamsUpdate (snd <$> mapParts)
377-
378-
instance Era era => FromCBOR (ShelleyPParams StrictMaybe era) where
379-
fromCBOR = fromEraCBOR @era
380318

381319
instance
382320
( EraPParams era

0 commit comments

Comments
 (0)