@@ -57,28 +57,19 @@ import Cardano.Ledger.BaseTypes (
57
57
ProtVer (.. ),
58
58
StrictMaybe (.. ),
59
59
UnitInterval ,
60
- isSNothing ,
61
60
)
62
61
import Cardano.Ledger.Binary (
63
62
DecCBOR (.. ),
64
63
EncCBOR (.. ),
65
- Encoding ,
66
64
FromCBOR (.. ),
67
- ToCBOR (.. ),
68
65
decodeRecordNamed ,
69
- encodeListLen ,
70
66
)
71
67
import Cardano.Ledger.Binary.Coders (
72
68
Decode (.. ),
73
- Density (.. ),
74
- Encode (.. ),
75
69
Field (.. ),
76
- Wrapped (.. ),
77
70
decode ,
78
- encode ,
79
71
field ,
80
72
invalidField ,
81
- (!>) ,
82
73
)
83
74
import Cardano.Ledger.Coin (Coin (.. ))
84
75
import Cardano.Ledger.Core (EraPParams (.. ))
@@ -291,35 +282,6 @@ instance EraGov BabbageEra where
291
282
292
283
obligationGovState = const mempty
293
284
294
- instance Era era => EncCBOR (BabbagePParams Identity era ) where
295
- encCBOR BabbagePParams {.. } =
296
- encodeListLen 22
297
- <> encCBOR bppMinFeeA
298
- <> encCBOR bppMinFeeB
299
- <> encCBOR bppMaxBBSize
300
- <> encCBOR bppMaxTxSize
301
- <> encCBOR bppMaxBHSize
302
- <> encCBOR bppKeyDeposit
303
- <> encCBOR bppPoolDeposit
304
- <> encCBOR bppEMax
305
- <> encCBOR bppNOpt
306
- <> encCBOR bppA0
307
- <> encCBOR bppRho
308
- <> encCBOR bppTau
309
- <> encCBOR bppProtocolVersion
310
- <> encCBOR bppMinPoolCost
311
- <> encCBOR bppCoinsPerUTxOByte
312
- <> encCBOR bppCostModels
313
- <> encCBOR bppPrices
314
- <> encCBOR bppMaxTxExUnits
315
- <> encCBOR bppMaxBlockExUnits
316
- <> encCBOR bppMaxValSize
317
- <> encCBOR bppCollateralPercentage
318
- <> encCBOR bppMaxCollateralInputs
319
-
320
- instance Era era => ToCBOR (BabbagePParams Identity era ) where
321
- toCBOR = toEraCBOR @ era
322
-
323
285
instance Era era => DecCBOR (BabbagePParams Identity era ) where
324
286
decCBOR =
325
287
decodeRecordNamed " PParams" (const 22 ) $ do
@@ -447,50 +409,6 @@ emptyBabbagePParamsUpdate =
447
409
, bppMaxCollateralInputs = SNothing
448
410
}
449
411
450
- -- =======================================================
451
- -- A PParamsUpdate has StrictMaybe fields, we want to Sparse encode it, by
452
- -- writing only those fields where the field is (SJust x), that is the role of
453
- -- the local function (omitStrictMaybe key x)
454
-
455
- encodePParamsUpdate ::
456
- BabbagePParams StrictMaybe era ->
457
- Encode ('Closed 'Sparse) (BabbagePParams StrictMaybe era )
458
- encodePParamsUpdate ppup =
459
- Keyed BabbagePParams
460
- !> omitStrictMaybe 0 (bppMinFeeA ppup) encCBOR
461
- !> omitStrictMaybe 1 (bppMinFeeB ppup) encCBOR
462
- !> omitStrictMaybe 2 (bppMaxBBSize ppup) encCBOR
463
- !> omitStrictMaybe 3 (bppMaxTxSize ppup) encCBOR
464
- !> omitStrictMaybe 4 (bppMaxBHSize ppup) encCBOR
465
- !> omitStrictMaybe 5 (bppKeyDeposit ppup) encCBOR
466
- !> omitStrictMaybe 6 (bppPoolDeposit ppup) encCBOR
467
- !> omitStrictMaybe 7 (bppEMax ppup) encCBOR
468
- !> omitStrictMaybe 8 (bppNOpt ppup) encCBOR
469
- !> omitStrictMaybe 9 (bppA0 ppup) encCBOR
470
- !> omitStrictMaybe 10 (bppRho ppup) encCBOR
471
- !> omitStrictMaybe 11 (bppTau ppup) encCBOR
472
- !> omitStrictMaybe 14 (bppProtocolVersion ppup) encCBOR
473
- !> omitStrictMaybe 16 (bppMinPoolCost ppup) encCBOR
474
- !> omitStrictMaybe 17 (bppCoinsPerUTxOByte ppup) encCBOR
475
- !> omitStrictMaybe 18 (bppCostModels ppup) encCBOR
476
- !> omitStrictMaybe 19 (bppPrices ppup) encCBOR
477
- !> omitStrictMaybe 20 (bppMaxTxExUnits ppup) encCBOR
478
- !> omitStrictMaybe 21 (bppMaxBlockExUnits ppup) encCBOR
479
- !> omitStrictMaybe 22 (bppMaxValSize ppup) encCBOR
480
- !> omitStrictMaybe 23 (bppCollateralPercentage ppup) encCBOR
481
- !> omitStrictMaybe 24 (bppMaxCollateralInputs ppup) encCBOR
482
- where
483
- omitStrictMaybe ::
484
- Word -> StrictMaybe a -> (a -> Encoding ) -> Encode ('Closed 'Sparse) (StrictMaybe a )
485
- omitStrictMaybe key x enc = Omit isSNothing (Key key (E (enc . fromSJust) x))
486
-
487
- fromSJust :: StrictMaybe a -> a
488
- fromSJust (SJust x) = x
489
- fromSJust SNothing = error " SNothing in fromSJust. This should never happen, it is guarded by isSNothing."
490
-
491
- instance Era era => EncCBOR (BabbagePParams StrictMaybe era ) where
492
- encCBOR ppup = encode (encodePParamsUpdate ppup)
493
-
494
412
updateField :: Word -> Field (BabbagePParams StrictMaybe era )
495
413
updateField 0 = field (\ x up -> up {bppMinFeeA = SJust x}) From
496
414
updateField 1 = field (\ x up -> up {bppMinFeeB = SJust x}) From
@@ -521,9 +439,6 @@ instance Era era => DecCBOR (BabbagePParams StrictMaybe era) where
521
439
decode
522
440
(SparseKeyed " PParamsUpdate" emptyBabbagePParamsUpdate updateField [] )
523
441
524
- instance Era era => ToCBOR (BabbagePParams StrictMaybe era ) where
525
- toCBOR = toEraCBOR @ era
526
-
527
442
instance Era era => FromCBOR (BabbagePParams StrictMaybe era ) where
528
443
fromCBOR = fromEraCBOR @ era
529
444
0 commit comments