From 2d5dac4b34aa72d17eb4e7d0d9afaf69eb093740 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Tue, 8 Sep 2020 15:24:39 +0200 Subject: [PATCH 1/6] Fix wallet address pool gap limited to Word8 Although with Persistent Word32 will change the underlying type from SqlInt32 to SqlInt64, it doesn't matter for sqlite, since they all end up as INTEGER. https://www.sqlite.org/datatype3.html --- .../src/Test/Integration/Framework/TestData.hs | 11 +++++++++++ .../Integration/Scenario/API/Shelley/Wallets.hs | 13 ++++++------- lib/core/src/Cardano/Wallet/DB/Sqlite/Types.hs | 6 +++--- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/core-integration/src/Test/Integration/Framework/TestData.hs b/lib/core-integration/src/Test/Integration/Framework/TestData.hs index 54087df0601..a16cda6a9cc 100644 --- a/lib/core-integration/src/Test/Integration/Framework/TestData.hs +++ b/lib/core-integration/src/Test/Integration/Framework/TestData.hs @@ -36,6 +36,7 @@ module Test.Integration.Framework.TestData , cmdOk , versionLine , payloadWith + , payloadWith' , simplePayload , updateNamePayload , updatePassPayload @@ -89,6 +90,8 @@ import Cardano.Wallet.Version ( gitRevision, showFullVersion, version ) import Data.Text ( Text, pack, unpack ) +import Data.Word + ( Word32 ) import Numeric.Natural ( Natural ) import Test.Integration.Framework.DSL @@ -225,6 +228,14 @@ payloadWith name mnemonics = Json [json| { "passphrase": #{fixturePassphrase} } |] +payloadWith' :: Text -> [Text] -> Word32 -> Payload +payloadWith' name mnemonics gap = Json [json| { + "name": #{name}, + "mnemonic_sentence": #{mnemonics}, + "passphrase": #{fixturePassphrase}, + "address_pool_gap": #{gap} + } |] + simplePayload :: Payload simplePayload = Json [json| { "name": "Secure Wallet", diff --git a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs index 40afe5ceb37..5ccd6c35be8 100644 --- a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs +++ b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs @@ -116,6 +116,7 @@ import Test.Integration.Framework.TestData , mnemonics24 , mnemonics9 , payloadWith + , payloadWith' , polishWalletName , russianWalletName , simplePayload @@ -462,16 +463,13 @@ spec = do ) , ( show addrPoolMax , addrPoolMax - , [ expectResponseCode @IO HTTP.status201 ] + , [ expectResponseCode @IO HTTP.status201 + , expectField (#addressPoolGap . #getApiT) (`shouldBe` maxBound) + ] ) ] forM_ matrix $ \(title, addrPoolGap, expectations) -> it title $ \ctx -> do - let payload = Json [json| { - "name": "Secure Wallet", - "mnemonic_sentence": #{mnemonics24}, - "passphrase": "Secure passphrase", - "address_pool_gap": #{addrPoolGap} - } |] + let payload = payloadWith' "Secure Wallet" mnemonics24 (fromIntegral addrPoolGap) r <- request @ApiWallet ctx (Link.postWallet @'Shelley) Default payload verify r expectations @@ -525,6 +523,7 @@ spec = do r <- request @ApiWallet ctx (Link.postWallet @'Shelley) headers payload verify r expectations + it "WALLETS_GET_01 - can get wallet details" $ \ctx -> do (_, w) <- unsafeRequest @ApiWallet ctx (Link.postWallet @'Shelley) simplePayload diff --git a/lib/core/src/Cardano/Wallet/DB/Sqlite/Types.hs b/lib/core/src/Cardano/Wallet/DB/Sqlite/Types.hs index 3815bdbff26..494bbafb5cd 100644 --- a/lib/core/src/Cardano/Wallet/DB/Sqlite/Types.hs +++ b/lib/core/src/Cardano/Wallet/DB/Sqlite/Types.hs @@ -80,7 +80,7 @@ import Data.Text.Class import Data.Text.Encoding ( decodeUtf8, encodeUtf8 ) import Data.Word - ( Word32, Word64, Word8 ) + ( Word32, Word64 ) import Data.Word.Odd ( Word31 ) import Database.Persist.Sqlite @@ -393,12 +393,12 @@ instance PersistField AddressPoolGap where toPersistValue = toPersistValue . getAddressPoolGap fromPersistValue pv = fromPersistValue >=> mkAddressPoolGap' $ pv where - mkAddressPoolGap' :: Word8 -> Either Text AddressPoolGap + mkAddressPoolGap' :: Word32 -> Either Text AddressPoolGap mkAddressPoolGap' = first msg . mkAddressPoolGap . fromIntegral msg e = T.pack $ "not a valid value: " <> show pv <> ": " <> show e instance PersistFieldSql AddressPoolGap where - sqlType _ = sqlType (Proxy @Word8) + sqlType _ = sqlType (Proxy @Word32) ---------------------------------------------------------------------------- -- AccountingStyle From 9b94966ce4f1e6777aa12b1da7f2ce89bc68d05e Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Wed, 9 Sep 2020 10:34:50 +0200 Subject: [PATCH 2/6] Also test listing addresses shows correct number --- .../src/Test/Integration/Scenario/API/Shelley/Wallets.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs index 5ccd6c35be8..df792f455f2 100644 --- a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs +++ b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs @@ -470,8 +470,11 @@ spec = do ] forM_ matrix $ \(title, addrPoolGap, expectations) -> it title $ \ctx -> do let payload = payloadWith' "Secure Wallet" mnemonics24 (fromIntegral addrPoolGap) - r <- request @ApiWallet ctx (Link.postWallet @'Shelley) Default payload + r@(_, Right wallet) <- request @ApiWallet ctx (Link.postWallet @'Shelley) Default payload verify r expectations + addrs <- listAddresses @n ctx wallet + length addrs `shouldBe` addrPoolGap + it "WALLETS_CREATE_08 - default address_pool_gap" $ \ctx -> do let payload = Json [json| { From 976cf9996d86f6f6d1295423c55fa0b2e10dbf85 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Wed, 9 Sep 2020 14:15:10 +0200 Subject: [PATCH 3/6] Refactor test to use verify Co-authored-by: Matthias Benkort <5680256+KtorZ@users.noreply.github.com> --- .../Integration/Scenario/API/Shelley/Wallets.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs index df792f455f2..6d7d7b9ed60 100644 --- a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs +++ b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs @@ -28,6 +28,7 @@ import Cardano.Mnemonic ) import Cardano.Wallet.Api.Types ( AddressAmount (..) + , ApiAddress , ApiByronWallet , ApiCoinSelection , ApiNetworkInformation @@ -470,11 +471,13 @@ spec = do ] forM_ matrix $ \(title, addrPoolGap, expectations) -> it title $ \ctx -> do let payload = payloadWith' "Secure Wallet" mnemonics24 (fromIntegral addrPoolGap) - r@(_, Right wallet) <- request @ApiWallet ctx (Link.postWallet @'Shelley) Default payload - verify r expectations - addrs <- listAddresses @n ctx wallet - length addrs `shouldBe` addrPoolGap - + rW <- request @ApiWallet ctx (Link.postWallet @'Shelley) Default payload + verify rW expectations + rA <- request @[ApiAddress n] ctx + (Link.listAddresses @'Shelley (getFromResponse id rW)) Default Empty + verify rA + [ expectListSize addrPoolGap + ] it "WALLETS_CREATE_08 - default address_pool_gap" $ \ctx -> do let payload = Json [json| { From 5f274e6f48e9e88e205786dc734709eac6a008e3 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Wed, 9 Sep 2020 15:29:07 +0200 Subject: [PATCH 4/6] extend post-restoration benchmark wallet overview with number of addresses and transactions We had only the UTxO, which gave little clarity about how many addresses and transactions did that correspond to. In practice, they're of the same order of magnitude, but it's good to have the actual number. --- lib/shelley/bench/Restore.hs | 103 ++++++++++++++++++++++++++--------- 1 file changed, 78 insertions(+), 25 deletions(-) diff --git a/lib/shelley/bench/Restore.hs b/lib/shelley/bench/Restore.hs index 83fbc56a4d1..6f65e9ec36f 100644 --- a/lib/shelley/bench/Restore.hs +++ b/lib/shelley/bench/Restore.hs @@ -1,6 +1,5 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} @@ -103,6 +102,7 @@ import Cardano.Wallet.Primitive.Types , GenesisParameters (..) , NetworkParameters (..) , SlotNo (..) + , SortOrder (..) , TxOut (..) , UTxOStatistics (..) , WalletId (..) @@ -139,7 +139,7 @@ import Control.Monad.Trans.Except import Control.Tracer ( Tracer (..), traceWith ) import Data.Aeson - ( ToJSON (..), genericToJSON ) + ( ToJSON (..), genericToJSON, (.=) ) import Data.Coerce ( coerce ) import Data.Functor @@ -159,7 +159,17 @@ import Data.Text.Class import Data.Time.Clock.POSIX ( getCurrentTime, utcTimeToPOSIXSeconds ) import Fmt - ( Buildable, build, genericF, pretty, (+|), (+||), (|+), (||+) ) + ( Buildable + , blockListF' + , build + , genericF + , nameF + , pretty + , (+|) + , (+||) + , (|+) + , (||+) + ) import GHC.Generics ( Generic ) import GHC.TypeLits @@ -338,22 +348,44 @@ data SomeBenchmarkResults where instance Buildable SomeBenchmarkResults where build (SomeBenchmarkResults results) = build results -data BenchRndResults s = BenchRndResults +data WalletOverview = WalletOverview + { utxo :: UTxOStatistics + , addresses :: Word + , transactions :: Word + } deriving (Show, Generic) + +instance Buildable WalletOverview where + build WalletOverview{utxo,addresses,transactions} = + blockListF' "" id + [ nameF "number of addresses" (build addresses) + , nameF "number of transactions" (build transactions) + , build utxo + ] + +instance ToJSON WalletOverview where + toJSON WalletOverview{utxo,addresses,transactions} = Aeson.object + [ "utxo" .= toApiUtxoStatistics utxo + , "addresses" .= addresses + , "transactions" .= transactions + ] + +data BenchRndResults = BenchRndResults { benchName :: Text , restoreTime :: Time , readWalletTime :: Time , listAddressesTime :: Time + , listTransactionsTime :: Time , importOneAddressTime :: Time , importManyAddressesTime :: Time , estimateFeesTime :: Time - , utxoStatistics :: s - } deriving (Show, Generic, Functor) + , walletOverview :: WalletOverview + } deriving (Show, Generic) -instance Buildable s => Buildable (BenchRndResults s) where +instance Buildable BenchRndResults where build = genericF -instance ToJSON (BenchRndResults UTxOStatistics) where - toJSON = genericToJSON Aeson.defaultOptions . fmap toApiUtxoStatistics +instance ToJSON BenchRndResults where + toJSON = genericToJSON Aeson.defaultOptions benchmarksRnd :: forall (n :: NetworkDiscriminant) s t k p. @@ -369,17 +401,24 @@ benchmarksRnd -> WalletId -> WalletName -> Time - -> IO (BenchRndResults UTxOStatistics) + -> IO BenchRndResults benchmarksRnd _ w wid wname restoreTime = do ((cp, pending), readWalletTime) <- bench "read wallet" $ do (cp, _, pending) <- unsafeRunExceptT $ W.readWallet w wid pure (cp, pending) - (utxoStatistics, _) <- bench "utxo statistics" $ do + (utxo, _) <- bench "utxo statistics" $ do pure $ computeUtxoStatistics log10 (totalUTxO pending cp) - (_, listAddressesTime) <- bench "list addresses" $ do - unsafeRunExceptT $ W.listAddresses w wid (const pure) + (addresses, listAddressesTime) <- bench "list addresses" + $ fmap (fromIntegral . length) + $ unsafeRunExceptT + $ W.listAddresses w wid (const pure) + + (transactions, listTransactionsTime) <- bench "list transactions" + $ fmap (fromIntegral . length) + $ unsafeRunExceptT + $ W.listTransactions @_ @s @k @t w wid Nothing Nothing Nothing Descending (_, estimateFeesTime) <- bench "estimate tx fee" $ do let out = TxOut (dummyAddress @n) (Coin 1) @@ -396,15 +435,18 @@ benchmarksRnd _ w wid wname restoreTime = do runExceptT $ withExceptT show $ W.importRandomAddresses @_ @s @k w wid manyAddresses + let walletOverview = WalletOverview{utxo,addresses,transactions} + pure BenchRndResults { benchName = getWalletName wname , restoreTime , readWalletTime , listAddressesTime + , listTransactionsTime , estimateFeesTime , importOneAddressTime , importManyAddressesTime - , utxoStatistics + , walletOverview } where genAddresses :: Int -> Wallet s -> IO [Address] @@ -415,20 +457,21 @@ benchmarksRnd _ w wid wname restoreTime = do where xprv = Byron.generateKeyFromSeed seed mempty -data BenchSeqResults s = BenchSeqResults +data BenchSeqResults = BenchSeqResults { benchName :: Text , restoreTime :: Time , readWalletTime :: Time , listAddressesTime :: Time + , listTransactionsTime :: Time , estimateFeesTime :: Time - , utxoStatistics :: s - } deriving (Show, Generic, Functor) + , walletOverview :: WalletOverview + } deriving (Show, Generic) -instance Buildable s => Buildable (BenchSeqResults s) where +instance Buildable BenchSeqResults where build = genericF -instance ToJSON (BenchSeqResults UTxOStatistics) where - toJSON = genericToJSON Aeson.defaultOptions . fmap toApiUtxoStatistics +instance ToJSON BenchSeqResults where + toJSON = genericToJSON Aeson.defaultOptions benchmarksSeq :: forall (n :: NetworkDiscriminant) s t k p. @@ -444,30 +487,40 @@ benchmarksSeq -> WalletId -> WalletName -> Time - -> IO (BenchSeqResults UTxOStatistics) + -> IO BenchSeqResults benchmarksSeq _ w wid wname restoreTime = do ((cp, pending), readWalletTime) <- bench "read wallet" $ do (cp, _, pending) <- unsafeRunExceptT $ W.readWallet w wid pure (cp, pending) - (utxoStatistics, _) <- bench "utxo statistics" $ do + (utxo, _) <- bench "utxo statistics" $ do pure $ computeUtxoStatistics log10 (totalUTxO pending cp) - (_, listAddressesTime) <- bench "list addresses" $ do - unsafeRunExceptT $ W.listAddresses w wid (const pure) + (addresses, listAddressesTime) <- bench "list addresses" + $ fmap (fromIntegral . length) + $ unsafeRunExceptT + $ W.listAddresses w wid (const pure) + + (transactions, listTransactionsTime) <- bench "list transactions" + $ fmap (fromIntegral . length) + $ unsafeRunExceptT + $ W.listTransactions @_ @s @k @t w wid Nothing Nothing Nothing Descending (_, estimateFeesTime) <- bench "estimate tx fee" $ do let out = TxOut (dummyAddress @n) (Coin 1) runExceptT $ withExceptT show $ W.estimateFeeForPayment @_ @s @t @k w wid (out :| []) (Quantity 0) Nothing + let walletOverview = WalletOverview{utxo,addresses,transactions} + pure BenchSeqResults { benchName = getWalletName wname , restoreTime , readWalletTime , listAddressesTime + , listTransactionsTime , estimateFeesTime - , utxoStatistics + , walletOverview } {-# ANN bench_restoration ("HLint: ignore Use camelCase" :: String) #-} From 6c4b1c86f3fe79c0da6219cc1dbb6c98a246700b Mon Sep 17 00:00:00 2001 From: KtorZ Date: Wed, 9 Sep 2020 15:42:26 +0200 Subject: [PATCH 5/6] do not construct dummy bootstrap witnesses but apply a correction on shelley witnesses afterwards This is slightly simpler, but it also prevent some nasty things happening with the bootstrap witnesses: the 'Ord' instances used to compare and sort bootstrap witnesses require to serialize them fully, which involve two hashes of bytestrings; when done for 50 inputs, and 100 times in a row in multiple selection this little thing start to matter quite a lot. --- .../src/Cardano/Wallet/Shelley/Transaction.hs | 83 ++++++++----------- 1 file changed, 36 insertions(+), 47 deletions(-) diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs index a211fb0b66c..3a484725fc7 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs @@ -387,17 +387,19 @@ computeTxSize networkId witTag md action cs = signed = Cardano.makeSignedTransaction wits unsigned - -- NOTE - -- When we generate dummy output, we generate them as new Shelley addresses - -- because their format is much easier to generate (can be a sequence of - -- bytes, and a straightforward header). Generating dummy Byron or Icarus - -- addresses would be nuts. So instead, we apply a small correction for each - -- output which can either slightly increase or decrease the overall size. - -- - -- When change are Shelley addresses, the correction is null. - outputCorrection = - toInteger (length $ change cs) * perChangeCorrection + outputCorrection = sum + [ toInteger (length $ change cs) * perChangeCorrection + , toInteger (length $ inputs cs) * perInputCorrection + ] where + -- NOTE + -- When we generate dummy output, we generate them as new Shelley addresses + -- because their format is much easier to generate (can be a sequence of + -- bytes, and a straightforward header). Generating dummy Byron or Icarus + -- addresses would be nuts. So instead, we apply a small correction for each + -- output which can either slightly increase or decrease the overall size. + -- + -- When change are Shelley addresses, the correction is null. perChangeCorrection = case witTag of TxWitnessShelleyUTxO -> 0 @@ -416,6 +418,29 @@ computeTxSize networkId witTag md action cs = maxSizeOfIcarusMainAddr = 43 maxSizeOfIcarusTestAddr = 50 + -- NOTE + -- We generate dummy witnesses that are exclusively in Shelley format. + -- In Byron (or so-called bootstrap witnesses), we need to account for + -- some extra bytes due to the inclusion of: + -- + -- - The chain code + -- - Serialized address attributes (path and protocol magic) + perInputCorrection = case witTag of + TxWitnessShelleyUTxO -> + 0 + TxWitnessByronUTxO Byron | networkId == Cardano.Mainnet -> + ccLen + addrPathAttrLen + TxWitnessByronUTxO Byron -> + ccLen + addrPathAttrLen + networkMagicLen + TxWitnessByronUTxO Icarus | networkId == Cardano.Mainnet -> + ccLen + TxWitnessByronUTxO Icarus -> + ccLen + networkMagicLen + where + ccLen = 34 + addrPathAttrLen = 40 + networkMagicLen = 7 + unsigned = mkUnsignedTx maxBound cs' md wdrls certs where cs' :: CoinSelection @@ -466,7 +491,7 @@ computeTxSize networkId witTag md action cs = TxWitnessShelleyUTxO -> addrWits <> certWits TxWitnessByronUTxO{} -> - byronWits + addrWits (addrWits, certWits) = ( mconcat @@ -497,46 +522,10 @@ computeTxSize networkId witTag md action cs = where chaff = L8.pack (show ix) <> BL.fromStrict txid - -- Note that the "byron"/bootstrap witnesses are still shelley era - -- witnesses. - byronWits = map dummyWitnessUniq $ CS.inputs cs - where - dummyWitness :: BL.ByteString -> Address -> Cardano.Witness Cardano.Shelley - dummyWitness chaff addr = - Cardano.ShelleyBootstrapWitness $ SL.BootstrapWitness key sig cc padding - where - key = SL.VKey - $ fromMaybe (error "error creating dummy witness ver key") - $ rawDeserialiseVerKeyDSIGN - $ bloatChaff keyLen chaff - - sig = SignedDSIGN - $ fromMaybe (error "error creating dummy witness sig") - $ rawDeserialiseSigDSIGN - $ bloatChaff sigLen chaff - - cc = SL.ChainCode - $ bloatChaff ccLen "0" - - padding = serialize' - $ Byron.mkAttributes - $ Byron.AddrAttributes - { Byron.aaVKDerivationPath = toHDPayloadAddress addr - , Byron.aaNetworkMagic = Cardano.toByronNetworkMagic networkId - } - - dummyWitnessUniq :: (TxIn, TxOut) -> Cardano.Witness Cardano.Shelley - dummyWitnessUniq (TxIn (Hash txid) ix, TxOut addr _) = - dummyWitness chaff addr - where - chaff = L8.pack (show ix) <> BL.fromStrict txid - sigLen = sizeSigDSIGN $ Proxy @(DSIGN TPraosStandardCrypto) keyLen = sizeVerKeyDSIGN $ Proxy @(DSIGN TPraosStandardCrypto) - ccLen = 32 - bloatChaff :: Word -> BL.ByteString -> ByteString bloatChaff n = BL.toStrict . BL.take (fromIntegral n) . BL.cycle From 3e628f079a48915401f37af802677211d3c24d34 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Wed, 9 Sep 2020 16:08:25 +0200 Subject: [PATCH 6/6] adjust byron migration test assertion due to recent change The fee estimation is now slightly faster, but the approximation is slightly worse, so we end up paying a little more for byron witnesses. --- .../src/Test/Integration/Scenario/API/Byron/Migrations.hs | 7 ++++--- .../Test/Integration/Scenario/API/Shelley/Migrations.hs | 5 +++-- .../test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/core-integration/src/Test/Integration/Scenario/API/Byron/Migrations.hs b/lib/core-integration/src/Test/Integration/Scenario/API/Byron/Migrations.hs index fe41852dcd0..f4cd1c355d1 100644 --- a/lib/core-integration/src/Test/Integration/Scenario/API/Byron/Migrations.hs +++ b/lib/core-integration/src/Test/Integration/Scenario/API/Byron/Migrations.hs @@ -89,6 +89,7 @@ import qualified Cardano.Wallet.Api.Link as Link import qualified Cardano.Wallet.Api.Types as ApiTypes import qualified Data.Map.Strict as Map import qualified Network.HTTP.Types.Status as HTTP +import qualified Test.Hspec as Hspec spec :: forall n t. @@ -207,7 +208,7 @@ spec = do testAddressCycling ctx 3 testAddressCycling ctx 10 - it "BYRON_MIGRATE_01 - \ + Hspec.it "BYRON_MIGRATE_01 - \ \ migrate a big wallet requiring more than one tx" $ \ctx -> do -- NOTE -- Special mnemonic for which 200 legacy funds are attached to in the @@ -266,7 +267,7 @@ spec = do Default payloadMigrate >>= flip verify [ expectResponseCode @IO HTTP.status202 - , expectField id ((`shouldBe` 17). length) + , expectField id ((`shouldBe` 20). length) ] -- Check that funds become available in the target wallet: @@ -345,7 +346,7 @@ spec = do , expectErrorMessage (errMsg403NothingToMigrate srcId) ] - it "BYRON_MIGRATE_02 - \ + Hspec.it "BYRON_MIGRATE_02 - \ \migrating wallet with dust should fail." $ \ctx -> do -- NOTE diff --git a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Migrations.hs b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Migrations.hs index eb281e5ac45..4104d10d8ca 100644 --- a/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Migrations.hs +++ b/lib/core-integration/src/Test/Integration/Scenario/API/Shelley/Migrations.hs @@ -87,6 +87,7 @@ import qualified Cardano.Wallet.Api.Link as Link import qualified Cardano.Wallet.Api.Types as ApiTypes import qualified Data.Map.Strict as Map import qualified Network.HTTP.Types.Status as HTTP +import qualified Test.Hspec as Hspec spec :: forall n t. ( DecodeAddress n @@ -167,7 +168,7 @@ spec = do testAddressCycling 3 testAddressCycling 10 - it "SHELLEY_MIGRATE_01_big_wallet - \ + Hspec.it "SHELLEY_MIGRATE_01_big_wallet - \ \ migrate a big wallet requiring more than one tx" $ \ctx -> do -- NOTE @@ -273,7 +274,7 @@ spec = do , expectErrorMessage (errMsg403NothingToMigrate srcId) ] - it "SHELLEY_MIGRATE_02 - \ + Hspec.it "SHELLEY_MIGRATE_02 - \ \migrating wallet with dust should fail." $ \ctx -> do -- NOTE diff --git a/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs b/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs index da265ab36bd..cd6ff743fc1 100644 --- a/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs +++ b/lib/shelley/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs @@ -130,9 +130,9 @@ spec = do [(1,23),(10,16),(20,9),(30,2)] estimateMaxInputsTests @ByronKey Cardano.Mainnet - [(1,19),(10,12),(20,6),(30,0)] + [(1,16),(10,10),(20,5),(30,0)] estimateMaxInputsTests @ByronKey (Cardano.Testnet (Cardano.NetworkMagic 0)) - [(1,18),(10,12),(20,5),(30,0)] + [(1,15),(10,10),(20,4),(30,0)] estimateMaxInputsTests @IcarusKey Cardano.Mainnet [(1,19),(10,14),(20,9),(30,4)]