1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Merge pull request #20175 from MetaMask/Version-v10.34.1

Version v10.34.1 RC
This commit is contained in:
Dan J Miller 2023-07-26 01:29:33 -02:30 committed by GitHub
commit ddac73b5ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 368 additions and 34 deletions

View File

@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [10.34.1]
### Fixed
- Fix bug that could cause a failure in the persistence of network related data ([#20080](https://github.com/MetaMask/metamask-extension/pull/20080))
- Fix ([#20080](https://github.com/MetaMask/metamask-extension/pull/20080))
## [10.34.0]
### Added
- Add a security quiz to the SRP reveal ([#19283](https://github.com/MetaMask/metamask-extension/pull/19283))
@ -3853,7 +3858,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Uncategorized
- Added the ability to restore accounts from seed words.
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.34.0...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.34.1...HEAD
[10.34.1]: https://github.com/MetaMask/metamask-extension/compare/v10.34.0...v10.34.1
[10.34.0]: https://github.com/MetaMask/metamask-extension/compare/v10.33.1...v10.34.0
[10.33.1]: https://github.com/MetaMask/metamask-extension/compare/v10.33.0...v10.33.1
[10.33.0]: https://github.com/MetaMask/metamask-extension/compare/v10.32.0...v10.33.0

View File

@ -352,6 +352,6 @@ function toMetamaskUrl(origUrl) {
if (!filePath) {
return origUrl;
}
const metamaskUrl = `metamask${filePath}`;
const metamaskUrl = `/metamask${filePath}`;
return metamaskUrl;
}

View File

@ -0,0 +1,224 @@
import { migrate, version } from './089';
jest.mock('uuid', () => {
const actual = jest.requireActual('uuid');
return {
...actual,
v4: jest.fn(),
};
});
describe('migration #89', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 88,
},
data: {},
};
const newStorage = await migrate(oldStorage);
expect(newStorage.meta).toStrictEqual({
version,
});
});
it('should return state unaltered if there is no network controller state', async () => {
const oldData = {
other: 'data',
};
const oldStorage = {
meta: {
version: 88,
},
data: oldData,
};
const newStorage = await migrate(oldStorage);
expect(newStorage.data).toStrictEqual(oldData);
});
it('should return state unaltered if there is no network controller providerConfig state', async () => {
const oldData = {
other: 'data',
NetworkController: {
networkConfigurations: {
id1: {
foo: 'bar',
},
},
},
};
const oldStorage = {
meta: {
version: 88,
},
data: oldData,
};
const newStorage = await migrate(oldStorage);
expect(newStorage.data).toStrictEqual(oldData);
});
it('should return state unaltered if the providerConfig already has an id', async () => {
const oldData = {
other: 'data',
NetworkController: {
networkConfigurations: {
id1: {
foo: 'bar',
},
},
providerConfig: {
id: 'test',
},
},
};
const oldStorage = {
meta: {
version: 88,
},
data: oldData,
};
const newStorage = await migrate(oldStorage);
expect(newStorage.data).toStrictEqual(oldData);
});
it('should return state unaltered if there is no network config with the same rpcUrl and the providerConfig', async () => {
const oldData = {
other: 'data',
NetworkController: {
networkConfigurations: {
id1: {
foo: 'bar',
rpcUrl: 'http://foo.bar',
},
},
providerConfig: {
rpcUrl: 'http://baz.buzz',
},
},
};
const oldStorage = {
meta: {
version: 88,
},
data: oldData,
};
const newStorage = await migrate(oldStorage);
expect(newStorage.data).toStrictEqual(oldData);
});
it('should update the provider config to have the id of a network config with the same rpcUrl', async () => {
const oldData = {
other: 'data',
NetworkController: {
networkConfigurations: {
id1: {
foo: 'bar',
rpcUrl: 'http://foo.bar',
id: 'test',
},
},
providerConfig: {
rpcUrl: 'http://foo.bar',
},
},
};
const oldStorage = {
meta: {
version: 88,
},
data: oldData,
};
const newStorage = await migrate(oldStorage);
expect(newStorage.data).toStrictEqual({
other: 'data',
NetworkController: {
networkConfigurations: {
id1: {
foo: 'bar',
rpcUrl: 'http://foo.bar',
id: 'test',
},
},
providerConfig: {
rpcUrl: 'http://foo.bar',
id: 'test',
},
},
});
});
it('should update the provider config to have the id of a network config with the same rpcUrl, even if there are other networks with the same chainId', async () => {
const oldData = {
other: 'data',
NetworkController: {
networkConfigurations: {
id1: {
foo: 'bar',
rpcUrl: 'http://fizz.buzz',
id: 'FAILEDtest',
chainId: 1,
},
id2: {
foo: 'bar',
rpcUrl: 'http://foo.bar',
id: 'PASSEDtest',
},
id3: {
foo: 'bar',
rpcUrl: 'http://baz.buzz',
id: 'FAILEDtest',
chainId: 1,
},
},
providerConfig: {
rpcUrl: 'http://foo.bar',
chainId: 1,
},
},
};
const oldStorage = {
meta: {
version: 88,
},
data: oldData,
};
const newStorage = await migrate(oldStorage);
expect(newStorage.data).toStrictEqual({
other: 'data',
NetworkController: {
networkConfigurations: {
id1: {
foo: 'bar',
rpcUrl: 'http://fizz.buzz',
id: 'FAILEDtest',
chainId: 1,
},
id2: {
foo: 'bar',
rpcUrl: 'http://foo.bar',
id: 'PASSEDtest',
},
id3: {
foo: 'bar',
rpcUrl: 'http://baz.buzz',
id: 'FAILEDtest',
chainId: 1,
},
},
providerConfig: {
rpcUrl: 'http://foo.bar',
id: 'PASSEDtest',
chainId: 1,
},
},
});
});
});

View File

@ -0,0 +1,71 @@
import { hasProperty, isObject } from '@metamask/utils';
import { cloneDeep } from 'lodash';
export const version = 89;
/**
* Add an `id` to the `providerConfig` object.
*
* @param originalVersionedData - Versioned MetaMask extension state, exactly what we persist to dist.
* @param originalVersionedData.meta - State metadata.
* @param originalVersionedData.meta.version - The current state version.
* @param originalVersionedData.data - The persisted MetaMask state, keyed by controller.
* @returns Updated versioned MetaMask extension state.
*/
export async function migrate(originalVersionedData: {
meta: { version: number };
data: Record<string, unknown>;
}) {
const versionedData = cloneDeep(originalVersionedData);
versionedData.meta.version = version;
versionedData.data = transformState(versionedData.data);
return versionedData;
}
function transformState(state: Record<string, unknown>) {
if (
hasProperty(state, 'NetworkController') &&
isObject(state.NetworkController) &&
hasProperty(state.NetworkController, 'providerConfig') &&
isObject(state.NetworkController.providerConfig)
) {
const { networkConfigurations, providerConfig } = state.NetworkController;
if (!isObject(networkConfigurations)) {
return state;
}
if (providerConfig.id) {
return state;
}
let newProviderConfigId;
for (const networkConfigurationId of Object.keys(networkConfigurations)) {
const networkConfiguration =
networkConfigurations[networkConfigurationId];
if (!isObject(networkConfiguration)) {
return state;
}
if (networkConfiguration.rpcUrl === providerConfig.rpcUrl) {
newProviderConfigId = networkConfiguration.id;
break;
}
}
if (!newProviderConfigId) {
return state;
}
state.NetworkController.providerConfig = {
...providerConfig,
id: newProviderConfigId,
};
return {
...state,
NetworkController: state.NetworkController,
};
}
return state;
}

View File

@ -92,6 +92,7 @@ import * as m085 from './085';
import * as m086 from './086';
import * as m087 from './087';
import * as m088 from './088';
import * as m089 from './089';
const migrations = [
m002,
@ -181,6 +182,7 @@ const migrations = [
m086,
m087,
m088,
m089,
];
export default migrations;

View File

@ -99,6 +99,8 @@ async function defineAndRunBuildTasks() {
'navigator',
'harden',
'console',
'WeakSet',
'Event',
'Image', // Used by browser to generate notifications
// globals chromedriver needs to function
/cdc_[a-zA-Z0-9]+_[a-zA-Z]+/iu,

View File

@ -31,7 +31,7 @@ function upload_sourcemaps {
local release="${1}"; shift
local dist_directory="${1}"; shift
sentry-cli releases files "${release}" upload-sourcemaps "${dist_directory}"/chrome/*.js "${dist_directory}"/sourcemaps/ --rewrite --url-prefix 'metamask'
sentry-cli releases files "${release}" upload-sourcemaps "${dist_directory}"/chrome/*.js "${dist_directory}"/sourcemaps/ --rewrite --url-prefix '/metamask'
}
function main {

View File

@ -1527,6 +1527,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1769,6 +1770,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1911,6 +1913,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1946,6 +1949,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,

View File

@ -1274,6 +1274,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1291,6 +1292,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1653,6 +1655,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1992,6 +1995,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2198,6 +2202,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2367,6 +2372,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2404,6 +2410,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2437,6 +2444,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,

View File

@ -1274,6 +1274,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1291,6 +1292,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1653,6 +1655,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1992,6 +1995,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2198,6 +2202,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2367,6 +2372,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2404,6 +2410,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2437,6 +2444,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,

View File

@ -1527,6 +1527,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1769,6 +1770,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1911,6 +1913,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1946,6 +1949,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,

View File

@ -1748,6 +1748,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -1990,6 +1991,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2132,6 +2134,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
@ -2167,6 +2170,7 @@
"TextEncoder": true
},
"packages": {
"@metamask/key-tree>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,

View File

@ -1124,13 +1124,6 @@
"@metamask/jazzicon>color>color-convert>color-name": true
}
},
"@sentry/cli>mkdirp": {
"builtin": {
"fs": true,
"path.dirname": true,
"path.resolve": true
}
},
"@storybook/addon-knobs>qs": {
"packages": {
"string.prototype.matchall>side-channel": true
@ -8153,7 +8146,14 @@
"path.dirname": true
},
"packages": {
"@sentry/cli>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": {

View File

@ -1,6 +1,6 @@
{
"name": "metamask-crx",
"version": "10.34.0",
"version": "10.34.1",
"private": true,
"repository": {
"type": "git",
@ -227,7 +227,7 @@
"@metamask/announcement-controller": "^4.0.0",
"@metamask/approval-controller": "^3.3.0",
"@metamask/assets-controllers": "^9.2.0",
"@metamask/base-controller": "^3.1.0",
"@metamask/base-controller": "^3.2.0",
"@metamask/browser-passworder": "^4.1.0",
"@metamask/contract-metadata": "^2.3.1",
"@metamask/controller-utils": "^4.2.0",
@ -382,7 +382,7 @@
"@metamask/forwarder": "^1.1.0",
"@metamask/phishing-warning": "^2.1.0",
"@metamask/test-dapp": "^7.0.1",
"@sentry/cli": "^1.58.0",
"@sentry/cli": "^2.19.4",
"@storybook/addon-a11y": "^7.0.11",
"@storybook/addon-actions": "^7.0.11",
"@storybook/addon-essentials": "^7.0.11",

View File

@ -3940,13 +3940,13 @@ __metadata:
languageName: node
linkType: hard
"@metamask/base-controller@npm:^3.0.0, @metamask/base-controller@npm:^3.1.0":
version: 3.1.0
resolution: "@metamask/base-controller@npm:3.1.0"
"@metamask/base-controller@npm:^3.0.0, @metamask/base-controller@npm:^3.1.0, @metamask/base-controller@npm:^3.2.0":
version: 3.2.0
resolution: "@metamask/base-controller@npm:3.2.0"
dependencies:
"@metamask/utils": ^5.0.2
"@metamask/utils": ^6.2.0
immer: ^9.0.6
checksum: fc1597a099e6d28bd089df936ca349d6c38c2e1b0f0737385cba30c34a5239241519eb172d77c70f8db2604f4dc5724f6893affe42bdd104cef98f9cfd6f1db8
checksum: 3be6f2594309c013e07f83c4bb8271e1e99f02b6ff829c18b5e7218fbab4e6a9e03bcb49056704ce47f84ae2f38b1bc1c10284ec538aad56ed7b554ef2d3e189
languageName: node
linkType: hard
@ -5005,16 +5005,17 @@ __metadata:
languageName: node
linkType: hard
"@metamask/utils@npm:^6.0.0, @metamask/utils@npm:^6.0.1, @metamask/utils@npm:^6.1.0":
version: 6.1.0
resolution: "@metamask/utils@npm:6.1.0"
"@metamask/utils@npm:^6.0.0, @metamask/utils@npm:^6.0.1, @metamask/utils@npm:^6.1.0, @metamask/utils@npm:^6.2.0":
version: 6.2.0
resolution: "@metamask/utils@npm:6.2.0"
dependencies:
"@ethereumjs/tx": ^4.1.2
"@noble/hashes": ^1.3.1
"@types/debug": ^4.1.7
debug: ^4.3.4
semver: ^7.3.8
superstruct: ^1.0.3
checksum: d4eac3ce3c08674b8e9ef838d1661a5025690c6f266c26ebdb8e8d0da11fce786e54c326b5d9c6d33b262f37e7057e31d6545a3715613bd0a5bfa10e7755643a
checksum: 0bc675358ecc09b3bc04da613d73666295d7afa51ff6b8554801585966900b24b8545bd93b8b2e9a17db867ebe421fe884baf3558ec4ca3199fa65504f677c1b
languageName: node
linkType: hard
@ -5596,18 +5597,18 @@ __metadata:
languageName: node
linkType: hard
"@sentry/cli@npm:^1.58.0":
version: 1.58.0
resolution: "@sentry/cli@npm:1.58.0"
"@sentry/cli@npm:^2.19.4":
version: 2.19.4
resolution: "@sentry/cli@npm:2.19.4"
dependencies:
https-proxy-agent: ^5.0.0
mkdirp: ^0.5.5
node-fetch: ^2.6.0
node-fetch: ^2.6.7
progress: ^2.0.3
proxy-from-env: ^1.1.0
which: ^2.0.2
bin:
sentry-cli: bin/sentry-cli
checksum: fc781bbffcf5cd970bb023168421ad89bca4184c2ddfbfddde92f4f5333c8b9075e9e16a8a4b192ecc3b197ac97062715e7b350c306ccc538fc01b955b06c3bb
checksum: 1f2442857a5eec2bc6f872a633d88fc2f11ed7f434db36627a034d904390f4cbbb4dccc33c571a8815e423cd36b863c72621298d49a1541b28370c7f7308f0dc
languageName: node
linkType: hard
@ -24474,7 +24475,7 @@ __metadata:
"@metamask/approval-controller": ^3.3.0
"@metamask/assets-controllers": ^9.2.0
"@metamask/auto-changelog": ^2.1.0
"@metamask/base-controller": ^3.1.0
"@metamask/base-controller": ^3.2.0
"@metamask/browser-passworder": ^4.1.0
"@metamask/contract-metadata": ^2.3.1
"@metamask/controller-utils": ^4.2.0
@ -24529,7 +24530,7 @@ __metadata:
"@reduxjs/toolkit": ^1.6.2
"@segment/loosely-validate-event": ^2.0.0
"@sentry/browser": ^7.53.0
"@sentry/cli": ^1.58.0
"@sentry/cli": ^2.19.4
"@sentry/integrations": ^7.53.0
"@sentry/types": ^7.53.0
"@sentry/utils": ^7.53.0
@ -26117,8 +26118,8 @@ __metadata:
linkType: hard
"node-fetch@npm:^2, node-fetch@npm:^2.6.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.11, node-fetch@npm:^2.6.7, node-fetch@npm:~2.6.1":
version: 2.6.11
resolution: "node-fetch@npm:2.6.11"
version: 2.6.12
resolution: "node-fetch@npm:2.6.12"
dependencies:
whatwg-url: ^5.0.0
peerDependencies:
@ -26126,7 +26127,7 @@ __metadata:
peerDependenciesMeta:
encoding:
optional: true
checksum: 249d0666a9497553384d46b5ab296ba223521ac88fed4d8a17d6ee6c2efb0fc890f3e8091cafe7f9fba8151a5b8d925db2671543b3409a56c3cd522b468b47b3
checksum: 3bc1655203d47ee8e313c0d96664b9673a3d4dd8002740318e9d27d14ef306693a4b2ef8d6525775056fd912a19e23f3ac0d7111ad8925877b7567b29a625592
languageName: node
linkType: hard