1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app
Mark Stacey 17f7ca2cfe
Update address book state upon custom RPC chainId edit (#9493)
When the `chainId` for a custom RPC endpoint is edited, we now migrate
the corresponding address book entries to ensure they are not orphaned.

The address book entries are grouped by the `metamask.network` state,
which unfortunately was sometimes the `chainId`, and sometimes the
`networkId`. It was always the `networkId` for built-in Infura
networks, but for custom RPC endpoints it would be set to the user-set
`chainId` field, with a fallback to the `networkId` of the network.

A recent change will force users to enter valid `chainId`s on all
custom networks, which will be normalized to be hex-prefixed. As a
result, address book contacts will now be keyed by a different string.
The contact entries are now migrated when this edit takes place.

There are some edge cases where two separate entries share the same set
of contacts. For example, if two entries have the same `chainId`, or if
they had the same `networkId` and had no `chainId` set. When the
`chainId` is edited in such cases, the contacts are duplicated on both
networks. This is the best we can do, as we don't have any way to know
which network the contacts _should_ be on.

The `typed-message-manager` unit tests have also been updated as part
of this commit because the addition of `sinon.restore()` to the
preferences controller tests ended up clearing a test object in-between
individual tests in that file. The test object is now re-constructed
before each individual test.
2020-10-07 15:02:17 -02:30
..
_locales Check specified chain ID against endpoint return value (#9491) 2020-10-07 11:58:22 -02:30
fonts Add euclid fontface (#9018) 2020-07-27 17:15:44 -05:00
images Add MetaMask Swaps (#9482) 2020-10-06 15:58:38 -02:30
manifest Add prettier-plugin-sort-json (#9450) 2020-09-23 12:21:42 -02:30
scripts Update address book state upon custom RPC chainId edit (#9493) 2020-10-07 15:02:17 -02:30
vendor/trezor
home.html
loading.html
notification.html Fix connection modal style issues (#8433) 2020-05-04 12:04:41 -03:00
phishing.html Backport "Updating deprecated Etherscam link (#7464)" (#8463) 2020-04-29 18:40:34 -03:00
popup.html
trezor-usb-permissions.html