Skip to content

Commit 8c2e366

Browse files
neilmayhewlehins
authored andcommitted
cardano-ledger upgrade: use modified ledger serialization API
1 parent 11cdea1 commit 8c2e366

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Ledger/Serialisation.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ encodeByronBlock blk = mconcat [
178178
-- | Inverse of 'encodeByronBlock'
179179
decodeByronBlock :: CC.EpochSlots -> Decoder s (Lazy.ByteString -> ByronBlock)
180180
decodeByronBlock epochSlots =
181-
toPlainDecoder byronProtVer $
181+
toPlainDecoder Nothing byronProtVer $
182182
flip (\bs -> mkByronBlock epochSlots
183183
. annotationBytes bs)
184184
<$> CC.decCBORABlockOrBoundary epochSlots
@@ -195,7 +195,7 @@ decodeByronBlock epochSlots =
195195
decodeByronRegularBlock :: CC.EpochSlots
196196
-> Decoder s (Lazy.ByteString -> ByronBlock)
197197
decodeByronRegularBlock epochSlots =
198-
toPlainDecoder byronProtVer $
198+
toPlainDecoder Nothing byronProtVer $
199199
flip (\bs -> mkByronBlock epochSlots
200200
. annotationBytes bs
201201
. CC.ABOBBlock)
@@ -213,7 +213,7 @@ decodeByronRegularBlock epochSlots =
213213
decodeByronBoundaryBlock :: CC.EpochSlots
214214
-> Decoder s (Lazy.ByteString -> ByronBlock)
215215
decodeByronBoundaryBlock epochSlots =
216-
toPlainDecoder byronProtVer $
216+
toPlainDecoder Nothing byronProtVer $
217217
flip (\bs -> mkByronBlock epochSlots
218218
. annotationBytes bs
219219
. CC.ABOBBoundary)
@@ -231,7 +231,7 @@ decodeByronRegularHeader ::
231231
CC.EpochSlots
232232
-> Decoder s (Lazy.ByteString -> RawHeader)
233233
decodeByronRegularHeader epochSlots =
234-
toPlainDecoder byronProtVer $
234+
toPlainDecoder Nothing byronProtVer $
235235
flip annotationBytes <$> CC.decCBORAHeader epochSlots
236236

237237
-- | Encodes a raw Byron EBB header /without/ a tag indicating whether it's a
@@ -244,7 +244,7 @@ encodeByronBoundaryHeader = toByronCBOR . CBOR.encodePreEncoded . CC.boundaryHea
244244
-- | Inverse of 'encodeByronBoundaryHeader'
245245
decodeByronBoundaryHeader :: Decoder s (Lazy.ByteString -> RawBoundaryHeader)
246246
decodeByronBoundaryHeader =
247-
toPlainDecoder byronProtVer $
247+
toPlainDecoder Nothing byronProtVer $
248248
flip annotationBytes <$> CC.decCBORABoundaryHeader
249249

250250
-- | The 'BinaryBlockInfo' of the given 'ByronBlock'.
@@ -325,7 +325,7 @@ encodeUnsizedHeader (UnsizedHeader raw _ _) = toByronCBOR $ CC.encCBORABlockOrBo
325325
decodeUnsizedHeader :: CC.EpochSlots
326326
-> Decoder s (Lazy.ByteString -> UnsizedHeader)
327327
decodeUnsizedHeader epochSlots =
328-
toPlainDecoder byronProtVer $
328+
toPlainDecoder Nothing byronProtVer $
329329
fillInByteString <$> CC.decCBORABlockOrBoundaryHdr epochSlots
330330
where
331331
fillInByteString :: CC.ABlockOrBoundaryHdr ByteSpan

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Block.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ module Ouroboros.Consensus.Shelley.Ledger.Block (
4040

4141
import qualified Cardano.Crypto.Hash as Crypto
4242
import Cardano.Ledger.Binary (Annotator (..), DecCBOR (..),
43-
EncCBOR (..), FullByteString (..), serialize,
44-
toPlainDecoder)
43+
EncCBOR (..), FullByteString (..), serialize)
4544
import qualified Cardano.Ledger.Binary.Plain as Plain
46-
import Cardano.Ledger.Core as SL (eraProtVerLow, toEraCBOR)
45+
import Cardano.Ledger.Core as SL (eraDecoder, eraProtVerLow,
46+
toEraCBOR)
47+
import qualified Cardano.Ledger.Core as SL (hashTxSeq)
4748
import Cardano.Ledger.Crypto (HASH)
48-
import qualified Cardano.Ledger.Era as SL (hashTxSeq)
4949
import qualified Cardano.Ledger.Shelley.API as SL
5050
import qualified Cardano.Protocol.TPraos.BHeader as SL
5151
import qualified Data.ByteString.Lazy as Lazy
@@ -274,7 +274,7 @@ encodeShelleyBlock = toEraCBOR @era
274274
decodeShelleyBlock ::
275275
forall proto era. ShelleyCompatible proto era
276276
=> forall s. Plain.Decoder s (Lazy.ByteString -> ShelleyBlock proto era)
277-
decodeShelleyBlock = toPlainDecoder (eraProtVerLow @era) $ (. Full) . runAnnotator <$> decCBOR
277+
decodeShelleyBlock = eraDecoder @era $ (. Full) . runAnnotator <$> decCBOR
278278

279279
shelleyBinaryBlockInfo :: forall proto era. ShelleyCompatible proto era => ShelleyBlock proto era -> BinaryBlockInfo
280280
shelleyBinaryBlockInfo blk = BinaryBlockInfo {
@@ -293,7 +293,7 @@ encodeShelleyHeader = toEraCBOR @era
293293
decodeShelleyHeader ::
294294
forall proto era. ShelleyCompatible proto era
295295
=> forall s. Plain.Decoder s (Lazy.ByteString -> Header (ShelleyBlock proto era))
296-
decodeShelleyHeader = toPlainDecoder (eraProtVerLow @era) $ (. Full) . runAnnotator <$> decCBOR
296+
decodeShelleyHeader = eraDecoder @era $ (. Full) . runAnnotator <$> decCBOR
297297

298298
{-------------------------------------------------------------------------------
299299
Condense

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module Ouroboros.Consensus.Shelley.Ledger.Mempool (
3838

3939
import qualified Cardano.Crypto.Hash as Hash
4040
import qualified Cardano.Ledger.Allegra.Rules as AllegraEra
41-
import Cardano.Ledger.Alonzo.Core (Tx, TxSeq, bodyTxL, eraProtVerLow,
41+
import Cardano.Ledger.Alonzo.Core (Tx, TxSeq, bodyTxL, eraDecoder,
4242
fromTxSeq, ppMaxBBSizeL, ppMaxBlockExUnitsL, sizeTxF)
4343
import qualified Cardano.Ledger.Alonzo.Rules as AlonzoEra
4444
import Cardano.Ledger.Alonzo.Scripts (ExUnits, ExUnits',
@@ -49,7 +49,7 @@ import qualified Cardano.Ledger.Babbage.Rules as BabbageEra
4949
import qualified Cardano.Ledger.BaseTypes as L
5050
import Cardano.Ledger.Binary (Annotator (..), DecCBOR (..),
5151
EncCBOR (..), FromCBOR (..), FullByteString (..),
52-
ToCBOR (..), toPlainDecoder)
52+
ToCBOR (..))
5353
import qualified Cardano.Ledger.Conway.Rules as ConwayEra
5454
import qualified Cardano.Ledger.Conway.Rules as SL
5555
import qualified Cardano.Ledger.Conway.UTxO as SL
@@ -199,7 +199,7 @@ instance ShelleyCompatible proto era => ToCBOR (GenTx (ShelleyBlock proto era))
199199

200200
instance ShelleyCompatible proto era => FromCBOR (GenTx (ShelleyBlock proto era)) where
201201
fromCBOR = fmap mkShelleyTx $ unwrapCBORinCBOR
202-
$ toPlainDecoder (eraProtVerLow @era) $ (. Full) . runAnnotator <$> decCBOR
202+
$ eraDecoder @era $ (. Full) . runAnnotator <$> decCBOR
203203

204204
{-------------------------------------------------------------------------------
205205
Pretty-printing

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query/PParamsLegacyEncoder.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ instance Crypto c => ToCBOR (LegacyPParams (AlonzoEra c)) where
103103

104104
instance Crypto c => FromCBOR (LegacyPParams (AlonzoEra c)) where
105105
fromCBOR =
106-
toPlainDecoder (eraProtVerLow @(AlonzoEra c)) $
106+
eraDecoder @(AlonzoEra c) $
107107
decode $
108108
RecD mkLegacyAlonzoPParams
109109
<! From -- appMinFeeA
@@ -173,7 +173,7 @@ instance Crypto c => ToCBOR (LegacyPParams (BabbageEra c)) where
173173

174174
instance Crypto c => FromCBOR (LegacyPParams (BabbageEra c)) where
175175
fromCBOR =
176-
toPlainDecoder (eraProtVerLow @(BabbageEra c)) $
176+
eraDecoder @(BabbageEra c) $
177177
decode $
178178
RecD mkLegacyBabbagePParams
179179
<! From -- bppMinFeeA

ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/KeysByron.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ instance SerialiseAsRawBytes (SigningKey ByronKey) where
146146
either (const Nothing) (Just . ByronSigningKey . Byron.SigningKey)
147147
(snd <$> CBOR.deserialiseFromBytes decCBORXPrv (LB.fromStrict bs))
148148
where
149-
decCBORXPrv = toPlainDecoder byronProtVer Byron.decCBORXPrv
149+
decCBORXPrv = toPlainDecoder Nothing byronProtVer Byron.decCBORXPrv
150150

151151

152152
newtype instance Hash ByronKey = ByronKeyHash Byron.KeyHash

ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Api/OperationalCertificate.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ instance ToCBOR OperationalCertificate where
5757
toCBOR = CBOR.toPlainEncoding CBOR.shelleyProtVer . encCBOR
5858

5959
instance FromCBOR OperationalCertificate where
60-
fromCBOR = CBOR.toPlainDecoder CBOR.shelleyProtVer decCBOR
60+
fromCBOR = CBOR.toPlainDecoder Nothing CBOR.shelleyProtVer decCBOR
6161

6262
instance ToCBOR OperationalCertificateIssueCounter where
6363
toCBOR = CBOR.toPlainEncoding CBOR.shelleyProtVer . encCBOR
6464

6565
instance FromCBOR OperationalCertificateIssueCounter where
66-
fromCBOR = CBOR.toPlainDecoder CBOR.shelleyProtVer decCBOR
66+
fromCBOR = CBOR.toPlainDecoder Nothing CBOR.shelleyProtVer decCBOR
6767

6868
instance EncCBOR OperationalCertificate where
6969
encCBOR (OperationalCertificate ocert vkey) =

0 commit comments

Comments
 (0)