Skip to content

fix: issue where wallet_addEtherumChain was incorrectly enforcing inclusion of a blockExplorerUrls property which is not required#26938

Merged
adonesky1 merged 2 commits intodevelopfrom
ad/remove-blockexplorerurl-validation
Sep 5, 2024
Merged

fix: issue where wallet_addEtherumChain was incorrectly enforcing inclusion of a blockExplorerUrls property which is not required#26938
adonesky1 merged 2 commits intodevelopfrom
ad/remove-blockexplorerurl-validation

Conversation

@adonesky1
Copy link
Copy Markdown
Contributor

@adonesky1 adonesky1 commented Sep 5, 2024

Fix issue where wallet_addEtherumChain was incorrectly enforcing inclusion of a blockExplorerUrls property which is not required

Description

Open in GitHub Codespaces

Related issues

Fixes: #26844

Manual testing steps

  1. Go to https://protect.flashbots.net/summary?fast=true
  2. Click "Add to Metamask"
  3. You should see the add network confirmation and be able to add the network configuration successfully to the wallet

Screenshots/Recordings

Before

Screen.Recording.2024-09-05.at.9.53.27.AM.mov

After

Screen.Recording.2024-09-05.at.9.48.34.AM.mov

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.

…usion of a blockExplorerUrls property which is not required
@adonesky1 adonesky1 requested a review from a team as a code owner September 5, 2024 14:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 5, 2024

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.

@github-actions github-actions bot added the team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead label Sep 5, 2024
antonydenyer
antonydenyer previously approved these changes Sep 5, 2024
@shanejonas
Copy link
Copy Markdown
Contributor

looks good, spec also says it shouldn't be required: https://github.com/MetaMask/api-specs/blob/main/openrpc.yaml#L896-L900

shanejonas
shanejonas previously approved these changes Sep 5, 2024
const firstValidRPCUrl = rpcUrls.find((rpcUrl) => isLocalhostOrHttps(rpcUrl));
const firstValidBlockExplorerUrl =
blockExplorerUrls !== null && Array.isArray(blockExplorerUrls)
blockExplorerUrls && Array.isArray(blockExplorerUrls)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

> Array.isArray(null)
false
> Array.isArray(undefined)
false
> Array.isArray(undefined)
false
> Array.isArray('')
false
> Array.isArray([])
true

Does the first part of the check need to be there in the first place?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Seems like we can scrap it!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done here cb9d89e

expect(mocks.setActiveNetwork).toHaveBeenCalledWith(123);
});

it('creates a new networkConfiguration when called with no "blockExplorerUrls" property', async () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
it('creates a new networkConfiguration when called with no "blockExplorerUrls" property', async () => {
it('creates a new networkConfiguration when called without "blockExplorerUrls" property', async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit of course

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done here cb9d89e

@adonesky1 adonesky1 dismissed stale reviews from shanejonas and antonydenyer via cb9d89e September 5, 2024 15:40
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Sep 5, 2024

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.17%. Comparing base (e0868ba) to head (cb9d89e).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #26938   +/-   ##
========================================
  Coverage    70.17%   70.17%           
========================================
  Files         1425     1425           
  Lines        49646    49644    -2     
  Branches     13891    13889    -2     
========================================
  Hits         34835    34835           
+ Misses       14811    14809    -2     

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

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [cb9d89e]
Page Load Metrics (1752 ± 65 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint27121271684349168
domContentLoaded14732082172812359
load14832134175213665
domInteractive166434147
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -174 Bytes (-0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@adonesky1 adonesky1 merged commit bc85db9 into develop Sep 5, 2024
@adonesky1 adonesky1 deleted the ad/remove-blockexplorerurl-validation branch September 5, 2024 17:35
@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2024
@metamaskbot metamaskbot added release-12.6.0 Issue or pull request that will be included in release 12.6.0 release-12.2.0 Issue or pull request that will be included in release 12.2.0 and removed release-12.6.0 Issue or pull request that will be included in release 12.6.0 labels Sep 5, 2024
@metamaskbot
Copy link
Copy Markdown
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.6.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-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: wallet_addEthereumChain blockExplorerUrls should be optional

5 participants