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

Remove keyringMemStore from DetectTokensController #20728

Merged
merged 3 commits into from
Sep 18, 2023

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Sep 5, 2023

Explanation

This PR removes the keyringMemStore constructor parameter, as we can now subscribe to KeyringController events through the messenger. Instead of listening on all Keyring state changes, we can listen to :lock and :unlock events.

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

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.

@mikesposito mikesposito force-pushed the refactor/detect-tokens-keyring-controller branch from 5bb117f to 1af59a7 Compare September 5, 2023 09:16
@mikesposito mikesposito marked this pull request as draft September 5, 2023 12:28
@mikesposito mikesposito marked this pull request as ready for review September 5, 2023 12:56
@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Patch coverage: 57.14% and no project coverage change.

Comparison is base (bfaaf40) 68.17% compared to head (c3ca98c) 68.17%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #20728   +/-   ##
========================================
  Coverage    68.17%   68.17%           
========================================
  Files          998      998           
  Lines        39966    39968    +2     
  Branches     10686    10684    -2     
========================================
+ Hits         27243    27246    +3     
+ Misses       12723    12722    -1     
Files Changed Coverage Δ
app/scripts/metamask-controller.js 53.95% <0.00%> (+0.03%) ⬆️
app/scripts/controllers/detect-tokens.js 92.44% <100.00%> (+0.20%) ⬆️

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

@metamaskbot
Copy link
Collaborator

Builds ready [a572703]
Page Load Metrics (1608 ± 54 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint107181139199
domContentLoaded14051884160611254
load14061884160811254
domInteractive14051884160611254
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 419 Bytes (0.01%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Comment on lines -19 to -24
function buildMessenger() {
return new ControllerMessenger().getRestricted({
name: 'DetectTokensController',
allowedEvents: ['NetworkController:stateChange'],
});
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This has been substituted with getRestrictedMessenger which uses the messenger instance available in the higher scope, as it helps registering a mock handler for the KeyringController:getState action.

@mikesposito mikesposito force-pushed the refactor/detect-tokens-keyring-controller branch 3 times, most recently from aa5875a to 2e4fdb9 Compare September 7, 2023 10:31
@metamaskbot
Copy link
Collaborator

Builds ready [2e4fdb9]
Page Load Metrics (1714 ± 70 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1162481452814
domContentLoaded15702179171414770
load15702179171414770
domInteractive15702179171414770
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 419 Bytes (0.01%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@mikesposito mikesposito force-pushed the refactor/detect-tokens-keyring-controller branch from 2e4fdb9 to 1fd7479 Compare September 14, 2023 08:16
@metamaskbot
Copy link
Collaborator

Builds ready [1fd7479]
Page Load Metrics (1514 ± 33 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint116164134136
domContentLoaded1400164615146933
load1401164615146933
domInteractive1400164615146933
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 419 Bytes (0.01%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

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!

@mikesposito mikesposito force-pushed the refactor/detect-tokens-keyring-controller branch from 747a221 to af31acf Compare September 15, 2023 06:34
@metamaskbot
Copy link
Collaborator

Builds ready [af31acf]
Page Load Metrics (1570 ± 55 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint113162135136
domContentLoaded14111819157011555
load14111819157011555
domInteractive14111819157011555
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 419 Bytes (0.01%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@mikesposito mikesposito force-pushed the refactor/detect-tokens-keyring-controller branch from af31acf to c3ca98c Compare September 18, 2023 08:06
@mikesposito mikesposito merged commit f00dd59 into develop Sep 18, 2023
8 of 9 checks passed
@mikesposito mikesposito deleted the refactor/detect-tokens-keyring-controller branch September 18, 2023 08:32
@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2023
@metamaskbot metamaskbot added the release-11.3.0 Issue or pull request that will be included in release 11.3.0 label Sep 18, 2023
@metamaskbot
Copy link
Collaborator

Builds ready [c3ca98c]
Page Load Metrics (1675 ± 114 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1172121462612
domContentLoaded147723931675237114
load147723941675237114
domInteractive147723931675237114
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 419 Bytes (0.01%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

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

Successfully merging this pull request may close these issues.

Remove @metamask/eth-keyring-controller from DetectTokensController
4 participants