Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[performance] wallet update #8231

Closed
wants to merge 1 commit into from

Conversation

yenda
Copy link
Contributor

@yenda yenda commented May 18, 2019

Summary

a few files are moved around because of circular dependencies, this continues migration of wallet and ethereum code into their own module (previous in ui.screens.wallet and utils.ethereums respectively)

wallet-autoconfig-token is a very expensive call on mainnet
because it checks the balance of every known token.

it is called:

  • when wallet is refreshed by pulling
  • when user goes on any wallet screen

this PR changes that by:

  • calling it only when the wallet is initialized and there is no
    visible-token configuration

it only calls update-wallet when a new transaction arrives

Testing

I made the following experiment on Android:

  • use mobile data and disable sync to reduce the noise from whisper
  • recover satoshi document engage inflict goddess auction rule unfair bid next buddy shy
  • go on ropsten network
  • clear history in GlassWire (https://play.google.com/store/apps/details?id=com.glasswire.android&hl=en&rdid=com.glasswire.android&pli=1)
  • restart app
  • go to wallet history, check transaction details of first transaction, go back to wallet, pull to refresh, go to chat, kill app
  • reopen app, go to transaction history, wait 2 minutes, pull to refresh, kill app
  • switch 5 times between wallet and chat and wallet and transaction history

develop: 2.9mb
PR: 1.9 mb

The difference will be even bigger once persistence is added, the difference is already nice considering the PR pulls both transaction and token transfer history, and does it again everytime it misses a block. With transaction history this number will be very low.
status: ready

@yenda yenda requested review from antdanchenko, churik, jakubgs and a team as code owners May 18, 2019 12:42
@status-github-bot
Copy link

status-github-bot bot commented May 18, 2019

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?

@yenda yenda requested review from flexsurfer and vitvly May 18, 2019 12:42
@yenda yenda self-assigned this May 18, 2019
@yenda yenda changed the base branch from develop to meta/wallet-transaction-history May 18, 2019 12:42
@yenda yenda changed the base branch from meta/wallet-transaction-history to refactor/transaction-history May 18, 2019 12:45
@yenda yenda changed the base branch from refactor/transaction-history to develop May 18, 2019 12:46
@yenda yenda changed the base branch from develop to refactor/transaction-history May 18, 2019 12:47
@status-im-auto
Copy link
Member

status-im-auto commented May 18, 2019

Jenkins Builds

Click to see older builds (18)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 028c90d #5 2019-05-18 13:05:32 ~17 min macos 📦 dmg
✔️ 028c90d #5 2019-05-18 13:05:37 ~17 min android 📦 apk
✔️ 028c90d #5 2019-05-18 13:06:16 ~18 min windows 📦 exe
✔️ 028c90d #5 2019-05-18 13:06:27 ~18 min linux 📦 App
✔️ 028c90d #5 2019-05-18 13:12:10 ~24 min ios 📦 ipa
✔️ 028c90d #5 2019-05-18 13:13:43 ~25 min android-e2e 📦 apk
8771a01 #6 2019-05-18 16:16:15 ~5 min ios 📄 log
8771a01 #6 2019-05-18 16:16:55 ~6 min macos 📄 log
8771a01 #6 2019-05-18 16:17:06 ~6 min linux 📄 log
8771a01 #6 2019-05-18 16:18:20 ~7 min windows 📄 log
8771a01 #6 2019-05-18 16:19:13 ~8 min android-e2e 📄 log
8771a01 #6 2019-05-18 16:21:54 ~11 min android 📄 log
✔️ e7f0482 #7 2019-05-18 18:40:51 ~15 min android-e2e 📦 apk
✔️ e7f0482 #7 2019-05-18 18:40:59 ~16 min linux 📦 App
✔️ e7f0482 #7 2019-05-18 18:44:37 ~19 min macos 📦 dmg
✔️ e7f0482 #7 2019-05-18 18:45:17 ~20 min android 📦 apk
✔️ e7f0482 #7 2019-05-18 18:47:44 ~22 min ios 📦 ipa
✔️ e7f0482 #7 2019-05-18 18:48:05 ~23 min windows 📦 exe
Commit #️⃣ Finished (UTC) Duration Platform Result
281ee48 #8 2019-05-20 13:05:36 ~16 min ios 📄 log
281ee48 #8 2019-05-20 13:05:45 ~17 min macos 📄 log
281ee48 #8 2019-05-20 13:16:39 ~27 min android-e2e 📄 log
281ee48 #8 2019-05-20 13:18:14 ~29 min android 📄 log
281ee48 #8 2019-05-20 13:21:13 ~32 min linux 📄 log
281ee48 #8 2019-05-20 13:25:38 ~36 min windows 📄 log
✔️ 1cd5d69 #9 2019-05-20 14:04:53 ~30 min ios 📦 ipa
✔️ 1cd5d69 #9 2019-05-20 14:06:05 ~31 min macos 📦 dmg
✔️ 1cd5d69 #9 2019-05-20 14:13:53 ~39 min windows 📦 exe
✔️ 1cd5d69 #9 2019-05-20 14:16:35 ~41 min android 📦 apk
✔️ 1cd5d69 #9 2019-05-20 14:18:56 ~44 min android-e2e 📦 apk
✔️ 1cd5d69 #9 2019-05-20 14:19:58 ~45 min linux 📦 App

@yenda
Copy link
Contributor Author

yenda commented May 18, 2019

@hesterbruikman could you check out this PR it should improve your wallet experience problems

:rinkeby #{:MOKSHA :KDO}
:xdai #{}
:poa #{}}}})
:wallet {:visible-tokens {}}})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flexsurfer I don't understand why we used to force these default tokens on the user, when visible-tokens is empty the wallet autoconfigures and adds the tokens for which the user has a balance.

Copy link
Contributor

@dmitryn dmitryn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason to have re-frame events prepended with :TODO.remove like :TODO.remove/update-estimated-gas and TODO.remove/update-wallet?

Not sure is it used somewhere or not.

UPD: nevermind, i see it's being removed in another PR https://github.com/status-im/status-react/pull/8232/files

@yenda
Copy link
Contributor Author

yenda commented May 20, 2019

@dmitryn it is used in some places that are doing things wrong, but that I don't want to touch yet as the scope of these PRs is already big enough. It's to make sure it is obvious that this is not the way to do things

@yenda yenda force-pushed the refactor/transaction-history branch from e5bbc7b to a62440e Compare May 20, 2019 15:07
`wallet-autoconfig-token` is a very expensive call on mainnet
because it checks the balance of every known token.

it is called:
- when wallet is refreshed by pulling
- when user goes on any wallet screen

this PR changes that by:
- calling it only when the wallet is initialized and there is no
visible-token configuration

it only calls update-wallet when a new transaction arrives
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants