Skip to content

Commit

Permalink
Hack: tweak deserialisation preference to make integration tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Jun 3, 2022
1 parent d17d047 commit 9e2568e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/core/src/Cardano/Wallet/Primitive/Types/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9e2568e

Please sign in to comment.