From 692f46115b15f2636353bcccd252c4aea8bc4834 Mon Sep 17 00:00:00 2001 From: Jiexi Luan Date: Mon, 11 Sep 2023 13:43:58 -0700 Subject: [PATCH 1/8] remove infuraBlocked from preferences controller and infer from network state instead --- .storybook/test-data.js | 1 - app/scripts/controllers/detect-tokens.test.js | 2 - .../controllers/mmi-controller.test.js | 2 - app/scripts/controllers/preferences.js | 35 ----------- app/scripts/controllers/preferences.test.js | 6 -- app/scripts/lib/backup.test.js | 1 - app/scripts/lib/setupSentry.js | 1 - app/scripts/metamask-controller.js | 8 --- package.json | 1 + test/e2e/fixture-builder.js | 2 - test/e2e/restore/MetaMaskUserData.json | 1 - ...rs-after-init-opt-in-background-state.json | 1 - .../errors-after-init-opt-in-ui-state.json | 1 - ...s-before-init-opt-in-background-state.json | 1 - .../errors-before-init-opt-in-ui-state.json | 1 - ui/selectors/selectors.js | 5 +- yarn.lock | 59 ++++++++++++------- 17 files changed, 43 insertions(+), 85 deletions(-) diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 7acce27bc431..353064992c42 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -1137,7 +1137,6 @@ const state = { lostIdentities: {}, forgottenPassword: false, ipfsGateway: 'dweb.link', - infuraBlocked: false, migratedPrivacyMode: false, selectedAddress: '0x9d0ba4ddac06032527b140912ec808ab9451b788', metaMetricsId: diff --git a/app/scripts/controllers/detect-tokens.test.js b/app/scripts/controllers/detect-tokens.test.js index 8d1c182c249e..ba2e49b183d7 100644 --- a/app/scripts/controllers/detect-tokens.test.js +++ b/app/scripts/controllers/detect-tokens.test.js @@ -223,8 +223,6 @@ describe('DetectTokensController', function () { network, provider, tokenListController, - onInfuraIsBlocked: sinon.stub(), - onInfuraIsUnblocked: sinon.stub(), networkConfigurations: {}, onAccountRemoved: sinon.stub(), }); diff --git a/app/scripts/controllers/mmi-controller.test.js b/app/scripts/controllers/mmi-controller.test.js index e4b26dd62f5b..605af0d5bb57 100644 --- a/app/scripts/controllers/mmi-controller.test.js +++ b/app/scripts/controllers/mmi-controller.test.js @@ -50,8 +50,6 @@ describe('MMIController', function () { }), preferencesController: new PreferencesController({ initState: {}, - onInfuraIsBlocked: jest.fn(), - onInfuraIsUnblocked: jest.fn(), onAccountRemoved: jest.fn(), provider: {}, networkConfigurations: {}, diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index 5c1f169834ab..3b6edebc9372 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -93,7 +93,6 @@ export default class PreferencesController { // ENS decentralized website resolution ipfsGateway: IPFS_DEFAULT_GATEWAY_URL, useAddressBarEnsResolution: true, - infuraBlocked: null, ledgerTransportType: window.navigator.hid ? LedgerTransportTypes.webhid : LedgerTransportTypes.u2f, @@ -109,14 +108,10 @@ export default class PreferencesController { this.network = opts.network; - this._onInfuraIsBlocked = opts.onInfuraIsBlocked; - this._onInfuraIsUnblocked = opts.onInfuraIsUnblocked; this.store = new ObservableStore(initState); this.store.setMaxListeners(13); this.tokenListController = opts.tokenListController; - this._subscribeToInfuraAvailability(); - // subscribe to account removal opts.onAccountRemoved((address) => this.removeAddress(address)); @@ -621,36 +616,6 @@ export default class PreferencesController { ///: END:ONLY_INCLUDE_IN - // - // PRIVATE METHODS - // - - _subscribeToInfuraAvailability() { - this._onInfuraIsBlocked(() => { - this._setInfuraBlocked(true); - }); - - this._onInfuraIsUnblocked(() => { - this._setInfuraBlocked(false); - }); - } - - /** - * - * A setter for the `infuraBlocked` property - * - * @param {boolean} isBlocked - Bool indicating whether Infura is blocked - */ - _setInfuraBlocked(isBlocked) { - const { infuraBlocked } = this.store.getState(); - - if (infuraBlocked === isBlocked) { - return; - } - - this.store.updateState({ infuraBlocked: isBlocked }); - } - /** * A method to check is the linea mainnet network should be displayed */ diff --git a/app/scripts/controllers/preferences.test.js b/app/scripts/controllers/preferences.test.js index de312b7e0fa3..0ae29fba084a 100644 --- a/app/scripts/controllers/preferences.test.js +++ b/app/scripts/controllers/preferences.test.js @@ -40,8 +40,6 @@ describe('preferences controller', () => { preferencesController = new PreferencesController({ initLangCode: 'en_US', tokenListController, - onInfuraIsBlocked: jest.fn(), - onInfuraIsUnblocked: jest.fn(), onAccountRemoved: jest.fn(), networkConfigurations: NETWORK_CONFIGURATION_DATA, }); @@ -120,8 +118,6 @@ describe('preferences controller', () => { preferencesController = new PreferencesController({ initLangCode: 'en_US', tokenListController, - onInfuraIsBlocked: jest.fn(), - onInfuraIsUnblocked: jest.fn(), initState: { identities: { [testAddress]: { @@ -150,8 +146,6 @@ describe('preferences controller', () => { preferencesController = new PreferencesController({ initLangCode: 'en_US', tokenListController, - onInfuraIsBlocked: jest.fn(), - onInfuraIsUnblocked: jest.fn(), initState: { identities: { '0x7e57e2': { diff --git a/app/scripts/lib/backup.test.js b/app/scripts/lib/backup.test.js index 93aee74bddd7..f2d2336d792f 100644 --- a/app/scripts/lib/backup.test.js +++ b/app/scripts/lib/backup.test.js @@ -142,7 +142,6 @@ const jsonData = JSON.stringify({ useNativeCurrencyAsPrimaryCurrency: true, }, ipfsGateway: 'dweb.link', - infuraBlocked: false, ledgerTransportType: 'webhid', theme: 'light', customNetworkListEnabled: false, diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index edc7925e2220..b7f475d50913 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -170,7 +170,6 @@ export const SENTRY_BACKGROUND_STATE = { forgottenPassword: true, identities: false, incomingTransactionsPreferences: true, - infuraBlocked: true, ipfsGateway: false, isLineaMainnetReleased: true, knownMethodData: false, diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 52fc263aa53e..ca299993d70f 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -404,14 +404,6 @@ export default class MetamaskController extends EventEmitter { this.preferencesController = new PreferencesController({ initState: initState.PreferencesController, initLangCode: opts.initLangCode, - onInfuraIsBlocked: networkControllerMessenger.subscribe.bind( - networkControllerMessenger, - 'NetworkController:infuraIsBlocked', - ), - onInfuraIsUnblocked: networkControllerMessenger.subscribe.bind( - networkControllerMessenger, - 'NetworkController:infuraIsUnblocked', - ), onAccountRemoved: this.controllerMessenger.subscribe.bind( this.controllerMessenger, 'KeyringController:accountRemoved', diff --git a/package.json b/package.json index 604b5a03e123..56c0762ad134 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "audit": "yarn npm audit --recursive --environment production --severity moderate" }, "resolutions": { + "@metamask/network-controller@^12.0.0": "npm:@metamask-previews/network-controller@12.1.2-preview.0f6a2fb", "simple-update-notifier@^1.0.0": "^2.0.0", "@babel/core": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch", "@babel/runtime": "patch:@babel/runtime@npm%3A7.18.9#./.yarn/patches/@babel-runtime-npm-7.18.9-28ca6b5f61.patch", diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index 61db5bfc3e2e..1d6b8bb2f356 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -259,7 +259,6 @@ function defaultFixture() { name: 'Account 1', }, }, - infuraBlocked: false, ipfsGateway: 'dweb.link', knownMethodData: {}, ledgerTransportType: 'webhid', @@ -382,7 +381,6 @@ function onboardingFixture() { featureFlags: {}, forgottenPassword: false, identities: {}, - infuraBlocked: false, ipfsGateway: 'dweb.link', knownMethodData: {}, ledgerTransportType: 'webhid', diff --git a/test/e2e/restore/MetaMaskUserData.json b/test/e2e/restore/MetaMaskUserData.json index 5215b9620011..250b3cb3e852 100644 --- a/test/e2e/restore/MetaMaskUserData.json +++ b/test/e2e/restore/MetaMaskUserData.json @@ -27,7 +27,6 @@ "ticker": "ETH" } ], - "infuraBlocked": false, "ipfsGateway": "dweb.link", "knownMethodData": {}, "ledgerTransportType": "webhid", diff --git a/test/e2e/tests/state-snapshots/errors-after-init-opt-in-background-state.json b/test/e2e/tests/state-snapshots/errors-after-init-opt-in-background-state.json index a522a1b11f93..a30d484914a3 100644 --- a/test/e2e/tests/state-snapshots/errors-after-init-opt-in-background-state.json +++ b/test/e2e/tests/state-snapshots/errors-after-init-opt-in-background-state.json @@ -145,7 +145,6 @@ }, "ipfsGateway": "string", "useAddressBarEnsResolution": true, - "infuraBlocked": false, "ledgerTransportType": "webhid", "snapRegistryList": "object", "transactionSecurityCheckEnabled": false, diff --git a/test/e2e/tests/state-snapshots/errors-after-init-opt-in-ui-state.json b/test/e2e/tests/state-snapshots/errors-after-init-opt-in-ui-state.json index aad4be321658..960f57c2bbea 100644 --- a/test/e2e/tests/state-snapshots/errors-after-init-opt-in-ui-state.json +++ b/test/e2e/tests/state-snapshots/errors-after-init-opt-in-ui-state.json @@ -96,7 +96,6 @@ "forgottenPassword": false, "ipfsGateway": "string", "useAddressBarEnsResolution": true, - "infuraBlocked": false, "ledgerTransportType": "webhid", "snapRegistryList": "object", "transactionSecurityCheckEnabled": false, diff --git a/test/e2e/tests/state-snapshots/errors-before-init-opt-in-background-state.json b/test/e2e/tests/state-snapshots/errors-before-init-opt-in-background-state.json index 98f21ebd506a..75bd62d27908 100644 --- a/test/e2e/tests/state-snapshots/errors-before-init-opt-in-background-state.json +++ b/test/e2e/tests/state-snapshots/errors-before-init-opt-in-background-state.json @@ -80,7 +80,6 @@ "featureFlags": {}, "forgottenPassword": false, "identities": "object", - "infuraBlocked": false, "ipfsGateway": "string", "knownMethodData": "object", "ledgerTransportType": "webhid", diff --git a/test/e2e/tests/state-snapshots/errors-before-init-opt-in-ui-state.json b/test/e2e/tests/state-snapshots/errors-before-init-opt-in-ui-state.json index bf25106ca50b..5fa13c429985 100644 --- a/test/e2e/tests/state-snapshots/errors-before-init-opt-in-ui-state.json +++ b/test/e2e/tests/state-snapshots/errors-before-init-opt-in-ui-state.json @@ -80,7 +80,6 @@ "featureFlags": {}, "forgottenPassword": false, "identities": "object", - "infuraBlocked": false, "ipfsGateway": "string", "knownMethodData": "object", "ledgerTransportType": "webhid", diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 4d77bcec8858..be6b565a79b2 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -750,7 +750,10 @@ export function getIpfsGateway(state) { } export function getInfuraBlocked(state) { - return Boolean(state.metamask.infuraBlocked); + return ( + state.metamask.networksMetadata[getSelectedNetworkClientId(state)].status === + NetworkStatus.Blocked + ); } export function getUSDConversionRate(state) { diff --git a/yarn.lock b/yarn.lock index 90c1ddcaa2fb..1d78eca4f486 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3894,7 +3894,7 @@ __metadata: languageName: node linkType: hard -"@metamask/controller-utils@npm:^4.0.0, @metamask/controller-utils@npm:^4.0.1, @metamask/controller-utils@npm:^4.1.0, @metamask/controller-utils@npm:^4.2.0, @metamask/controller-utils@npm:^4.3.0, @metamask/controller-utils@npm:^4.3.1, @metamask/controller-utils@npm:^4.3.2": +"@metamask/controller-utils@npm:^4.0.0, @metamask/controller-utils@npm:^4.0.1, @metamask/controller-utils@npm:^4.1.0, @metamask/controller-utils@npm:^4.2.0, @metamask/controller-utils@npm:^4.3.0, @metamask/controller-utils@npm:^4.3.2": version: 4.3.2 resolution: "@metamask/controller-utils@npm:4.3.2" dependencies: @@ -4037,6 +4037,23 @@ __metadata: languageName: node linkType: hard +"@metamask/eth-json-rpc-middleware@npm:^11.0.2": + version: 11.0.2 + resolution: "@metamask/eth-json-rpc-middleware@npm:11.0.2" + dependencies: + "@metamask/eth-json-rpc-provider": "npm:^1.0.0" + "@metamask/eth-sig-util": "npm:^6.0.0" + "@metamask/utils": "npm:^5.0.1" + clone: "npm:^2.1.1" + eth-block-tracker: "npm:^7.0.1" + eth-rpc-errors: "npm:^4.0.3" + json-rpc-engine: "npm:^6.1.0" + pify: "npm:^3.0.0" + safe-stable-stringify: "npm:^2.3.2" + checksum: 188d98dce78f85fc6364ea78b6f7e14a95cdcf0791a187177a1da8e79b8588d1b08141110b570239d92afeb021c08432d5f10948f4bba983acd1665a013b8a2c + languageName: node + linkType: hard + "@metamask/eth-json-rpc-provider@npm:^1.0.0": version: 1.0.0 resolution: "@metamask/eth-json-rpc-provider@npm:1.0.0" @@ -4358,48 +4375,48 @@ __metadata: languageName: node linkType: hard -"@metamask/network-controller@npm:^10.2.0, @metamask/network-controller@npm:^10.3.0": - version: 10.3.1 - resolution: "@metamask/network-controller@npm:10.3.1" +"@metamask/network-controller@npm:@metamask-previews/network-controller@12.1.2-preview.0f6a2fb": + version: 12.1.2-preview.0f6a2fb + resolution: "@metamask-previews/network-controller@npm:12.1.2-preview.0f6a2fb" dependencies: - "@metamask/base-controller": "npm:^3.1.0" - "@metamask/controller-utils": "npm:^4.2.0" - "@metamask/eth-json-rpc-infura": "npm:^8.1.0" - "@metamask/eth-json-rpc-middleware": "npm:^11.0.0" + "@metamask/base-controller": "npm:^3.2.1" + "@metamask/controller-utils": "npm:^4.3.2" + "@metamask/eth-json-rpc-infura": "npm:^8.1.1" + "@metamask/eth-json-rpc-middleware": "npm:^11.0.2" "@metamask/eth-json-rpc-provider": "npm:^1.0.0" + "@metamask/eth-query": "npm:^3.0.1" "@metamask/swappable-obj-proxy": "npm:^2.1.0" - "@metamask/utils": "npm:^5.0.2" + "@metamask/utils": "npm:^6.2.0" async-mutex: "npm:^0.2.6" - babel-runtime: "npm:^6.26.0" eth-block-tracker: "npm:^7.0.1" - eth-query: "npm:^2.1.2" eth-rpc-errors: "npm:^4.0.2" immer: "npm:^9.0.6" json-rpc-engine: "npm:^6.1.0" uuid: "npm:^8.3.2" - checksum: 48b30bee12f90ca5e818dd99d3e164b4330368498e6388cc1044141be2f70eea28b2a85310bacb176d1c12027e2d8c996effa3902238aff75e6c20e31351740d + checksum: 94148d653df2ce9ba7467a074db029e559efca0cb701f674a511550fdd2f4c67cc2cb074d364bf6504ee7808459404a56cec023ca4cdfe04237b90a355d5cfeb languageName: node linkType: hard -"@metamask/network-controller@npm:^12.0.0": - version: 12.0.0 - resolution: "@metamask/network-controller@npm:12.0.0" +"@metamask/network-controller@npm:^10.2.0, @metamask/network-controller@npm:^10.3.0": + version: 10.3.1 + resolution: "@metamask/network-controller@npm:10.3.1" dependencies: - "@metamask/base-controller": "npm:^3.2.0" - "@metamask/controller-utils": "npm:^4.3.1" - "@metamask/eth-json-rpc-infura": "npm:^8.1.1" + "@metamask/base-controller": "npm:^3.1.0" + "@metamask/controller-utils": "npm:^4.2.0" + "@metamask/eth-json-rpc-infura": "npm:^8.1.0" "@metamask/eth-json-rpc-middleware": "npm:^11.0.0" "@metamask/eth-json-rpc-provider": "npm:^1.0.0" - "@metamask/eth-query": "npm:^3.0.1" "@metamask/swappable-obj-proxy": "npm:^2.1.0" - "@metamask/utils": "npm:^6.2.0" + "@metamask/utils": "npm:^5.0.2" async-mutex: "npm:^0.2.6" + babel-runtime: "npm:^6.26.0" eth-block-tracker: "npm:^7.0.1" + eth-query: "npm:^2.1.2" eth-rpc-errors: "npm:^4.0.2" immer: "npm:^9.0.6" json-rpc-engine: "npm:^6.1.0" uuid: "npm:^8.3.2" - checksum: ea7c8010f1ca80c448050c7cf618598a1dabe82969fe1ff4a4952b85b3e4db677adab88d99a146cb11461d899628d3914f71e1b22d4249ccc5787a0281839afd + checksum: 48b30bee12f90ca5e818dd99d3e164b4330368498e6388cc1044141be2f70eea28b2a85310bacb176d1c12027e2d8c996effa3902238aff75e6c20e31351740d languageName: node linkType: hard From bdca4884826b699f86a763ed6a7ccfdaac0bbb95 Mon Sep 17 00:00:00 2001 From: Jiexi Luan Date: Mon, 18 Sep 2023 11:39:44 -0700 Subject: [PATCH 2/8] lavamoat --- lavamoat/browserify/desktop/policy.json | 13 ++- lavamoat/browserify/flask/policy.json | 13 ++- lavamoat/build-system/policy.json | 143 ++++++++++++++++++++++-- 3 files changed, 157 insertions(+), 12 deletions(-) diff --git a/lavamoat/browserify/desktop/policy.json b/lavamoat/browserify/desktop/policy.json index 7ede24c7bbb7..3a7289bc7976 100644 --- a/lavamoat/browserify/desktop/policy.json +++ b/lavamoat/browserify/desktop/policy.json @@ -2245,7 +2245,7 @@ }, "packages": { "@metamask/snaps-controllers-flask>@metamask/post-message-stream>@metamask/utils": true, - "@metamask/snaps-controllers-flask>concat-stream>readable-stream": true + "@metamask/snaps-controllers-flask>@metamask/post-message-stream>readable-stream": true } }, "@metamask/snaps-controllers-flask>@metamask/post-message-stream>@metamask/utils": { @@ -2260,6 +2260,17 @@ "superstruct": true } }, + "@metamask/snaps-controllers-flask>@metamask/post-message-stream>readable-stream": { + "packages": { + "browserify>browser-resolve": true, + "browserify>buffer": true, + "browserify>events": true, + "browserify>process": true, + "browserify>string_decoder": true, + "pumpify>inherits": true, + "readable-stream>util-deprecate": true + } + }, "@metamask/snaps-controllers-flask>@metamask/rpc-methods": { "packages": { "@metamask/key-tree": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index d807734aedf6..5f9a593cd99e 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -2261,7 +2261,7 @@ }, "packages": { "@metamask/snaps-controllers-flask>@metamask/post-message-stream>@metamask/utils": true, - "@metamask/snaps-controllers-flask>concat-stream>readable-stream": true + "@metamask/snaps-controllers-flask>@metamask/post-message-stream>readable-stream": true } }, "@metamask/snaps-controllers-flask>@metamask/post-message-stream>@metamask/utils": { @@ -2276,6 +2276,17 @@ "superstruct": true } }, + "@metamask/snaps-controllers-flask>@metamask/post-message-stream>readable-stream": { + "packages": { + "browserify>browser-resolve": true, + "browserify>buffer": true, + "browserify>events": true, + "browserify>process": true, + "browserify>string_decoder": true, + "pumpify>inherits": true, + "readable-stream>util-deprecate": true + } + }, "@metamask/snaps-controllers-flask>@metamask/rpc-methods": { "packages": { "@metamask/key-tree": true, diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index 4ab9521cfbeb..d04dd2856029 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -1134,6 +1134,21 @@ "string.prototype.matchall>side-channel": true } }, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": { + "builtin": { + "os.type": true + }, + "globals": { + "process.env.LANG": true, + "process.env.LC_ALL": true, + "process.env.LC_CTYPE": true + } + }, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": { + "packages": { + "yargs>string-width": true + } + }, "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": { "builtin": { "os.homedir": true @@ -4999,6 +5014,7 @@ "@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": true } @@ -5056,9 +5072,20 @@ }, "packages": { "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": { + "builtin": { + "os.homedir": true + }, + "globals": { + "process.env": true, + "process.getuid": true, + "process.platform": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": { "globals": { "process.env.SystemRoot": true, @@ -5069,6 +5096,70 @@ "process.platform": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": { + "builtin": { + "events.EventEmitter": true, + "util": true + }, + "globals": { + "process.nextTick": true, + "process.stderr": true + }, + "packages": { + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": true, + "nyc>yargs>set-blocking": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": { + "builtin": { + "events.EventEmitter": true, + "util.inherits": true + }, + "packages": { + "koa>delegates": true, + "readable-stream": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": { + "builtin": { + "util.format": true + }, + "globals": { + "clearInterval": true, + "process": true, + "setImmediate": true, + "setInterval": true + }, + "packages": { + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": true, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>aproba": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, + "nyc>signal-exit": true, + "react>object-assign": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": { + "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, + "gulp>gulp-cli>yargs>string-width>code-point-at": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": { + "packages": { + "gulp>gulp-cli>yargs>string-width>is-fullwidth-code-point>number-is-nan": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": { + "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi>ansi-regex": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": { "builtin": { "assert": true, @@ -5080,9 +5171,34 @@ "setTimeout": true }, "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": true, "nyc>glob": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": { + "builtin": { + "assert": true, + "events.EventEmitter": true, + "fs": true, + "path.join": true, + "path.resolve": true, + "util": true + }, + "globals": { + "console.error": true, + "process.cwd": true, + "process.nextTick": true, + "process.platform": true + }, + "packages": { + "eslint>minimatch": true, + "gulp-watch>path-is-absolute": true, + "nyc>glob>fs.realpath": true, + "nyc>glob>inflight": true, + "pump>once": true, + "pumpify>inherits": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": { "globals": { "console": true, @@ -6530,6 +6646,13 @@ "process.platform": true } }, + "mockttp>portfinder>mkdirp": { + "builtin": { + "fs": true, + "path.dirname": true, + "path.resolve": true + } + }, "nock>debug": { "builtin": { "tty.isatty": true, @@ -8137,14 +8260,7 @@ "path.dirname": true }, "packages": { - "stylelint>file-entry-cache>flat-cache>write>mkdirp": true - } - }, - "stylelint>file-entry-cache>flat-cache>write>mkdirp": { - "builtin": { - "fs": true, - "path.dirname": true, - "path.resolve": true + "mockttp>portfinder>mkdirp": true } }, "stylelint>global-modules": { @@ -8622,8 +8738,8 @@ "define": true }, "packages": { - "terser>@jridgewell/source-map>@jridgewell/gen-mapping>@jridgewell/sourcemap-codec": true, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": true + "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": true, + "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/sourcemap-codec": true } }, "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": { @@ -8631,6 +8747,13 @@ "define": true } }, + "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/sourcemap-codec": { + "globals": { + "Buffer": true, + "TextDecoder": true, + "define": true + } + }, "terser>source-map-support": { "builtin": { "fs": true, From 3f5fb87e30bd188496149b54f82a30024a848e2f Mon Sep 17 00:00:00 2001 From: Jiexi Luan Date: Mon, 18 Sep 2023 11:46:55 -0700 Subject: [PATCH 3/8] Dedupe. Lavamoat --- lavamoat/browserify/desktop/policy.json | 13 +- lavamoat/browserify/flask/policy.json | 13 +- lavamoat/build-system/policy.json | 11 +- yarn.lock | 151 +----------------------- 4 files changed, 10 insertions(+), 178 deletions(-) diff --git a/lavamoat/browserify/desktop/policy.json b/lavamoat/browserify/desktop/policy.json index 3a7289bc7976..7ede24c7bbb7 100644 --- a/lavamoat/browserify/desktop/policy.json +++ b/lavamoat/browserify/desktop/policy.json @@ -2245,7 +2245,7 @@ }, "packages": { "@metamask/snaps-controllers-flask>@metamask/post-message-stream>@metamask/utils": true, - "@metamask/snaps-controllers-flask>@metamask/post-message-stream>readable-stream": true + "@metamask/snaps-controllers-flask>concat-stream>readable-stream": true } }, "@metamask/snaps-controllers-flask>@metamask/post-message-stream>@metamask/utils": { @@ -2260,17 +2260,6 @@ "superstruct": true } }, - "@metamask/snaps-controllers-flask>@metamask/post-message-stream>readable-stream": { - "packages": { - "browserify>browser-resolve": true, - "browserify>buffer": true, - "browserify>events": true, - "browserify>process": true, - "browserify>string_decoder": true, - "pumpify>inherits": true, - "readable-stream>util-deprecate": true - } - }, "@metamask/snaps-controllers-flask>@metamask/rpc-methods": { "packages": { "@metamask/key-tree": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 5f9a593cd99e..d807734aedf6 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -2261,7 +2261,7 @@ }, "packages": { "@metamask/snaps-controllers-flask>@metamask/post-message-stream>@metamask/utils": true, - "@metamask/snaps-controllers-flask>@metamask/post-message-stream>readable-stream": true + "@metamask/snaps-controllers-flask>concat-stream>readable-stream": true } }, "@metamask/snaps-controllers-flask>@metamask/post-message-stream>@metamask/utils": { @@ -2276,17 +2276,6 @@ "superstruct": true } }, - "@metamask/snaps-controllers-flask>@metamask/post-message-stream>readable-stream": { - "packages": { - "browserify>browser-resolve": true, - "browserify>buffer": true, - "browserify>events": true, - "browserify>process": true, - "browserify>string_decoder": true, - "pumpify>inherits": true, - "readable-stream>util-deprecate": true - } - }, "@metamask/snaps-controllers-flask>@metamask/rpc-methods": { "packages": { "@metamask/key-tree": true, diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index d04dd2856029..96fef5e24515 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -8738,8 +8738,8 @@ "define": true }, "packages": { - "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": true, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/sourcemap-codec": true + "terser>@jridgewell/source-map>@jridgewell/gen-mapping>@jridgewell/sourcemap-codec": true, + "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": true } }, "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": { @@ -8747,13 +8747,6 @@ "define": true } }, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/sourcemap-codec": { - "globals": { - "Buffer": true, - "TextDecoder": true, - "define": true - } - }, "terser>source-map-support": { "builtin": { "fs": true, diff --git a/yarn.lock b/yarn.lock index 18b3bdc7d5af..0b2f4c037c2a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3009,15 +3009,6 @@ __metadata: languageName: node linkType: hard -"@jest/expect-utils@npm:^29.4.3": - version: 29.4.3 - resolution: "@jest/expect-utils@npm:29.4.3" - dependencies: - jest-get-type: "npm:^29.4.3" - checksum: 0088256933bbf6f79c1e0ac36df83d11d230ea36ccb6032b408d5e1533d2adf557b8f5c8fe81b5bcc76cfc15ec688d1b00bc8175b5593890e4d5a7f380793e55 - languageName: node - linkType: hard - "@jest/expect-utils@npm:^29.6.2": version: 29.6.2 resolution: "@jest/expect-utils@npm:29.6.2" @@ -3182,15 +3173,6 @@ __metadata: languageName: node linkType: hard -"@jest/schemas@npm:^29.4.3": - version: 29.4.3 - resolution: "@jest/schemas@npm:29.4.3" - dependencies: - "@sinclair/typebox": "npm:^0.25.16" - checksum: ac754e245c19dc39e10ebd41dce09040214c96a4cd8efa143b82148e383e45128f24599195ab4f01433adae4ccfbe2db6574c90db2862ccd8551a86704b5bebd - languageName: node - linkType: hard - "@jest/schemas@npm:^29.6.0": version: 29.6.0 resolution: "@jest/schemas@npm:29.6.0" @@ -3367,13 +3349,6 @@ __metadata: languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:3.1.0": - version: 3.1.0 - resolution: "@jridgewell/resolve-uri@npm:3.1.0" - checksum: 320ceb37af56953757b28e5b90c34556157676d41e3d0a3ff88769274d62373582bb0f0276a4f2d29c3f4fdd55b82b8be5731f52d391ad2ecae9b321ee1c742d - languageName: node - linkType: hard - "@jridgewell/resolve-uri@npm:^3.1.0": version: 3.1.1 resolution: "@jridgewell/resolve-uri@npm:3.1.1" @@ -3398,13 +3373,6 @@ __metadata: languageName: node linkType: hard -"@jridgewell/sourcemap-codec@npm:1.4.14": - version: 1.4.14 - resolution: "@jridgewell/sourcemap-codec@npm:1.4.14" - checksum: 26e768fae6045481a983e48aa23d8fcd23af5da70ebd74b0649000e815e7fbb01ea2bc088c9176b3fffeb9bec02184e58f46125ef3320b30eaa1f4094cfefa38 - languageName: node - linkType: hard - "@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14": version: 1.4.15 resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" @@ -3412,17 +3380,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.13, @jridgewell/trace-mapping@npm:^0.3.15, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.9": - version: 0.3.18 - resolution: "@jridgewell/trace-mapping@npm:0.3.18" - dependencies: - "@jridgewell/resolve-uri": "npm:3.1.0" - "@jridgewell/sourcemap-codec": "npm:1.4.14" - checksum: f4fabdddf82398a797bcdbb51c574cd69b383db041a6cae1a6a91478681d6aab340c01af655cfd8c6e01cde97f63436a1445f08297cdd33587621cf05ffa0d55 - languageName: node - linkType: hard - -"@jridgewell/trace-mapping@npm:^0.3.18": +"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.13, @jridgewell/trace-mapping@npm:^0.3.15, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.19 resolution: "@jridgewell/trace-mapping@npm:0.3.19" dependencies: @@ -5898,13 +5856,6 @@ __metadata: languageName: node linkType: hard -"@sinclair/typebox@npm:^0.25.16": - version: 0.25.23 - resolution: "@sinclair/typebox@npm:0.25.23" - checksum: 8503d788f6c5c60d925d8803b19a37fa879c6a9be64c216679eb6ed745212c69ed82190f2e45b220ee39cfdb24cadecdda2102b736a6df2e008778419806c26b - languageName: node - linkType: hard - "@sinclair/typebox@npm:^0.27.8": version: 0.27.8 resolution: "@sinclair/typebox@npm:0.27.8" @@ -16737,7 +16688,7 @@ __metadata: languageName: node linkType: hard -"expect@npm:^29.0.0, expect@npm:^29.6.2": +"expect@npm:^29.0.0, expect@npm:^29.1.2, expect@npm:^29.6.2": version: 29.6.2 resolution: "expect@npm:29.6.2" dependencies: @@ -16751,19 +16702,6 @@ __metadata: languageName: node linkType: hard -"expect@npm:^29.1.2": - version: 29.4.3 - resolution: "expect@npm:29.4.3" - dependencies: - "@jest/expect-utils": "npm:^29.4.3" - jest-get-type: "npm:^29.4.3" - jest-matcher-utils: "npm:^29.4.3" - jest-message-util: "npm:^29.4.3" - jest-util: "npm:^29.4.3" - checksum: df1780fdb2005d99f8c48668e4ba7cbfb12f5c1edda76c4f10dbf012c466d919b8d51a3363a4c258de8bba4cb0600853023a1c05df66fdda4d62b95114804434 - languageName: node - linkType: hard - "exponential-backoff@npm:^3.1.1": version: 3.1.1 resolution: "exponential-backoff@npm:3.1.1" @@ -21288,18 +21226,6 @@ __metadata: languageName: node linkType: hard -"jest-diff@npm:^29.4.3": - version: 29.4.3 - resolution: "jest-diff@npm:29.4.3" - dependencies: - chalk: "npm:^4.0.0" - diff-sequences: "npm:^29.4.3" - jest-get-type: "npm:^29.4.3" - pretty-format: "npm:^29.4.3" - checksum: d43e1228e3563a46544e38c689f1d71e274efa572e22f40846a61b99251d59218370026cd39030ce9974ba1d34a3113e67e4e49b0acfb420b2613d20e2a4d18e - languageName: node - linkType: hard - "jest-diff@npm:^29.6.2": version: 29.6.2 resolution: "jest-diff@npm:29.6.2" @@ -21526,18 +21452,6 @@ __metadata: languageName: node linkType: hard -"jest-matcher-utils@npm:^29.4.3": - version: 29.4.3 - resolution: "jest-matcher-utils@npm:29.4.3" - dependencies: - chalk: "npm:^4.0.0" - jest-diff: "npm:^29.4.3" - jest-get-type: "npm:^29.4.3" - pretty-format: "npm:^29.4.3" - checksum: 43e5509dbf9b813728b926b5a0219ef278c073ee4d86ac8057986e44dd5306d6fc4949883c998ada4fb9f20016a765e8d127c21677a8dcaaf60bf39074644f10 - languageName: node - linkType: hard - "jest-message-util@npm:^28.1.3": version: 28.1.3 resolution: "jest-message-util@npm:28.1.3" @@ -21572,23 +21486,6 @@ __metadata: languageName: node linkType: hard -"jest-message-util@npm:^29.4.3": - version: 29.5.0 - resolution: "jest-message-util@npm:29.5.0" - dependencies: - "@babel/code-frame": "npm:^7.12.13" - "@jest/types": "npm:^29.5.0" - "@types/stack-utils": "npm:^2.0.0" - chalk: "npm:^4.0.0" - graceful-fs: "npm:^4.2.9" - micromatch: "npm:^4.0.4" - pretty-format: "npm:^29.5.0" - slash: "npm:^3.0.0" - stack-utils: "npm:^2.0.3" - checksum: eeb0a064e2db486428e37374422d4101a30845815a8842a0f62e77c2a82ae80837a74d5b4f58aaadfb3f19aa7d42e7d604aab1fb670cf170c46f0c46d0d725fd - languageName: node - linkType: hard - "jest-mock@npm:^28.1.3": version: 28.1.3 resolution: "jest-mock@npm:28.1.3" @@ -21941,20 +21838,6 @@ __metadata: languageName: node linkType: hard -"jest-util@npm:^29.4.3": - version: 29.5.0 - resolution: "jest-util@npm:29.5.0" - dependencies: - "@jest/types": "npm:^29.5.0" - "@types/node": "npm:*" - chalk: "npm:^4.0.0" - ci-info: "npm:^3.2.0" - graceful-fs: "npm:^4.2.9" - picomatch: "npm:^2.2.3" - checksum: 27ae6fc6221d29b31df9c071f190e0e27a9caaeca04ee1ce03f5c925ec8abf594fcf0cb57bdcb93149381415ff1f8198157332b0c76f3592065b7c3fdb35fca1 - languageName: node - linkType: hard - "jest-validate@npm:^28.1.3": version: 28.1.3 resolution: "jest-validate@npm:28.1.3" @@ -28190,17 +28073,6 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^29.4.3, pretty-format@npm:^29.5.0": - version: 29.5.0 - resolution: "pretty-format@npm:29.5.0" - dependencies: - "@jest/schemas": "npm:^29.4.3" - ansi-styles: "npm:^5.0.0" - react-is: "npm:^18.0.0" - checksum: b025cb1d2bf27b8dc338792b208811b196828ccf590a87014d9ac9406eb809324ef56151ba41d489c8a67fed94cdacc94ca003380c2795233e117a5874b2566b - languageName: node - linkType: hard - "pretty-hrtime@npm:^1.0.0, pretty-hrtime@npm:^1.0.3": version: 1.0.3 resolution: "pretty-hrtime@npm:1.0.3" @@ -29359,14 +29231,14 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:2 || 3, readable-stream@npm:3, readable-stream@npm:^3.0.2, readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0, readable-stream@npm:^3.5.0, readable-stream@npm:^3.6.0": - version: 3.6.0 - resolution: "readable-stream@npm:3.6.0" +"readable-stream@npm:2 || 3, readable-stream@npm:3, readable-stream@npm:3.6.2, readable-stream@npm:^3.0.2, readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0, readable-stream@npm:^3.5.0, readable-stream@npm:^3.6.0": + version: 3.6.2 + resolution: "readable-stream@npm:3.6.2" dependencies: inherits: "npm:^2.0.3" string_decoder: "npm:^1.1.1" util-deprecate: "npm:^1.0.1" - checksum: b80b3e6a7fafb1c79de7db541de357f4a5ee73bd70c21672f5a7c840d27bb27bdb0151e7ba2fd82c4a888df22ce0c501b0d9f3e4dfe51688876701c437d59536 + checksum: d9e3e53193adcdb79d8f10f2a1f6989bd4389f5936c6f8b870e77570853561c362bee69feca2bbb7b32368ce96a85504aa4cedf7cf80f36e6a9de30d64244048 languageName: node linkType: hard @@ -29385,17 +29257,6 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:3.6.2": - version: 3.6.2 - resolution: "readable-stream@npm:3.6.2" - dependencies: - inherits: "npm:^2.0.3" - string_decoder: "npm:^1.1.1" - util-deprecate: "npm:^1.0.1" - checksum: d9e3e53193adcdb79d8f10f2a1f6989bd4389f5936c6f8b870e77570853561c362bee69feca2bbb7b32368ce96a85504aa4cedf7cf80f36e6a9de30d64244048 - languageName: node - linkType: hard - "readable-stream@npm:^2.0.0, readable-stream@npm:^2.0.1, readable-stream@npm:^2.0.2, readable-stream@npm:^2.0.4, readable-stream@npm:^2.0.5, readable-stream@npm:^2.0.6, readable-stream@npm:^2.1.5, readable-stream@npm:^2.2.2, readable-stream@npm:^2.3.3, readable-stream@npm:^2.3.5, readable-stream@npm:~2.3.3, readable-stream@npm:~2.3.6": version: 2.3.7 resolution: "readable-stream@npm:2.3.7" From f9064cb9906cfbe093dfc5e54729f3abf682c0c3 Mon Sep 17 00:00:00 2001 From: Jiexi Luan Date: Mon, 18 Sep 2023 12:03:21 -0700 Subject: [PATCH 4/8] Lint --- ui/selectors/selectors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 8d39d6791aca..8d3a577282d7 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -752,8 +752,8 @@ export function getIpfsGateway(state) { export function getInfuraBlocked(state) { return ( - state.metamask.networksMetadata[getSelectedNetworkClientId(state)].status === - NetworkStatus.Blocked + state.metamask.networksMetadata[getSelectedNetworkClientId(state)] + .status === NetworkStatus.Blocked ); } From f0e8e6e446142efb13d32747996f85ae52dedcb4 Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Mon, 18 Sep 2023 19:39:52 +0000 Subject: [PATCH 5/8] Update LavaMoat policies --- lavamoat/build-system/policy.json | 132 ++---------------------------- 1 file changed, 8 insertions(+), 124 deletions(-) diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index 96fef5e24515..4ab9521cfbeb 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -1134,21 +1134,6 @@ "string.prototype.matchall>side-channel": true } }, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": { - "builtin": { - "os.type": true - }, - "globals": { - "process.env.LANG": true, - "process.env.LC_ALL": true, - "process.env.LC_CTYPE": true - } - }, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": { - "packages": { - "yargs>string-width": true - } - }, "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": { "builtin": { "os.homedir": true @@ -5014,7 +4999,6 @@ "@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": true } @@ -5072,20 +5056,9 @@ }, "packages": { "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": { - "builtin": { - "os.homedir": true - }, - "globals": { - "process.env": true, - "process.getuid": true, - "process.platform": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": { "globals": { "process.env.SystemRoot": true, @@ -5096,70 +5069,6 @@ "process.platform": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": { - "builtin": { - "events.EventEmitter": true, - "util": true - }, - "globals": { - "process.nextTick": true, - "process.stderr": true - }, - "packages": { - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": true, - "nyc>yargs>set-blocking": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": { - "builtin": { - "events.EventEmitter": true, - "util.inherits": true - }, - "packages": { - "koa>delegates": true, - "readable-stream": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": { - "builtin": { - "util.format": true - }, - "globals": { - "clearInterval": true, - "process": true, - "setImmediate": true, - "setInterval": true - }, - "packages": { - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": true, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>aproba": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, - "nyc>signal-exit": true, - "react>object-assign": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": { - "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, - "gulp>gulp-cli>yargs>string-width>code-point-at": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": { - "packages": { - "gulp>gulp-cli>yargs>string-width>is-fullwidth-code-point>number-is-nan": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": { - "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi>ansi-regex": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": { "builtin": { "assert": true, @@ -5171,34 +5080,9 @@ "setTimeout": true }, "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": true, "nyc>glob": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": { - "builtin": { - "assert": true, - "events.EventEmitter": true, - "fs": true, - "path.join": true, - "path.resolve": true, - "util": true - }, - "globals": { - "console.error": true, - "process.cwd": true, - "process.nextTick": true, - "process.platform": true - }, - "packages": { - "eslint>minimatch": true, - "gulp-watch>path-is-absolute": true, - "nyc>glob>fs.realpath": true, - "nyc>glob>inflight": true, - "pump>once": true, - "pumpify>inherits": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": { "globals": { "console": true, @@ -6646,13 +6530,6 @@ "process.platform": true } }, - "mockttp>portfinder>mkdirp": { - "builtin": { - "fs": true, - "path.dirname": true, - "path.resolve": true - } - }, "nock>debug": { "builtin": { "tty.isatty": true, @@ -8260,7 +8137,14 @@ "path.dirname": true }, "packages": { - "mockttp>portfinder>mkdirp": true + "stylelint>file-entry-cache>flat-cache>write>mkdirp": true + } + }, + "stylelint>file-entry-cache>flat-cache>write>mkdirp": { + "builtin": { + "fs": true, + "path.dirname": true, + "path.resolve": true } }, "stylelint>global-modules": { From 2d13a1d81f2889f875e6be231a9c79c864184c6a Mon Sep 17 00:00:00 2001 From: Jiexi Luan Date: Wed, 20 Sep 2023 10:16:37 -0700 Subject: [PATCH 6/8] add getInfuraBlocked selector spec --- ui/selectors/selectors.test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ui/selectors/selectors.test.js b/ui/selectors/selectors.test.js index 91930c94d865..b2d62666e286 100644 --- a/ui/selectors/selectors.test.js +++ b/ui/selectors/selectors.test.js @@ -737,4 +737,24 @@ describe('Selectors', () => { mockState.metamask.snapsInstallPrivacyWarningShown = null; expect(selectors.getSnapsInstallPrivacyWarningShown(mockState)).toBe(false); }); + + it('#getInfuraBlocked', () => { + let isInfuraBlocked = selectors.getInfuraBlocked(mockState); + expect(isInfuraBlocked).toBe(false); + + const modifiedMockState = { + ...mockState, + metamask: { + ...mockState.metamask, + networksMetadata: { + ...mockState.metamask.networksMetadata, + goerli: { + status: 'blocked', + }, + }, + }, + }; + isInfuraBlocked = selectors.getInfuraBlocked(modifiedMockState); + expect(isInfuraBlocked).toBe(true); + }); }); From d9a910325f456516bffbffabc9635d11ca36d006 Mon Sep 17 00:00:00 2001 From: Jiexi Luan Date: Thu, 21 Sep 2023 11:37:22 -0700 Subject: [PATCH 7/8] Bring in networkcontroller bump --- lavamoat/build-system/policy.json | 132 ++++++++++++++++++++++++++++-- package.json | 1 - 2 files changed, 124 insertions(+), 9 deletions(-) diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index baf15bfb8aa7..71f0a414cbd6 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -1136,6 +1136,21 @@ "string.prototype.matchall>side-channel": true } }, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": { + "builtin": { + "os.type": true + }, + "globals": { + "process.env.LANG": true, + "process.env.LC_ALL": true, + "process.env.LC_CTYPE": true + } + }, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": { + "packages": { + "yargs>string-width": true + } + }, "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": { "builtin": { "os.homedir": true @@ -4998,6 +5013,7 @@ "@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": true } @@ -5055,9 +5071,20 @@ }, "packages": { "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": { + "builtin": { + "os.homedir": true + }, + "globals": { + "process.env": true, + "process.getuid": true, + "process.platform": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": { "globals": { "process.env.SystemRoot": true, @@ -5068,6 +5095,70 @@ "process.platform": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": { + "builtin": { + "events.EventEmitter": true, + "util": true + }, + "globals": { + "process.nextTick": true, + "process.stderr": true + }, + "packages": { + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": true, + "nyc>yargs>set-blocking": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": { + "builtin": { + "events.EventEmitter": true, + "util.inherits": true + }, + "packages": { + "koa>delegates": true, + "readable-stream": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": { + "builtin": { + "util.format": true + }, + "globals": { + "clearInterval": true, + "process": true, + "setImmediate": true, + "setInterval": true + }, + "packages": { + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": true, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>aproba": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, + "nyc>signal-exit": true, + "react>object-assign": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": { + "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, + "gulp>gulp-cli>yargs>string-width>code-point-at": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": { + "packages": { + "gulp>gulp-cli>yargs>string-width>is-fullwidth-code-point>number-is-nan": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": { + "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi>ansi-regex": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": { "builtin": { "assert": true, @@ -5079,9 +5170,34 @@ "setTimeout": true }, "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": true, "nyc>glob": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": { + "builtin": { + "assert": true, + "events.EventEmitter": true, + "fs": true, + "path.join": true, + "path.resolve": true, + "util": true + }, + "globals": { + "console.error": true, + "process.cwd": true, + "process.nextTick": true, + "process.platform": true + }, + "packages": { + "eslint>minimatch": true, + "gulp-watch>path-is-absolute": true, + "nyc>glob>fs.realpath": true, + "nyc>glob>inflight": true, + "pump>once": true, + "pumpify>inherits": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": { "globals": { "console": true, @@ -6525,6 +6641,13 @@ "process.platform": true } }, + "mockttp>portfinder>mkdirp": { + "builtin": { + "fs": true, + "path.dirname": true, + "path.resolve": true + } + }, "nock>debug": { "builtin": { "tty.isatty": true, @@ -8132,14 +8255,7 @@ "path.dirname": true }, "packages": { - "stylelint>file-entry-cache>flat-cache>write>mkdirp": true - } - }, - "stylelint>file-entry-cache>flat-cache>write>mkdirp": { - "builtin": { - "fs": true, - "path.dirname": true, - "path.resolve": true + "mockttp>portfinder>mkdirp": true } }, "stylelint>global-modules": { diff --git a/package.json b/package.json index b3902602b561..0ff9576f0d03 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,6 @@ "audit": "yarn npm audit --recursive --environment production --severity moderate" }, "resolutions": { - "@metamask/network-controller@^12.0.0": "npm:@metamask-previews/network-controller@12.1.2-preview.0f6a2fb", "simple-update-notifier@^1.0.0": "^2.0.0", "@babel/core": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch", "@babel/runtime": "patch:@babel/runtime@npm%3A7.18.9#./.yarn/patches/@babel-runtime-npm-7.18.9-28ca6b5f61.patch", From 888a2476f2a7ea2b5a6067841e1d3a7f104de5ad Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Thu, 21 Sep 2023 19:15:55 +0000 Subject: [PATCH 8/8] Update LavaMoat policies --- lavamoat/build-system/policy.json | 132 ++---------------------------- 1 file changed, 8 insertions(+), 124 deletions(-) diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index 71f0a414cbd6..baf15bfb8aa7 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -1136,21 +1136,6 @@ "string.prototype.matchall>side-channel": true } }, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": { - "builtin": { - "os.type": true - }, - "globals": { - "process.env.LANG": true, - "process.env.LC_ALL": true, - "process.env.LC_CTYPE": true - } - }, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": { - "packages": { - "yargs>string-width": true - } - }, "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": { "builtin": { "os.homedir": true @@ -5013,7 +4998,6 @@ "@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": true } @@ -5071,20 +5055,9 @@ }, "packages": { "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": { - "builtin": { - "os.homedir": true - }, - "globals": { - "process.env": true, - "process.getuid": true, - "process.platform": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": { "globals": { "process.env.SystemRoot": true, @@ -5095,70 +5068,6 @@ "process.platform": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": { - "builtin": { - "events.EventEmitter": true, - "util": true - }, - "globals": { - "process.nextTick": true, - "process.stderr": true - }, - "packages": { - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": true, - "nyc>yargs>set-blocking": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": { - "builtin": { - "events.EventEmitter": true, - "util.inherits": true - }, - "packages": { - "koa>delegates": true, - "readable-stream": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": { - "builtin": { - "util.format": true - }, - "globals": { - "clearInterval": true, - "process": true, - "setImmediate": true, - "setInterval": true - }, - "packages": { - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": true, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>aproba": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, - "nyc>signal-exit": true, - "react>object-assign": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": { - "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, - "gulp>gulp-cli>yargs>string-width>code-point-at": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": { - "packages": { - "gulp>gulp-cli>yargs>string-width>is-fullwidth-code-point>number-is-nan": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": { - "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi>ansi-regex": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": { "builtin": { "assert": true, @@ -5170,34 +5079,9 @@ "setTimeout": true }, "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": true, "nyc>glob": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": { - "builtin": { - "assert": true, - "events.EventEmitter": true, - "fs": true, - "path.join": true, - "path.resolve": true, - "util": true - }, - "globals": { - "console.error": true, - "process.cwd": true, - "process.nextTick": true, - "process.platform": true - }, - "packages": { - "eslint>minimatch": true, - "gulp-watch>path-is-absolute": true, - "nyc>glob>fs.realpath": true, - "nyc>glob>inflight": true, - "pump>once": true, - "pumpify>inherits": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": { "globals": { "console": true, @@ -6641,13 +6525,6 @@ "process.platform": true } }, - "mockttp>portfinder>mkdirp": { - "builtin": { - "fs": true, - "path.dirname": true, - "path.resolve": true - } - }, "nock>debug": { "builtin": { "tty.isatty": true, @@ -8255,7 +8132,14 @@ "path.dirname": true }, "packages": { - "mockttp>portfinder>mkdirp": true + "stylelint>file-entry-cache>flat-cache>write>mkdirp": true + } + }, + "stylelint>file-entry-cache>flat-cache>write>mkdirp": { + "builtin": { + "fs": true, + "path.dirname": true, + "path.resolve": true } }, "stylelint>global-modules": {