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

Synchronise address book and name controller #21084

Merged
merged 42 commits into from
Oct 4, 2023

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Sep 27, 2023

Description

Add a migration to copy all existing address book entries in the AddressBookController to the NameController.

Add listeners to both controllers to synchronise all new, updated, or deleted entries going forward.

Manual Testing Steps

Synchronisation

  1. Go to test dApp.
  2. Click Connect.
  3. Click Sign Typed Data V4 > Sign.
  4. Click first address.
  5. Copy address.
  6. Save petname.
  7. Paste address in Send form of test dApp.
  8. Click Submit.
  9. Verify same name is visible in address book in top right of transaction modal.
  10. Permutate the above to verify create, update, and delete is synchronised in both directions.
  11. Address book entries can be deleted via Settings > Contacts > [Click Entry] > Delete.

Migration

  1. Install build of develop.
  2. Create address book entries for test dApp signature addresses.
  3. Build this branch.
  4. Reload extension without removing.
  5. Verify identical petnames are visible in V3 and V4 signature request.

Related Issues

Fixes #1367

Pre-merge Author Checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained:
    • What problem this PR is solving.
    • How this problem was solved.
    • How reviewers can test my changes.
  • I’ve indicated what issue this PR is linked to: Fixes #???
  • I’ve included tests if applicable.
  • I’ve documented any added code.
  • I’ve applied the right labels on the PR (see labeling guidelines).
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner September 27, 2023 21:36
@github-actions
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.

@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (0482ab6) 68.57% compared to head (d6ab9d0) 68.65%.
Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #21084      +/-   ##
===========================================
+ Coverage    68.57%   68.65%   +0.08%     
===========================================
  Files         1013     1015       +2     
  Lines        40615    40753     +138     
  Branches     10854    10875      +21     
===========================================
+ Hits         27848    27976     +128     
- Misses       12767    12777      +10     
Files Coverage Δ
app/scripts/migrations/100.ts 100.00% <100.00%> (ø)
app/scripts/migrations/index.js 100.00% <ø> (ø)
app/scripts/metamask-controller.js 53.95% <66.67%> (+0.25%) ⬆️
app/scripts/lib/AddressBookPetnamesBridge.ts 90.00% <90.00%> (ø)

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

@metamaskbot
Copy link
Collaborator

Builds ready [b96d99c]
Page Load Metrics (1234 ± 397 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint881751162713
domContentLoaded731861123015
load8422421234828397
domInteractive731861123015
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.89 KiB (0.05%)
  • ui: -16.16 KiB (-0.20%)
  • common: 54.85 KiB (1.17%)

@metamaskbot
Copy link
Collaborator

Builds ready [1bdbece]
Page Load Metrics (641 ± 329 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint79978542
domContentLoaded64857573
load741534641686329
domInteractive64857573
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.89 KiB (0.05%)
  • ui: -16.16 KiB (-0.20%)
  • common: 54.85 KiB (1.17%)

@sleepytanya
Copy link
Contributor

sleepytanya commented Oct 2, 2023

Synchronization works as expected.

  1. Same petname is displayed in the address book and in top right of transaction modal after creating:
Screenshot 2023-10-01 at 11 54 29 PM Screenshot 2023-10-02 at 12 01 53 AM
  1. No petname is shown after deleting the account from Address Book:
Screenshot 2023-10-02 at 12 11 47 AM
  1. Same petname is shown after updating the account in the Address Book:
Screenshot 2023-10-02 at 12 09 38 AM Screenshot 2023-10-02 at 12 09 26 AM

@sleepytanya
Copy link
Contributor

Migration works as expected.

  1. Petnames in Address Book on develop branch build:
Screenshot 2023-10-02 at 12 20 18 AM
  1. Petnames in Address Book after migration to feat/address-book-petnames-sync branch build:
Screenshot 2023-10-02 at 12 23 14 AM
  1. Petname is displayed in V3 signature request after migration:
Screenshot 2023-10-02 at 12 24 30 AM
  1. Petname are displayed in V4 signature request after migration:
Screenshot 2023-10-02 at 12 24 04 AM

OGPoyraz
OGPoyraz previously approved these changes Oct 2, 2023
Base automatically changed from feat/petnames-metrics to develop October 2, 2023 09:21
@matthewwalsh0 matthewwalsh0 dismissed OGPoyraz’s stale review October 2, 2023 09:21

The base branch was changed.

@matthewwalsh0 matthewwalsh0 requested review from a team as code owners October 2, 2023 09:21
@matthewwalsh0 matthewwalsh0 added the team-confirmations-system DEPRECATED: please use "team-confirmations" label instead label Oct 2, 2023
@metamaskbot
Copy link
Collaborator

Builds ready [ab443a3]
Page Load Metrics (880 ± 377 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint87132101126
domContentLoaded6912693157
load801752880785377
domInteractive6912693157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.19 KiB (0.03%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [d6ab9d0]
Page Load Metrics (1354 ± 349 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint911841132311
domContentLoaded781801042612
load9421071354727349
domInteractive781801042612
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.19 KiB (0.03%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@matthewwalsh0 matthewwalsh0 merged commit 9f394b4 into develop Oct 4, 2023
9 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/address-book-petnames-sync branch October 4, 2023 08:33
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2023
@metamaskbot metamaskbot added the release-11.4.0 Issue or pull request that will be included in release 11.4.0 label Oct 4, 2023
@danjm danjm added release-blocker This bug is blocking the next release release-11.3.0 Issue or pull request that will be included in release 11.3.0 and removed release-11.4.0 Issue or pull request that will be included in release 11.4.0 labels Oct 4, 2023
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 release-blocker This bug is blocking the next release team-confirmations-system DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants