1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00
metamask-extension/app/scripts/migrations
Elliot Winkler ed3cc404f2
NetworkController: Split network into networkId and networkStatus (#17556)
The `network` store of the network controller crams two types of data
into one place. It roughly tracks whether we have enough information to
make requests to the network and whether the network is capable of
receiving requests, but it also stores the ID of the network (as
obtained via `net_version`).

Generally we shouldn't be using the network ID for anything, as it has
been completely replaced by chain ID, which all custom RPC endpoints
have been required to support for over a year now. However, as the
network ID is used in various places within the extension codebase,
removing it entirely would be a non-trivial effort. So, minimally, this
commit splits `network` into two stores: `networkId` and
`networkStatus`. But it also expands the concept of network status.

Previously, the network was in one of two states: "loading" and
"not-loading". But now it can be in one of four states:

- `available`: The network is able to receive and respond to requests.
- `unavailable`: The network is not able to receive and respond to
  requests for unknown reasons.
- `blocked`: The network is actively blocking requests based on the
  user's geolocation. (This is specific to Infura.)
- `unknown`: We don't know whether the network can receive and respond
  to requests, either because we haven't checked or we tried to check
  and were unsuccessful.

This commit also changes how the network status is determined —
specifically, how many requests are used to determine that status, when
they occur, and whether they are awaited. Previously, the network
controller would make 2 to 3 requests during the course of running
`lookupNetwork`.

* First, if it was an Infura network, it would make a request for
  `eth_blockNumber` to determine whether Infura was blocking requests or
  not, then emit an appropriate event. This operation was not awaited.
* Then, regardless of the network, it would fetch the network ID via
  `net_version`. This operation was awaited.
* Finally, regardless of the network, it would fetch the latest block
  via `eth_getBlockByNumber`, then use the result to determine whether
  the network supported EIP-1559. This operation was awaited.

Now:

* One fewer request is made, specifically `eth_blockNumber`, as we don't
  need to make an extra request to determine whether Infura is blocking
  requests; we can reuse `eth_getBlockByNumber`;
* All requests are awaited, which makes `lookupNetwork` run fully
  in-band instead of partially out-of-band; and
* Both requests for `net_version` and `eth_getBlockByNumber` are
  performed in parallel to make `lookupNetwork` run slightly faster.
2023-03-30 16:49:12 -06:00
..
002.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
003.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
004.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
005.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
006.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
007.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
008.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
009.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
010.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
011.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
012.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
013.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
014.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
015.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
016.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
017.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
018.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
019.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
020.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
021.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
021.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
022.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
022.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
023.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
023.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
024.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
024.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
025.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
025.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
026.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
026.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
027.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
027.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
028.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
028.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
029.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
029.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
030.js update prettier (#15360) 2022-07-31 13:26:40 -05:00
030.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
031.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
031.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
032.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
033.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
033.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
034.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
034.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
035.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
035.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
036.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
036.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
037.js Migrate to new controller packages (#16547) 2022-11-24 16:29:07 -03:30
037.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
038.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
038.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
039.js use safer toChecksum utility (#11117) 2021-05-17 16:19:39 -05:00
039.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
040.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
040.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
041.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
041.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
042.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
042.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
043.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
043.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
044.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
044.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
045.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
045.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
046.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
046.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
047.js update prettier (#15360) 2022-07-31 13:26:40 -05:00
047.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
048.js remove exclusions for mismatched object jsdoc type casing (#15351) 2022-07-27 08:28:05 -05:00
048.test.js Update ESLint config to v8 (#12886) 2021-12-09 15:36:24 -03:30
049.js update prettier (#15360) 2022-07-31 13:26:40 -05:00
049.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
050.js Fix 10036 - Prevent odd localStorage migration error in Firefox (#10884) 2021-04-14 09:24:17 -05:00
050.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
051.js migrate network constants to typescript (#15610) 2022-09-14 09:55:31 -05:00
051.test.js migrate network constants to typescript (#15610) 2022-09-14 09:55:31 -05:00
052.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
052.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
053.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
053.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
054.js Fixing incorrectly typed token decimal attribute (#10666) 2021-03-19 10:17:39 -07:00
054.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
055.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
055.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
056.js update prettier (#15360) 2022-07-31 13:26:40 -05:00
056.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
057.js Refactor Tx State Manager (#10672) 2021-03-30 09:54:05 -05:00
057.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
058.js Whats new popup (#10583) 2021-04-28 14:21:41 -02:30
058.test.js Jestify continue (#12173) 2021-09-22 08:15:40 -07:00
059.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
059.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
060.js Removing support survey notification from What's New (#11118) 2021-05-18 10:55:55 -07:00
060.test.js Jestify continue (#12173) 2021-09-22 08:15:40 -07:00
061.js Adding periodic reminder modal for backing up recovery phrase (#11021) 2021-06-04 23:33:58 -07:00
061.test.js Jestify continue (#12173) 2021-09-22 08:15:40 -07:00
062.js Removing obsolete client-side transaction metrics events (#11329) 2021-06-24 15:37:44 -07:00
062.test.js Jestify continue (#12173) 2021-09-22 08:15:40 -07:00
063.js Integrate TokensController (#11552) 2021-09-10 12:37:19 -05:00
063.test.js Jestify migrations/ (#12106) 2021-09-21 09:28:13 -07:00
064.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
064.test.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
065.js update prettier (#15360) 2022-07-31 13:26:40 -05:00
065.test.js Migrate completedOnboarding and firstTimeFlowType state into onboardingController (#12356) 2021-10-15 13:52:52 -05:00
066.js Convert shared/constants/hardware-wallets.js -> Typescript (#17310) 2023-01-20 09:14:40 -06:00
066.test.js Convert shared/constants/hardware-wallets.js -> Typescript (#17310) 2023-01-20 09:14:40 -06:00
067.js update prettier (#15360) 2022-07-31 13:26:40 -05:00
067.test.js Add migration to set showTestNetworks to true if there is evidence of testnet use (#12675) 2021-11-15 15:50:33 -03:30
068.js update prettier (#15360) 2022-07-31 13:26:40 -05:00
068.test.js update prettier (#15360) 2022-07-31 13:26:40 -05:00
069.js Move subject type enum to @metamask/subject-metadata-controller (#16431) 2023-01-24 16:03:01 +01:00
069.test.js Move subject type enum to @metamask/subject-metadata-controller (#16431) 2023-01-24 16:03:01 +01:00
070.js Stop storing request and response objects in the permission activity log (#14485) 2022-04-21 08:44:15 -07:00
070.test.js Stop storing request and response objects in the permission activity log (#14485) 2022-04-21 08:44:15 -07:00
071.js Rename NotificationController to AnnouncementController (#14389) 2022-04-27 10:36:32 +02:00
071.test.js Rename NotificationController to AnnouncementController (#14389) 2022-04-27 10:36:32 +02:00
072.js Increase likelyhood of valid method signatures being returned by getMethodData (#14937) 2022-06-17 23:11:09 +02:00
072.test.js Increase likelyhood of valid method signatures being returned by getMethodData (#14937) 2022-06-17 23:11:09 +02:00
073.js Remove decentralized 4byte function signature registry since it contains incorrect signatures and we can't algorithmically check for best option when 4byte.directory is down (#15300) 2022-07-26 12:01:14 -05:00
073.test.js Remove decentralized 4byte function signature registry since it contains incorrect signatures and we can't algorithmically check for best option when 4byte.directory is down (#15300) 2022-07-26 12:01:14 -05:00
074.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
074.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
075.js Remove 3box feature and delete ThreeBoxController (#14571) 2022-10-31 13:50:50 -02:30
075.test.js Remove 3box feature and delete ThreeBoxController (#14571) 2022-10-31 13:50:50 -02:30
076.js Update @metamask/controllers to v33 (#16493) 2022-11-15 15:19:42 -03:30
076.test.js Update @metamask/controllers to v33 (#16493) 2022-11-15 15:19:42 -03:30
077.js Updating tokensChainsCache[chainId].data to object from array in user state (#16535) 2022-11-18 13:35:42 -05:00
077.test.js Updating tokensChainsCache[chainId].data to object from array in user state (#16535) 2022-11-18 13:35:42 -05:00
078.test.js Change migration 78 version to 79, 79 to 80 and 80 to 78 (so that the… (#17980) 2023-03-06 10:06:01 -03:30
078.ts Change migration 78 version to 79, 79 to 80 and 80 to 78 (so that the… (#17980) 2023-03-06 10:06:01 -03:30
079.js Change migration 78 version to 79, 79 to 80 and 80 to 78 (so that the… (#17980) 2023-03-06 10:06:01 -03:30
079.test.js Change migration 78 version to 79, 79 to 80 and 80 to 78 (so that the… (#17980) 2023-03-06 10:06:01 -03:30
080.js Change migration 78 version to 79, 79 to 80 and 80 to 78 (so that the… (#17980) 2023-03-06 10:06:01 -03:30
080.test.js Change migration 78 version to 79, 79 to 80 and 80 to 78 (so that the… (#17980) 2023-03-06 10:06:01 -03:30
081.test.js [FLASK] BREAKING - snaps-monorepo@0.30.0 (#17718) 2023-03-08 13:29:23 -05:00
081.ts [FLASK] BREAKING - snaps-monorepo@0.30.0 (#17718) 2023-03-08 13:29:23 -05:00
082.test.js Migrate network configurations (previously frequentRpcListDetail) from PreferencesController to NetworkController (#17421) 2023-03-09 15:00:28 -06:00
082.ts Migrate network configurations (previously frequentRpcListDetail) from PreferencesController to NetworkController (#17421) 2023-03-09 15:00:28 -06:00
083.test.js NetworkController: Split network into networkId and networkStatus (#17556) 2023-03-30 16:49:12 -06:00
083.ts NetworkController: Split network into networkId and networkStatus (#17556) 2023-03-30 16:49:12 -06:00
fail-tx.js Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
index.js NetworkController: Split network into networkId and networkStatus (#17556) 2023-03-30 16:49:12 -06:00
migrations.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
template.test.js Convert the migration template to TypeScript (#17836) 2023-02-27 15:16:22 -03:30
template.ts Convert the migration template to TypeScript (#17836) 2023-02-27 15:16:22 -03:30