Skip to content

Commit

Permalink
Add decodeSignedTx for Mary
Browse files Browse the repository at this point in the history
It's not pretty, sorry.
  • Loading branch information
rvl committed Jan 12, 2021
1 parent ea84bd8 commit d17c3e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Expand Up @@ -85,7 +85,7 @@ import Network.HTTP.Types.Method
import Numeric.Natural
( Natural )
import Test.Hspec
( SpecWith, describe, pendingWith )
( SpecWith, describe )
import Test.Hspec.Expectations.Lifted
( expectationFailure, shouldBe, shouldNotBe, shouldSatisfy )
import Test.Hspec.Extra
Expand Down Expand Up @@ -963,8 +963,6 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do
wFaucet <- fixtureWallet ctx
let amtSrc = (10_000_000 :: Natural)

liftIO $ pendingWith "seems to break on Mary"

let mnemonicsSrc =
[ "nothing", "heart", "matrix", "fly", "sleep", "slogan", "tomato"
, "pulse", "what", "roof", "rail", "since", "plastic", "false", "enlist"
Expand Down Expand Up @@ -1127,7 +1125,6 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do
(`shouldBe` Quantity outChange) r''

it "TRANS_EXTERNAL_02 - Multiple Outputs Transaction - Shelley witnesses" $ \ctx -> runResourceT $ do
liftIO $ pendingWith "seems to break on Mary"
wFaucet <- fixtureWallet ctx
let amt1 = (4_000_000 :: Natural)
let amt2 = (6_000_000 :: Natural)
Expand Down Expand Up @@ -1314,7 +1311,6 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do

describe "TRANS_EXTERNAL_03 - Single Output Transaction with Byron witness" $ do
it "Byron wallet" $ \ctx -> runResourceT $ do
liftIO $ pendingWith "seems to break on Mary"

wFaucet <- fixtureRandomWallet ctx

Expand Down Expand Up @@ -1473,7 +1469,6 @@ spec = describe "SHELLEY_TRANSACTIONS" $ do

it "Icarus wallet" $ \ctx -> runResourceT $ do
-- Prepare src wIcarus wallet for external transaction
liftIO $ pendingWith "seems to break on Mary"
wFaucet <- fixtureWallet ctx

let byronMnemonics =
Expand Down
7 changes: 7 additions & 0 deletions lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs
Expand Up @@ -411,6 +411,13 @@ _decodeSignedTx era bytes = do
Left decodeErr ->
Left $ ErrDecodeSignedTxWrongPayload (T.pack $ show decodeErr)

AnyCardanoEra MaryEra ->
case Cardano.deserialiseFromCBOR (Cardano.AsTx Cardano.AsMaryEra) bytes of
Right txValid ->
pure $ sealShelleyTx fromMaryTx txValid
Left decodeErr ->
Left $ ErrDecodeSignedTxWrongPayload (T.pack $ show decodeErr)

_ ->
Left ErrDecodeSignedTxNotSupported

Expand Down

0 comments on commit d17c3e4

Please sign in to comment.