Concordium / concordium-reference-wallet-android

Reference Android wallet for the Concordium blockchain
Apache License 2.0
12 stars 2 forks source link

Initial account still shows as pending after identity is confirmed #30

Closed td202 closed 2 years ago

td202 commented 3 years ago

Bug Description The initial account may show as pending after the identity is confirmed (and shows as such).

Steps to Reproduce

  1. Complete the identity issuance flow with Notabene.
  2. Continually check the identities page until the identity shows confirmed.

Expected Result The account should show as finalized.

Actual Result The account continues to show as pending.

Versions

jensvesti commented 3 years ago

@td202 Has this been observed on Android? I have never seen it happen.

td202 commented 3 years ago

@td202 Has this been observed on Android? I have never seen it happen.

Yes. It happened to me while testing. I will see if I can reproduce it tomorrow.

jensvesti commented 3 years ago

@td202 Thanks. When and if you manage, please provide details so we can verify and debug. It could very well be backend related.

td202 commented 2 years ago

I have not managed to reproduce this successfully.

Investigating the code, I wonder if there could be a race condition between IdentityUpdater.pollForIdentityStatus and accountUpdater.updateForAllAccounts/updateForAccount. If these can be running concurrently (which I'm not sure of) then with unlucky timing, the call to accountRepository.update(account) in IdentityUpdate.pollForIdentityStatus that marks the account as finalized could be subsequently rolled-back by AccountUpdate.saveAccounts.

jensvesti commented 2 years ago

I have not managed to reproduce this successfully.

Investigating the code, I wonder if there could be a race condition between IdentityUpdater.pollForIdentityStatus and accountUpdater.updateForAllAccounts/updateForAccount. If these can be running concurrently (which I'm not sure of) then with unlucky timing, the call to accountRepository.update(account) in IdentityUpdate.pollForIdentityStatus that marks the account as finalized could be subsequently rolled-back by AccountUpdate.saveAccounts.

Well spotted! This is very possible. The solution is not easy, but I applied a candidate fix so at least the state cannot change once finalized.

jens-concordium commented 2 years ago

I guess we just assume it's fixed so far, and then we can reopen it later if some experience it again.