-
Notifications
You must be signed in to change notification settings - Fork 174
Open
Labels
DijkstraEraLedger era that will follow after ConwayLedger era that will follow after ConwayserializationAnything that affects serialization of ledger typesAnything that affects serialization of ledger types
Description
It turns out that in all places where we decode ByteString, ShortByteString or ByteArray we do not support indefinite length decoding, which is not in accordance to the CDDL specification that we provide.
We need to change these instances to start accepting indefinite length encoding starting with protocol version 12:
cardano-ledger/libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/DecCBOR.hs
Lines 348 to 368 in 8aac6e0
| instance DecCBOR BSL.ByteString where | |
| decCBOR = BSL.fromStrict <$> decCBOR | |
| {-# INLINE decCBOR #-} | |
| instance DecCBOR ShortByteString where | |
| decCBOR = do | |
| BA (Prim.ByteArray ba) <- decodeByteArray | |
| return $ SBS ba | |
| {-# INLINE decCBOR #-} | |
| instance DecCBOR ByteArray where | |
| decCBOR = decodeByteArray | |
| {-# INLINE decCBOR #-} | |
| instance DecCBOR Prim.ByteArray where | |
| decCBOR = unBA <$> decodeByteArray | |
| {-# INLINE decCBOR #-} | |
| instance DecCBOR SlicedByteArray where | |
| decCBOR = fromByteArray . unBA <$> decodeByteArray | |
| {-# INLINE decCBOR #-} |
We also need to make sure that none of the types that ByteString, ShortByteString or ByteArray rely on default implementation in decCBOR, which uses FromCBOR instance that will not have this fixed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DijkstraEraLedger era that will follow after ConwayLedger era that will follow after ConwayserializationAnything that affects serialization of ledger typesAnything that affects serialization of ledger types
Type
Projects
Status
Todo
Status
No status