status-go: MultiAccountStoreDerived reports account already exists while RPC API doesn't

Problem

The original problem was reported at https://github.com/status-im/status-react/issues/10326 but it seems to boil down to misbehaviour in status-go.

As described in this https://github.com/status-im/status-react/issues/10326#issuecomment-615146351 adding multiaccounts (watch only) and removing them again, seems to not properly remove them from status-go cache.

While the RPC API accounts_getAccount properly returns the latest state with only the main multiaccount and the chat account being available, MultiAccountStoreDerived still emits an error that the account in question 'already exists'.

I assume https://github.com/status-im/status-go/issues/1896 and https://github.com/status-im/go-ethereum/pull/87 are related to this.

Happy to help debugging/verifying this on status-go’ side. Any pointers to make that happen are highly appreciated 😃

Implementation

Need to verify if this is really the case or of there’s something else off. Skimming through the code it looks like status-go is returning accounts from cache, so there might be an issue with accounts not being properly removed from cache.

As a matter of fact, while adding a new multi account calls into native status-go inside status-react here: https://github.com/status-im/status-react/blob/a79a72fccb27911b0caf96534a52215ba162d92b/src/status_im/native_module/core.cljs#L133-L137

and therefore here:

https://github.com/status-im/status-react/blob/a79a72fccb27911b0caf96534a52215ba162d92b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java#L744-L760

It doesn’t look like the same is happening with the account deletion:

https://github.com/status-im/status-react/blob/a79a72fccb27911b0caf96534a52215ba162d92b/src/status_im/wallet/accounts/core.cljs#L252-L265

Instead it’s going through the RPC API. Maybe that is bypassing the cache?

Just thinking out loud here, hope this is useful information.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

yeah I think the final fix would be for status-react to validate the uniqueness of an address before generating and storing the key in the filesystem.

On Tue, Apr 21, 2020, 19:27 flexsurfer notifications@github.com wrote:

so we shouldn’t allow storing account if it exists in status-react

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/status-im/status-go/issues/1939#issuecomment-617302778, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAII362FCJHGSA353Y4GLRNXJPFANCNFSM4MKVC7VQ .