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

fix(multichain): use accounts{Added,Removed} to fetch/clear balances #25884

Merged
merged 19 commits into from
Jul 19, 2024

Conversation

ccharly
Copy link
Contributor

@ccharly ccharly commented Jul 17, 2024

Description

Fixing the balances fetching that happens a bit too frequently.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/accounts-planning/issues/527

Manual testing steps

  • Use yarn start:flask
  • Enable Bitcoin support: Settings > Experimental > Bitcoin toggles
  • Create Bitcoin accounts (mainnet, testnet or both)
  • You should see your balances as usual

Extra steps:

  • You can check your Network tabs on your dev-tools and look for blockchair requests
  • You should see 1 request (for each Bitcoin accounts) upon account creation (to fetch the initial balance)
  • You should NOT see any new requests when you're adding new Ethereum/HW accounts or when selecting a new accounts (basically any changes to the AccountsController should not trigger new fetches)
  • You MIGHT see new requests after some time (around 10min, which is the average block time of Bitcoin), to refresh the balance

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@ccharly ccharly force-pushed the fix/prevent-too-many-fethes-in-BalancesController branch 2 times, most recently from 758e8a8 to b4189dc Compare July 18, 2024 08:13
@ccharly ccharly force-pushed the fix/prevent-too-many-fethes-in-BalancesController branch from b4189dc to bd3dda9 Compare July 18, 2024 08:43
@metamaskbot
Copy link
Collaborator

Builds ready [bd3dda9]
Page Load Metrics (299 ± 256 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint702921084622
domContentLoaded104823105
load441641299532256
domInteractive104823105
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.42 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [bd3dda9]
Page Load Metrics (299 ± 256 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint702921084622
domContentLoaded104823105
load441641299532256
domInteractive104823105
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.42 KiB (0.07%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 88.60759% with 9 lines in your changes missing coverage. Please review.

Project coverage is 69.69%. Comparing base (2d416bf) to head (9637c8e).
Report is 92 commits behind head on develop.

Files Patch % Lines
app/scripts/lib/accounts/BalancesController.ts 87.80% 5 Missing ⚠️
ui/store/actions.ts 0.00% 2 Missing ⚠️
app/scripts/lib/accounts/BalancesTracker.ts 96.88% 1 Missing ⚠️
...ltichain/create-btc-account/create-btc-account.tsx 66.67% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25884      +/-   ##
===========================================
- Coverage    69.77%   69.69%   -0.09%     
===========================================
  Files         1398     1401       +3     
  Lines        49165    49577     +412     
  Branches     13574    13701     +127     
===========================================
+ Hits         34304    34548     +244     
- Misses       14861    15029     +168     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [7008a68]
Page Load Metrics (63 ± 8 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6613192199
domContentLoaded85627168
load3710563188
domInteractive85627168
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.58 KiB (0.08%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@ccharly ccharly marked this pull request as ready for review July 18, 2024 11:57
@ccharly ccharly requested a review from a team as a code owner July 18, 2024 11:57
@ccharly ccharly force-pushed the fix/prevent-too-many-fethes-in-BalancesController branch from 2739b48 to 1e805b2 Compare July 18, 2024 16:54
@metamaskbot
Copy link
Collaborator

Builds ready [1e805b2]
Page Load Metrics (222 ± 228 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6812893178
domContentLoaded95326136
load481723222475228
domInteractive95326136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.66 KiB (0.08%)
  • ui: 41 Bytes (0.00%)
  • common: 240 Bytes (0.00%)

Copy link

sonarcloud bot commented Jul 19, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [9637c8e]
Page Load Metrics (174 ± 194 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint671571123015
domContentLoaded107431199
load441933174404194
domInteractive107431199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.76 KiB (0.08%)
  • ui: 117 Bytes (0.00%)
  • common: 240 Bytes (0.00%)

@ccharly ccharly merged commit 8574f94 into develop Jul 19, 2024
85 checks passed
@ccharly ccharly deleted the fix/prevent-too-many-fethes-in-BalancesController branch July 19, 2024 14:02
@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2024
@metamaskbot metamaskbot added the release-12.3.0 Issue or pull request that will be included in release 12.3.0 label Jul 19, 2024
@metamaskbot metamaskbot added release-12.2.0 Issue or pull request that will be included in release 12.2.0 and removed release-12.3.0 Issue or pull request that will be included in release 12.3.0 labels Aug 30, 2024
@metamaskbot
Copy link
Collaborator

Missing release label release-12.2.0 on PR. Adding release label release-12.2.0 on PR and removing other release labels(release-12.3.0), as PR was cherry-picked in branch 12.2.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.2.0 Issue or pull request that will be included in release 12.2.0 team-accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants