-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: Key the address book by chain ID instead of network ID #7197
Conversation
277f25a
to
5edfeec
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7197 +/- ##
==========================================
+ Coverage 34.43% 34.58% +0.14%
==========================================
Files 1016 1016
Lines 27089 27150 +61
Branches 2206 2206
==========================================
+ Hits 9329 9389 +60
- Misses 17267 17268 +1
Partials 493 493
☔ View full report in Codecov by Sentry. |
Migrating this data will be tricky. I wrote a script to process https://chainid.network/chains.json looking for cases where the network ID doesn't match the chain ID. Here is the script:
And here are the results:
|
9059be0
to
a895370
Compare
a895370
to
2cbb6bd
Compare
This PR opts to show both addresses in case of chain conflicts. There is a known and current risk with this approach: WHEN the user selects an address from the contact list in the send flow This risk exists in production today. To unblock controller work, next steps agreed on:
|
2cbb6bd
to
732cddc
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@SocketSecurity ignore-all False positive, the new dependencies detected are not new |
c19c890
to
3b252d2
Compare
I have updated the migration to store a record of all ambiguous addresses that have been duplicated across chains. I am awaiting further clarification on the next requirements. |
These steps are being discussed, so I have marked this as |
4ee5ddf
to
2333cb1
Compare
2333cb1
to
224efed
Compare
224efed
to
b60e791
Compare
b60e791
to
776f16a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. LMK if you need another review once there's more movement on UI dependencies.
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. |
6c7b5fc
to
e6f5c69
Compare
This has been rebased to resolve conflicts (the migration was moved from 22 to 23 because a migration 22 was added on main) |
The PR description has been updated with recordings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Migration works when upgrading from old version to new. Existing contacts show up the same as they did before. Ambiguous addresses are populated in redux. Adding contacts post fix does not cross contaminate across chains. Nice.
Removing do not merge label for now since we will handle the UI improvement in a separate task. Follow thread here - https://consensys.slack.com/archives/CBW7S9FSN/p1694536315593899 |
a03b1dc
to
c055ef7
Compare
c055ef7
to
3570cfe
Compare
The `AddressBookController` stores addresses by chain ID, but we had been storing and retrieving them using the network ID instead in many places. It has been updated to consistently use the chain ID for all address book access. Existing address book entries have been migrated to be grouped by chain ID. For all known networks, we attempt to map the network ID to a chain ID that exists as a locally configured or built-in network. In cases where multiple matches are found, the entries are duplicated on each matching chain. Address book entries that don't correspond with any local networks are discarded. This relates to MetaMask/mobile-planning#1226
3570cfe
to
92e54ff
Compare
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a manual regression on this PR with an emphasis on the testing contract nicknames functionality: contract nicknames should appear in the address book but not in the send flow.
✅
Development & PR Process
release-xx
label to identify the PR slated for a upcoming release (will be used in release discussion)needs-dev-review
label when work is completedneeds-qa
: PR requires manual QA.No QA/E2E only
: PR does not require any manual QA effort. Prior to merging, ensure that you have successful end-to-end test runs in Bitrise.Spot check on release build
: PR does not require feature QA but needs non-automated verification. In the description section, provide test scenarios. Add screenshots, and or recordings of what was tested.QA Passed
label when QA has signed off (Only required if the PR was labeled withneeds-qa
)team-
(orexternal-contributor
label if your not a MetaMask employee)Description
The
AddressBookController
stores addresses by chain ID, but we had been storing and retrieving them using the network ID instead in many places. It has been updated to consistently use the chain ID for all address book access.Existing address book entries have been migrated to be grouped by chain ID. For all known networks, we attempt to map the network ID to a chain ID that exists as a locally configured or built-in network. In cases where multiple matches are found, the entries are duplicated on each matching chain. Address book entries that don't correspond with any local networks are discarded.
Screenshots / Recordings
Before
In this recording, I create a contact on ETC and show that it's also suggested on Ethereum Mainnet
https://recordit.co/KrZMjEYKb4
After
In this recording, I am running a test build on this branch with the same wallet state as for the "Before" recording, so the test ETC contact entry is still there. I show that it was duplicated onto both Ethereum Mainnet and ETC. Then I create a new contact entry and show that it's correctly saved just for the current chain.
https://recordit.co/AIzatKvKXr
Issue
This relates to https://github.com/MetaMask/mobile-planning/issues/1226
Checklist