Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update v12.6.0 with v12.5.0 #27947

Closed
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
cc8d487
Version v12.4.0
metamaskbot Aug 30, 2024
bdc819a
fix: move porfolio button next to price amount (#26867) (#26897)
jonybur Sep 4, 2024
e0ee077
Merge remote-tracking branch 'origin/Version-v12.3.0' into v12.4.0-me…
danjm Sep 24, 2024
8397b30
Update LavaMoat policies
metamaskbot Sep 25, 2024
ea1784b
Lint fix
danjm Sep 25, 2024
2f18de0
Merge remote-tracking branch 'origin/Version-v12.3.0' into v12.4.0-me…
danjm Sep 25, 2024
5eea667
Merge remote-tracking branch 'origin/master' into v12.4.0-merge-v12.3.0
danjm Sep 25, 2024
94ddd17
Remove unused dependency
danjm Sep 25, 2024
e90736a
Update LavaMoat policies
metamaskbot Sep 25, 2024
0b370f4
Merge pull request #27362 from MetaMask/v12.4.0-merge-v12.3.0
danjm Sep 26, 2024
096d4d2
Version v12.5.0
danjm Sep 26, 2024
aee1f55
Fix storybook tests
danjm Sep 26, 2024
acc47b3
Get changelog lint passing
danjm Sep 26, 2024
99811e0
Merge branch 'master' into resolve-conflict-12.4.0
chloeYue Oct 1, 2024
bc08781
Merge pull request #27541 from MetaMask/resolve-conflict-12.4.0
Gudahtt Oct 1, 2024
0c1e287
fix: [cherry-pick][V12.5.0] account syncing fixes (#27534)
mathieuartu Oct 1, 2024
c414b28
Cherry-pick ab37660 (PR ##27543) to V12.4.0 (#27577)
k-g-j Oct 2, 2024
f072921
fix: cherry pick incomplete transactions on startup (#27537)
vinistevam Oct 3, 2024
9a18f1c
fix (cherry-pick): disable transaction data decode if deployment (#27…
matthewwalsh0 Oct 4, 2024
fabf62d
fix (cherry-pick): add amount row for contract deployment (#27594) (#…
vinistevam Oct 4, 2024
41e7889
cherry-pick: Recreate offscreen document if it already exists (#27653)
FrederikBolding Oct 7, 2024
be0396d
feat: Double Sentry performance trace sample rate (#27468) (#27663)
Gudahtt Oct 7, 2024
679a8f5
Merge remote-tracking branch 'origin/Version-v12.4.0' into Version-v1…
danjm Oct 7, 2024
160f6dd
Lint fix
danjm Oct 7, 2024
b161946
Lint changelog
danjm Oct 7, 2024
ff84f84
chore: fix deps audit (#27620) (#27673)
Gudahtt Oct 7, 2024
19db789
Merge pull request #27674 from MetaMask/v12.5.0-merge-v12.4.0
danjm Oct 7, 2024
c8f966c
chore: Temporarily ignore advisory (#27676)
Gudahtt Oct 8, 2024
9446efa
fix: issue with default nonce value being wrong when switching networ…
jpuri Oct 8, 2024
dfbead6
chore: Fix changelog for v12.4.0 (#27558)
chloeYue Oct 8, 2024
73ad771
Merge pull request #27287 from MetaMask/Version-v12.4.0
danjm Oct 8, 2024
13c758a
Version v12.4.1
metamaskbot Oct 9, 2024
3d096c2
fix: remove old phishfort list from clients (#27743) (#27746)
AugmentedMode Oct 10, 2024
3ebc8a7
fix: cherry pick swaps undefined object access crash hotfix into v12.…
jclancy93 Oct 10, 2024
ac46289
Update CHANGELOG.md for v12.4.1 (#27775)
danjm Oct 10, 2024
ccb9706
Merge pull request #27733 from MetaMask/Version-v12.4.1
danjm Oct 10, 2024
073c9fe
perf (cherry-pick): add tags to UI startup trace (#27550) (#27727)
matthewwalsh0 Oct 11, 2024
0736532
fix: [cherry-pick][V12.5.0] account syncing bugfix (#27761)
mathieuartu Oct 11, 2024
89273ca
Merge remote-tracking branch 'origin/master' into update-v12.5.0-with…
hjetpoluru Oct 11, 2024
ce5d7d1
cherry-pick: "revert: use networkClientId to resolve chainId in PPOM …
adonesky1 Oct 14, 2024
6e73681
cherry-pick: Fix Snaps usage of PhishingController (#27833)
FrederikBolding Oct 15, 2024
5b4c287
fix: [cherry-pick][V12.5.0] sticky footer UI issue on Snaps Home Page…
david0xd Oct 15, 2024
c3a8cf8
Fixed the changelog error
hjetpoluru Oct 15, 2024
aa7634f
cherry-pick: issue with nonce not updating correctly where there are …
jpuri Oct 15, 2024
516af04
Version v12.4.2
metamaskbot Oct 15, 2024
1a65ee7
Fix/linea bufix 12.5 (#27876)
martahj Oct 15, 2024
e4672a8
fix: Correct conditions for triggering name lookup during send (#27880)
FrederikBolding Oct 16, 2024
9221f8e
chore: Update RC hotfix changelog (#27900)
FrederikBolding Oct 16, 2024
36fe5a8
chore: Cherry pick f523617a9 to v12.4.2 (#27899)
danjm Oct 16, 2024
6568a21
Merge branch 'Version-v12.5.0' into update-v12.5.0-with-master
hjetpoluru Oct 16, 2024
7e1744a
Merge pull request #27797 from MetaMask/update-v12.5.0-with-master
danjm Oct 16, 2024
626289d
Merge pull request #27879 from MetaMask/Version-v12.4.2
Gudahtt Oct 16, 2024
43a66d4
Merge remote-tracking branch 'origin/master' into merge-hotfix-v12.4.2
hjetpoluru Oct 17, 2024
6ec1ce9
Fixed dulipcates, required changes for test and changelog
hjetpoluru Oct 17, 2024
9f77f8f
Fixed the test
hjetpoluru Oct 17, 2024
154d25a
Merge pull request #27938 from MetaMask/merge-hotfix-v12.4.2
danjm Oct 17, 2024
6850005
Merge remote-tracking branch 'origin/Version-v12.5.0' into update-v12…
hjetpoluru Oct 17, 2024
cc50367
Fixed preinstalled-snap and changelog
hjetpoluru Oct 17, 2024
5666194
Fix lint
hjetpoluru Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .yarn/patches/@metamask-snaps-utils-npm-8.1.1-7d5dd6a26a.patch

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ npmAuditIgnoreAdvisories:
# not appear to be used.
- 1092461

# Issue: Sentry SDK Prototype Pollution gadget in JavaScript SDKs
# URL: https://github.com/advisories/GHSA-593m-55hh-j8gv
# Not easily fixed in this version, will be fixed in v12.5.0
# Minimally effects the extension due to usage of LavaMoat + SES lockdown.
- 1099839

# Temp fix for https://github.com/MetaMask/metamask-extension/pull/16920 for the sake of 11.7.1 hotfix
# This will be removed in this ticket https://github.com/MetaMask/metamask-extension/issues/22299
- 'ts-custom-error (deprecation)'
Expand Down Expand Up @@ -114,15 +120,9 @@ npmAuditIgnoreAdvisories:
# upon old versions of ethereumjs-utils.
- 'ethereum-cryptography (deprecation)'

# Currently only dependent on deprecated @metamask/types as it is brought in
# by @metamask/keyring-api. Updating the dependency in keyring-api will
# remove this.
- '@metamask/types (deprecation)'

# @metamask/keyring-api also depends on @metamask/snaps-ui which is
# deprecated. Replacing that dependency with @metamask/snaps-sdk will remove
# this.
- '@metamask/snaps-ui (deprecation)'
# Currently in use for the network list drag and drop functionality.
# Maintenance has stopped and the project will be archived in 2025.
- 'react-beautiful-dnd (deprecation)'

npmRegistries:
'https://npm.pkg.github.com':
Expand Down
416 changes: 44 additions & 372 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/scripts/controllers/swaps/swaps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,6 @@ describe('SwapsController', function () {
oldState.swapsState.swapsStxGetTransactionsRefreshTime,
swapsStxBatchStatusRefreshTime:
oldState.swapsState.swapsStxBatchStatusRefreshTime,
swapsStxStatusDeadline: oldState.swapsState.swapsStxStatusDeadline,
});
});

Expand Down Expand Up @@ -1175,6 +1174,7 @@ describe('SwapsController', function () {
const swapsStxBatchStatusRefreshTime = 0;
const swapsStxGetTransactionsRefreshTime = 0;
const swapsStxStatusDeadline = 0;

swapsController.__test__updateState({
swapsState: {
...swapsController.state.swapsState,
Expand Down
140 changes: 79 additions & 61 deletions app/scripts/lib/ppom/ppom-middleware.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { type Hex, JsonRpcResponseStruct } from '@metamask/utils';
import { detectSIWE, SIWEMessage } from '@metamask/controller-utils';

import { CHAIN_IDS } from '../../../../shared/constants/network';

import {
BlockaidReason,
BlockaidResultType,
} from '../../../../shared/constants/security-provider';
import { flushPromises } from '../../../../test/lib/timer-helpers';
import { mockNetworkState } from '../../../../test/stub/networks';
import { createPPOMMiddleware, PPOMMiddlewareRequest } from './ppom-middleware';
import {
generateSecurityAlertId,
Expand Down Expand Up @@ -36,18 +36,22 @@ const REQUEST_MOCK = {
params: [],
id: '',
jsonrpc: '2.0' as const,
origin: 'test.com',
networkClientId: 'networkClientId',
};

const createMiddleware = (
options: {
chainId?: Hex;
chainId?: Hex | null;
error?: Error;
securityAlertsEnabled?: boolean;
} = {},
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
updateSecurityAlertResponse?: any;
} = {
updateSecurityAlertResponse: () => undefined,
},
) => {
const { chainId, error, securityAlertsEnabled } = options;
const { chainId, error, securityAlertsEnabled, updateSecurityAlertResponse } =
options;

const ppomController = {};

Expand All @@ -66,9 +70,10 @@ const createMiddleware = (
}

const networkController = {
getNetworkConfigurationByNetworkClientId: jest
.fn()
.mockReturnValue({ chainId: chainId || CHAIN_IDS.MAINNET }),
state: {
...mockNetworkState({ chainId: chainId || CHAIN_IDS.MAINNET }),
...(chainId === null ? { providerConfig: {} } : undefined),
},
};

const appStateController = {
Expand All @@ -79,9 +84,7 @@ const createMiddleware = (
listAccounts: () => [{ address: INTERNAL_ACCOUNT_ADDRESS }],
};

const updateSecurityAlertResponse = jest.fn();

const middleware = createPPOMMiddleware(
return createPPOMMiddleware(
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ppomController as any,
Expand All @@ -98,16 +101,6 @@ const createMiddleware = (
accountsController as any,
updateSecurityAlertResponse,
);

return {
middleware,
ppomController,
preferenceController,
networkController,
appStateController,
accountsController,
updateSecurityAlertResponse,
};
};

describe('PPOMMiddleware', () => {
Expand Down Expand Up @@ -135,37 +128,24 @@ describe('PPOMMiddleware', () => {
};
});

it('gets the network configuration for the request networkClientId', async () => {
const { middleware, networkController } = createMiddleware();

const req = {
...REQUEST_MOCK,
method: 'eth_sendTransaction',
securityAlertResponse: undefined,
};

await middleware(req, { ...JsonRpcResponseStruct.TYPE }, () => undefined);

await flushPromises();

expect(
networkController.getNetworkConfigurationByNetworkClientId,
).toHaveBeenCalledTimes(1);
expect(
networkController.getNetworkConfigurationByNetworkClientId,
).toHaveBeenCalledWith('networkClientId');
});

it('updates alert response after validating request', async () => {
const { middleware, updateSecurityAlertResponse } = createMiddleware();
const updateSecurityAlertResponse = jest.fn();

const middlewareFunction = createMiddleware({
updateSecurityAlertResponse,
});

const req = {
...REQUEST_MOCK,
method: 'eth_sendTransaction',
securityAlertResponse: undefined,
};

await middleware(req, { ...JsonRpcResponseStruct.TYPE }, () => undefined);
await middlewareFunction(
req,
{ ...JsonRpcResponseStruct.TYPE },
() => undefined,
);

await flushPromises();

Expand All @@ -178,15 +158,19 @@ describe('PPOMMiddleware', () => {
});

it('adds loading response to confirmation requests while validation is in progress', async () => {
const { middleware } = createMiddleware();
const middlewareFunction = createMiddleware();

const req: PPOMMiddlewareRequest<(string | { to: string })[]> = {
...REQUEST_MOCK,
method: 'eth_sendTransaction',
securityAlertResponse: undefined,
};

await middleware(req, { ...JsonRpcResponseStruct.TYPE }, () => undefined);
await middlewareFunction(
req,
{ ...JsonRpcResponseStruct.TYPE },
() => undefined,
);

expect(req.securityAlertResponse?.reason).toBe(BlockaidReason.inProgress);
expect(req.securityAlertResponse?.result_type).toBe(
Expand All @@ -195,7 +179,7 @@ describe('PPOMMiddleware', () => {
});

it('does not do validation if the user has not enabled the preference', async () => {
const { middleware } = createMiddleware({
const middlewareFunction = createMiddleware({
securityAlertsEnabled: false,
});

Expand All @@ -206,15 +190,37 @@ describe('PPOMMiddleware', () => {
};

// @ts-expect-error Passing in invalid input for testing purposes
await middleware(req, undefined, () => undefined);
await middlewareFunction(req, undefined, () => undefined);

expect(req.securityAlertResponse).toBeUndefined();
expect(validateRequestWithPPOM).not.toHaveBeenCalled();
});

it('does not do validation if unable to get the chainId from the network provider config', async () => {
isChainSupportedMock.mockResolvedValue(false);
const middlewareFunction = createMiddleware({
chainId: null,
});

const req = {
...REQUEST_MOCK,
method: 'eth_sendTransaction',
securityAlertResponse: undefined,
};

await middlewareFunction(
req,
{ ...JsonRpcResponseStruct.TYPE },
() => undefined,
);

expect(req.securityAlertResponse).toBeUndefined();
expect(validateRequestWithPPOM).not.toHaveBeenCalled();
});

it('does not do validation if user is not on a supported network', async () => {
isChainSupportedMock.mockResolvedValue(false);
const { middleware } = createMiddleware({
const middlewareFunction = createMiddleware({
chainId: '0x2',
});

Expand All @@ -224,29 +230,37 @@ describe('PPOMMiddleware', () => {
securityAlertResponse: undefined,
};

await middleware(req, { ...JsonRpcResponseStruct.TYPE }, () => undefined);
await middlewareFunction(
req,
{ ...JsonRpcResponseStruct.TYPE },
() => undefined,
);

expect(req.securityAlertResponse).toBeUndefined();
expect(validateRequestWithPPOM).not.toHaveBeenCalled();
});

it('does not do validation when request is not for confirmation method', async () => {
const { middleware } = createMiddleware();
const middlewareFunction = createMiddleware();

const req = {
...REQUEST_MOCK,
method: 'eth_someRequest',
securityAlertResponse: undefined,
};

await middleware(req, { ...JsonRpcResponseStruct.TYPE }, () => undefined);
await middlewareFunction(
req,
{ ...JsonRpcResponseStruct.TYPE },
() => undefined,
);

expect(req.securityAlertResponse).toBeUndefined();
expect(validateRequestWithPPOM).not.toHaveBeenCalled();
});

it('does not do validation when request is send to users own account', async () => {
const { middleware } = createMiddleware();
const middlewareFunction = createMiddleware();

const req = {
...REQUEST_MOCK,
Expand All @@ -255,14 +269,18 @@ describe('PPOMMiddleware', () => {
securityAlertResponse: undefined,
};

await middleware(req, { ...JsonRpcResponseStruct.TYPE }, () => undefined);
await middlewareFunction(
req,
{ ...JsonRpcResponseStruct.TYPE },
() => undefined,
);

expect(req.securityAlertResponse).toBeUndefined();
expect(validateRequestWithPPOM).not.toHaveBeenCalled();
});

it('does not do validation for SIWE signature', async () => {
const { middleware } = createMiddleware({
const middlewareFunction = createMiddleware({
securityAlertsEnabled: true,
});

Expand All @@ -283,17 +301,17 @@ describe('PPOMMiddleware', () => {
detectSIWEMock.mockReturnValue({ isSIWEMessage: true } as SIWEMessage);

// @ts-expect-error Passing invalid input for testing purposes
await middleware(req, undefined, () => undefined);
await middlewareFunction(req, undefined, () => undefined);

expect(req.securityAlertResponse).toBeUndefined();
expect(validateRequestWithPPOM).not.toHaveBeenCalled();
});

it('calls next method', async () => {
const { middleware } = createMiddleware();
const middlewareFunction = createMiddleware();
const nextMock = jest.fn();

await middleware(
await middlewareFunction(
{ ...REQUEST_MOCK, method: 'eth_sendTransaction' },
{ ...JsonRpcResponseStruct.TYPE },
nextMock,
Expand All @@ -308,15 +326,15 @@ describe('PPOMMiddleware', () => {

const nextMock = jest.fn();

const { middleware } = createMiddleware({ error });
const middlewareFunction = createMiddleware({ error });

const req = {
...REQUEST_MOCK,
method: 'eth_sendTransaction',
securityAlertResponse: undefined,
};

await middleware(req, { ...JsonRpcResponseStruct.TYPE }, nextMock);
await middlewareFunction(req, { ...JsonRpcResponseStruct.TYPE }, nextMock);

expect(req.securityAlertResponse).toStrictEqual(
SECURITY_ALERT_RESPONSE_MOCK,
Expand Down
Loading
Loading