From 9e2568e8058e2e4b995363805f4381ce9976108c Mon Sep 17 00:00:00 2001 From: Johannes Lund Date: Fri, 3 Jun 2022 16:37:45 +0200 Subject: [PATCH] Hack: tweak deserialisation preference to make integration tests pass --- .../src/Cardano/Wallet/Primitive/Types/Tx.hs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/core/src/Cardano/Wallet/Primitive/Types/Tx.hs b/lib/core/src/Cardano/Wallet/Primitive/Types/Tx.hs index 5c80a9d7a51..cf24546a048 100644 --- a/lib/core/src/Cardano/Wallet/Primitive/Types/Tx.hs +++ b/lib/core/src/Cardano/Wallet/Primitive/Types/Tx.hs @@ -607,8 +607,24 @@ cardanoTxFromBytes -> ByteString -- ^ Serialised transaction -> Either DecoderError (InAnyCardanoEra Cardano.Tx) cardanoTxFromBytes maxEra bs = asum $ map snd $ filter (withinEra maxEra . fst) - [ deserialise BabbageEra Cardano.AsBabbageEra - , deserialise AlonzoEra Cardano.AsAlonzoEra + -- NOTE: Attempting to deserialise in Alonzo before Babbage is intentional. + -- + -- It seems Alonzo transactions can be deserialized as Babbage + -- transactions. This causes new-tx workflow integration tests to fail. + -- The txs are interpreted as Babbage txs right before submitting them to + -- the Alonzo-era ledger. + -- + -- This may also cause problems with our store of pending txs. + -- + -- TODO: Can we come up with a better solution? + -- - Using Alonzo txs once we're in Babbage doesn't sound good? + -- - Ideally we should set @maxEra == currentNodeEra@ argument. + -- - But we can't access currentNodeEra from PersistField instances + -- - It might be good to ensure txs in the DB also store which era they + -- correspond to. + [ deserialise AlonzoEra Cardano.AsAlonzoEra + , deserialise BabbageEra Cardano.AsBabbageEra + , deserialise MaryEra Cardano.AsMaryEra , deserialise AllegraEra Cardano.AsAllegraEra , deserialise ShelleyEra Cardano.AsShelleyEra