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

refactor: use core profile syncing controllers. #26370

Merged
merged 9 commits into from
Aug 14, 2024

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Aug 12, 2024

Description

1st migration to shared controllers. This adds the reusable controllers from core. Migrated AuthenticationController and UserStorageController

Open in GitHub Codespaces

Related issues

Fixes: N/A

Manual testing steps

  1. Go to this page...

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.

Copy link

socket-security bot commented Aug 12, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Network access npm/@metamask/[email protected] 🚫

View full report↗︎

Next steps

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@metamaskbot metamaskbot added the team-notifications Notifications team label Aug 12, 2024
@Prithpal-Sooriya
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@@ -365,7 +366,6 @@
"@metamask/user-operation-controller": "^13.0.0",
"@metamask/utils": "^8.2.1",
"@ngraveio/bc-ur": "^1.1.12",
"@noble/ciphers": "^0.5.2",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This package was only used as part of our controllers. Now that we are using these shared controllers, we can remove this dep.


type AppState = {
metamask: AuthenticationControllerState & {
metamask: AuthenticationController.AuthenticationControllerState & {
Copy link
Contributor Author

@Prithpal-Sooriya Prithpal-Sooriya Aug 12, 2024

Choose a reason for hiding this comment

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

Yep I get it, this syntax is weird. We were fighting to get multiple file exports working for this package, but ran into issues and time constraints, so opted for named exports/namespaced exports.

In near future we will support multiple exports. E.g.

import { AuthenticationControllerState } from '@metamask/profile-sync-controller/auth'

Comment on lines +1523 to +1532
// Temporary add missing methods (due to notification controller migration)
this.controllerMessenger.registerActionHandler(
'NotificationServicesController:disableNotificationServices',
() => this.metamaskNotificationsController.disableMetamaskNotifications(),
);
this.controllerMessenger.registerActionHandler(
'NotificationServicesController:selectIsNotificationServicesEnabled',
() =>
this.metamaskNotificationsController.selectIsMetamaskNotificationsEnabled(),
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are slowly migrating controllers to use the shared controllers.
This addition is so that this PR works standalone (there was some controller renaming that was done in shared libraries)

@metamaskbot
Copy link
Collaborator

Builds ready [ee2b73e]
Page Load Metrics (356 ± 313 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint891811182110
domContentLoaded107328168
load452165356652313
domInteractive107328168
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 106.53 KiB (3.01%)
  • ui: 0 Bytes (0.00%)
  • common: 5.9 KiB (0.08%)

Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.98%. Comparing base (b3c2323) to head (190c72c).
Report is 3 commits behind head on develop.

Files Patch % Lines
app/scripts/metamask-controller.js 57.14% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26370      +/-   ##
===========================================
- Coverage    70.13%   69.98%   -0.16%     
===========================================
  Files         1435     1422      -13     
  Lines        50309    49937     -372     
  Branches     13897    13862      -35     
===========================================
- Hits         35283    34944     -339     
+ Misses       15026    14993      -33     

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

@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review August 13, 2024 12:39
@Prithpal-Sooriya Prithpal-Sooriya requested review from a team as code owners August 13, 2024 12:39
Copy link
Contributor

@matteoscurati matteoscurati left a comment

Choose a reason for hiding this comment

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

LGTM

@metamaskbot
Copy link
Collaborator

Builds ready [5ad6097]
Page Load Metrics (281 ± 278 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint851921212713
domContentLoaded1096312412
load512157281580278
domInteractive1096312412
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 106.53 KiB (3.01%)
  • ui: 0 Bytes (0.00%)
  • common: 5.9 KiB (0.08%)

Copy link
Contributor

@mathieuartu mathieuartu left a comment

Choose a reason for hiding this comment

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

YESSS

Copy link

@metamaskbot
Copy link
Collaborator

Builds ready [190c72c]
Page Load Metrics (60 ± 7 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint5812590168
domContentLoaded95526136
load388960147
domInteractive95526136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 106.53 KiB (3.01%)
  • ui: 0 Bytes (0.00%)
  • common: 5.9 KiB (0.08%)

@Prithpal-Sooriya Prithpal-Sooriya merged commit f9353f4 into develop Aug 14, 2024
77 of 78 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the notify_840_use_profile_sync_controller branch August 14, 2024 09:29
@github-actions github-actions bot locked and limited conversation to collaborators Aug 14, 2024
@metamaskbot metamaskbot added the release-12.4.0 Issue or pull request that will be included in release 12.4.0 label Aug 14, 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-notifications Notifications team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants