Concordium / concordium-reference-wallet-ios

Reference wallet for the Concordium blockchain
Apache License 2.0
11 stars 10 forks source link

Initial account ends up "failed" in iOS, but it is actually finalised on chain #37

Closed jens-concordium closed 3 years ago

jens-concordium commented 3 years ago

Bug Description

In some rare cases an initial account is perceived as failed by the iOS app, while the initial account has actually been finalised on the chain.

We have pieced together one scenario, that seemed to go like this, but some parts are assumptions:

  1. ~ 15:34 User submits identity issuance request to Notabene. The iOS mobile wallet queries the wallet proxy for the account immediately after submitting the request to Notabene, and long before the account has actually been finalised or even submitted to the chain. (EDIT: As mentioned in a below comment, the fact that the mobile wallet queries the account at this stage is not according to the agreed protocol, and should ideally be fixed as well.)
  2. Shortly after 15:34 (Assumed, not certain): Notabene submits request to Onfido to get the ID verified.
  3. Somewhere between 15:34 and 16:32:19 Onfido verifies the ID and then sometime just before 16:32:19 Notabene submits the initial account to the wallet proxy.
  4. The user / mobile wallet queries the account balance at 16:32:13, the wallet does not exist yet, as the account was not created before 16:32:19. (Regarding the timing: Maybe the user wanted to wait an hour before checking if it succeeded? )
  5. The user / mobile wallet queries the account again at 16:32:20, it does now exist (1 sec after the creation block by pure coincidence?) but it is not finalised yet.
  6. At 16:32:28 Notabene queries the initial account transaction hash to see if it finalised. It is not entirely certain what the response from the wallet proxy was, but based on the size it could be either "committed" or "finalised". It did take two blocks before the initial account was actually finalised though, which could indicate that the response Notabene got was "committed".
  7. The account balance was never queried again by the mobile wallet, so there is reason to expect that it had perceived the initial account as failed, hence removing it from the app.

This scenario might hint that Notabene's service knew that the initial account status was "committed", and returned this status to the mobile wallet, which did not know how to interpret this, and deemed the account failed. We cannot know for sure though, so this should be seen as a suggestion of what might cause the problem.

We need to investigate if this is actually the case, or if something else is causing the perceived failed initial accounts in iOS.

Steps to Reproduce There does not seem to be any certain way to reproduce this.

Expected Result The initial account should not be regarded as failed in the mobile wallet, before it is absolutely certain that it has failed.

Actual Result The initial account is regarded as failed by the mobile wallet, while it shouldn't be.

Versions

abizjak commented 3 years ago

The fact that the wallet queries the account at 15:34 is also not according to the agreed protocol, and is something that should ideally be addressed.

jens-concordium commented 3 years ago

@concordium-cl

There is not really any way to test this, but Thomas' fix may have helped. I guess we just got to keep an eye out for new reports on this.