cardano-foundation / cardano-wallet

HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
Apache License 2.0
771 stars 216 forks source link

BYRON_RESTORE_01 #2565

Closed jonathanknowles closed 1 year ago

jonathanknowles commented 3 years ago

Context

https://hydra.iohk.io/build/5803003/nixlog/1/tail

Test Case

BYRON_RESTORE_01

    describe "BYRON_RESTORE_01, GET_01, LIST_01 - Restore a wallet" $ do
        let scenarioSuccess style mnemonic ctx = runResourceT $ do
                let name = "Empty Byron Wallet"
                let payload = Json [json| {
                        "name": #{name},
                        "mnemonic_sentence": #{mnemonic},
                        "passphrase": #{fixturePassphrase},
                        "style": #{style}
                    }|]
                let discovery =
                        if style == "random"
                        then DiscoveryRandom
                        else DiscoverySequential
                let expectations =
                            [ expectField (#name . #getApiT . #getWalletName) (`shouldBe` name)
                            , expectField (#balance . #available) (`shouldBe` Quantity 0)
                            , expectField (#balance . #total) (`shouldBe` Quantity 0)
                            , expectField #passphrase (`shouldNotBe` Nothing)
                            , expectField #discovery (`shouldBe` discovery)
                            ]
                -- create
                r <- postByronWallet ctx payload
                liftIO $ verify r expectations
                let w = getFromResponse id r

                eventually "wallet is available and ready" $ do
                    -- get
                    rg <- request @ApiByronWallet ctx
                        (Link.getWallet @'Byron w) Default Empty
                    liftIO $ verify rg $
                        (expectField (#state . #getApiT) (`shouldBe` Ready)) : expectations
                    -- list
                    let wid = getFromResponse walletId rg
                    rl <- listFilteredByronWallets (Set.singleton wid) ctx
                    verify rl
                        [ expectResponseCode HTTP.status200
                        , expectListSize 1
                        , expectListField 0
                                (#name . #getApiT . #getWalletName) (`shouldBe` name)
                        , expectListField 0
                                (#balance . #available) (`shouldBe` Quantity 0)
                        , expectListField 0
                                (#state . #getApiT) (`shouldBe` Ready)
                        , expectListField 0
                                (#balance . #total) (`shouldBe` Quantity 0)
                        ]

Failure / Counter-example

Failures:

  src/Test/Integration/Scenario/API/Byron/Wallets.hs:187:59: 
  1) API Specifications, BYRON_WALLETS, BYRON_RESTORE_01, GET_01, LIST_01 - Restore a wallet, ledger 21 words
       While verifying (Status {statusCode = 200, statusMessage = "OK"},Right (ApiByronWallet {id = ApiT {getApiT = WalletId {getWalletId = 2a134a92288ed17a010d125d235737638a9cb7bd}}, balance = ApiByronWalletBalance {available = Quantity {getQuantity = 0}, total = Quantity {getQuantity = 0}}, assets = ApiWalletAssetsBalance {available = ApiT {getApiT = TokenMap (fromList [])}, total = ApiT {getApiT = TokenMap (fromList [])}}, discovery = DiscoverySequential, name = ApiT {getApiT = WalletName {getWalletName = "Empty Byron Wallet"}}, passphrase = Just (ApiWalletPassphraseInfo {lastUpdatedAt = 2021-03-15 10:09:52.583746751 UTC}), state = ApiT {getApiT = Syncing (Quantity {getQuantity = Percentage {getPercentage = 7447 % 10000}})}, tip = ApiBlockReference {absoluteSlotNumber = ApiT {getApiT = SlotNo 2105}, slotId = ApiSlotId {epochNumber = ApiT {getApiT = EpochNo {unEpochNo = 42}}, slotNumber = ApiT {getApiT = SlotInEpoch {unSlotInEpoch = 5}}}, time = 2021-03-15 10:07:29 UTC, block = ApiBlockInfo {height = Quantity {getQuantity = 1000}}}}))
       Waited longer than 90s to resolve action: "wallet is available and ready".
       expected: Ready
        but got: Syncing (Quantity {getQuantity = Percentage {getPercentage = 7447 % 10000}})

  To rerun use: --match "/API Specifications/BYRON_WALLETS/BYRON_RESTORE_01, GET_01, LIST_01 - Restore a wallet/ledger 21 words/"

Randomized with seed 1814347381

Resolution


QA

Anviking commented 3 years ago

There can't really be any race-conditions here — I think the wallet simply is overloaded and can't keep up.

Anviking commented 3 years ago

Logs of past failures: 2565.zip

Looking for db-busy warnings: didn't find that many.

Although before the logging rework, they wouldn't have been visible.

for f in *.log; echo $f (cat $f | grep "No more logs until it finishes" | wc -l); end;                                                                                                                                                                 13919.log        0
13941.log        0
14006.log       15
5803003.log        0
5831764.log        0
5873202.log        0
6163056.log       25
6235418.log        0
6298068.log       25
Anviking commented 3 years ago

2565.zip

Using ./scripts/bors-stats.rb download-logs --tag "#2565" --after "25 Mar" to fetch logs from after the rework: I think it looks like there are "SQLITE_BUSY" errors right before each failure.

Skärmavbild 2021-06-15 kl  13 05 03
Anviking commented 1 year ago

Not a prominent problem. Unclear whether a problem at all still. Closing.