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: issue where setNetworkClientIdForDomain was called without checking whether the origin was eligible for setting its own network #26323

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Aug 2, 2024

Description

This PR fixes a issue where setNetworkClientIdForDomain was frequently called with origins that had no account permissions yet (which is the thresshold we currently set for giving site's their own network) resulting in a large number of silent errors in the background that are clogging up sentry.

Open in GitHub Codespaces

Related issues

Fixes: https://metamask.sentry.io/issues/5659582204/?environment=production&project=273505&qu%5B%E2%80%A6%5Derrer=issue-stream&sort=freq&statsPeriod=90d&stream_index=1

Manual testing steps

N/A

Screenshots/Recordings

Before

N/A

After

N/A

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.

…ng whether the origin was eligible for setting its own network
@adonesky1 adonesky1 requested a review from a team as a code owner August 2, 2024 15:52
Copy link
Contributor

github-actions bot commented Aug 2, 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.

Copy link

sonarqubecloud bot commented Aug 2, 2024

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -100,6 +101,7 @@ export const NetworkListMenu = ({ onClose }) => {
const selectedTabOrigin = useSelector(getOriginOfCurrentTab);
const useRequestQueue = useSelector(getUseRequestQueue);
const networkConfigurations = useSelector(getNetworkConfigurations);
const domains = useSelector(getAllDomains);
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure how important this is, but somewhere else in code i saw setNetworkClientIdForDomain guarded by hasPermissions instead of checking if the origin has a networkClientId set. The controller itself checks hasPermissions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These should always be in sync and perhaps we should change the controller to look at domains state since the state of which permissions are the threshhold may change

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.05%. Comparing base (5b56034) to head (5a94d97).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26323      +/-   ##
===========================================
+ Coverage    70.04%   70.05%   +0.01%     
===========================================
  Files         1411     1411              
  Lines        50031    50035       +4     
  Branches     13812    13815       +3     
===========================================
+ Hits         35042    35048       +6     
+ Misses       14989    14987       -2     

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

@metamaskbot
Copy link
Collaborator

Builds ready [5a94d97]
Page Load Metrics (291 ± 262 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint593151136431
domContentLoaded9154333718
load381764291545262
domInteractive9154333718
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 45 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@adonesky1 adonesky1 merged commit 80f538e into develop Aug 2, 2024
81 checks passed
@adonesky1 adonesky1 deleted the ad/fix-setNetworkClientIdForDomain-constraint branch August 2, 2024 16:47
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2024
@metamaskbot metamaskbot added the release-12.4.0 Issue or pull request that will be included in release 12.4.0 label Aug 2, 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-wallet-api-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants