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): fix showFiat option for test assets #26224

Merged
merged 27 commits into from
Aug 1, 2024

Conversation

ccharly
Copy link
Contributor

@ccharly ccharly commented Jul 30, 2024

Description

Since the introduction of the new Bitcoin accounts in the account-list-menu, we introduced a regression regarding the "Show conversion in testnets" flag (for both Bitcoin and Ethereum accounts).

This PR fixes that.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. yarn start:flask
  2. Enable Bitcoin support (Settings > Experimental > Enable "Add a new Bitcoin*" flags
  3. Creates mainnet + testnet Bitcoin accounts
  4. Check that the "Show conversion in tesnets" flag is off
  5. Open the account menu list (click the header top bar, on the currently selected account)
  6. You should not see any USD prices except for mainnet accounts (you must be on a mainnet EVM networks to see that for your EVM account)
  7. Enables "Show conversion in tesnets" flag
  8. Repeat step 5
  9. You should now see USD prices also for testnet accounts/test assets

Screenshots/Recordings

Before

SCR-20240730-mjje
SCR-20240730-mjme

After

SCR-20240730-mnlq

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.

@ccharly ccharly self-assigned this Jul 30, 2024
@ccharly ccharly requested a review from a team as a code owner July 30, 2024 12:04
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.

@metamaskbot
Copy link
Collaborator

Builds ready [3631381]
Page Load Metrics (199 ± 202 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6812489199
domContentLoaded95521147
load401467199420202
domInteractive95521157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: -190 Bytes (-0.00%)
  • common: 410 Bytes (0.01%)

@ccharly ccharly requested a review from a team as a code owner July 31, 2024 14:54
@ccharly ccharly force-pushed the fix/show-fiat-for-test-assets branch from edfb49b to ef336a0 Compare July 31, 2024 15:10
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.96%. Comparing base (cd30d78) to head (24e70a6).
Report is 27 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26224      +/-   ##
===========================================
+ Coverage    69.96%   69.96%   +0.01%     
===========================================
  Files         1410     1411       +1     
  Lines        49915    49990      +75     
  Branches     13802    13806       +4     
===========================================
+ Hits         34919    34975      +56     
- Misses       14996    15015      +19     

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

@metamaskbot
Copy link
Collaborator

Builds ready [bdbdc12]
Page Load Metrics (173 ± 173 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint702841264722
domContentLoaded10139363115
load411737173361173
domInteractive10139363115
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: -117 Bytes (-0.00%)
  • common: 356 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [05dacfc]
Page Load Metrics (205 ± 200 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint633231095325
domContentLoaded96620147
load411486205417200
domInteractive96620147
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: -117 Bytes (-0.00%)
  • common: 452 Bytes (0.01%)

@@ -354,17 +354,17 @@ exports[`Connect More Accounts Modal should render correctly 1`] = `
<div
class="mm-box currency-display-component mm-box--display-flex mm-box--flex-wrap-wrap mm-box--align-items-center"
data-testid="first-currency-display"
title="$0.00 USD"
title="0 ETH"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume this snapshot was wrong for quite some time now.

The providerConfig on mock-state.json here is 0x5 (goerli), which is a testnet.

Test assets/accounts should not show any fiat values unless showFiatInTestnets is set to true (but it's currently false here)

You will see a bunch of snapshots changes in this PR, because of this ⬆️.

@@ -293,17 +293,17 @@ exports[`Connections Content should render correctly 1`] = `
<div
class="mm-box currency-display-component mm-box--display-flex mm-box--flex-wrap-wrap mm-box--align-items-center"
data-testid="first-currency-display"
title="$880.18 USD"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not track why the fiat balance was actually this low in the original snapshot.

However, based on this account's balance, the actual balance should be:

0x346ba7725f412cbfdb # Hex (WEI)

# Convert to decimal
966987986469506500000 # Decimal (WEI)

# Convert to ETH
966.9879864695065 # Decimal (ETH)

So here again, I guess the snapshot was wrong too. Also, the same comment applies here, so no more fiat.

shared/constants/network.ts Outdated Show resolved Hide resolved
@danroc
Copy link
Contributor

danroc commented Aug 1, 2024

image

I think we shouldn't truncate the unit, WDYT?

@ccharly
Copy link
Contributor Author

ccharly commented Aug 1, 2024

I think we should not truncate no, but that's not something new, it seems to behave the same for Ethereum:

Screenshot 2024-08-01 at 11 00 27

So I believe it should be fixed separately, is that ok for you?

ui/selectors/multichain.ts Outdated Show resolved Hide resolved
ccharly and others added 2 commits August 1, 2024 11:33
Copy link

sonarcloud bot commented Aug 1, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [24e70a6]
Page Load Metrics (62 ± 6 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6512192147
domContentLoaded10331984
load428462126
domInteractive10331984
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: -117 Bytes (-0.00%)
  • common: 296 Bytes (0.00%)

@ccharly ccharly merged commit f3383ac into develop Aug 1, 2024
75 checks passed
@ccharly ccharly deleted the fix/show-fiat-for-test-assets branch August 1, 2024 10:30
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2024
@metamaskbot metamaskbot added the release-12.4.0 Issue or pull request that will be included in release 12.4.0 label Aug 1, 2024
@gauthierpetetin gauthierpetetin added release-12.3.0 Issue or pull request that will be included in release 12.3.0 and removed release-12.4.0 Issue or pull request that will be included in release 12.4.0 labels Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.3.0 Issue or pull request that will be included in release 12.3.0 team-accounts type-bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants