Skip to content

Commit

Permalink
Merge branch 'develop' into e2e/settings-about-metamask-links-test
Browse files Browse the repository at this point in the history
  • Loading branch information
hjetpoluru authored Feb 21, 2024
2 parents c54b9fd + a13de55 commit 8b3f89a
Show file tree
Hide file tree
Showing 40 changed files with 336 additions and 90 deletions.
33 changes: 32 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [11.10.0]
### Added
- Added preset network image avatars in the 'Select a network' pop-up ([#22643](https://github.com/MetaMask/metamask-extension/pull/22643))
- Expanded Blockaid banner support to include send requests from wallets ([#22321](https://github.com/MetaMask/metamask-extension/pull/22321))
- Expanded Blockaid banner support to include BNB chain, Polygon, Arbitrum, Optimism, Avalanche, and Linea networks ([#22633](https://github.com/MetaMask/metamask-extension/pull/22633))
- Added support for imToken Wallet using EIP-4527 ([#21804](https://github.com/MetaMask/metamask-extension/pull/21804))
- [FLASK] Introduced user operation support, enhancing transaction handling and alert display for user operations ([#22469](https://github.com/MetaMask/metamask-extension/pull/22469))
- [FLASK] Added support for the Lattice hardware wallet in MV3 ([#22528](https://github.com/MetaMask/metamask-extension/pull/22528))
- [FLASK] Added a 'You're sending to a contract' warning to the new send page ([#22551](https://github.com/MetaMask/metamask-extension/pull/22551))

### Changed
- Improved error messaging for Ledger connection issues ([#21038](https://github.com/MetaMask/metamask-extension/pull/21038))
- Updated 'What's New' and 'Settings' to communicate the extension's additional network coverage ([#22618](https://github.com/MetaMask/metamask-extension/pull/22618))
- Enhanced Token List layout for clearer token name and value display ([#22601](https://github.com/MetaMask/metamask-extension/pull/22601))
- Updated the date for the upcoming user survey displayed on the home screen ([#22581](https://github.com/MetaMask/metamask-extension/pull/22581))
- Improved QR code density for compatibility with the ZERO hardware wallet ([#22135](https://github.com/MetaMask/metamask-extension/pull/22135))
- Updated snaps packages to the latest versions ([#22595](https://github.com/MetaMask/metamask-extension/pull/22595))
- Updated the Gas API URL to ensure accurate gas fee calculations for Send and Swap transactions ([#22544](https://github.com/MetaMask/metamask-extension/pull/22544))

### Fixed
- Fixed an issue where clicking on the redirection link did not close the notification window ([#22583](https://github.com/MetaMask/metamask-extension/pull/22583))
- Improved Blockaid 'What's New' image display for users in OS dark mode ([#22649](https://github.com/MetaMask/metamask-extension/pull/22649))
- Added Blockaid dark mode support in the 'What's New' feature and introduced a new theme management utility ([#22613](https://github.com/MetaMask/metamask-extension/pull/22613))
- Ensured all security alert banners correctly trigger events ([#22553](https://github.com/MetaMask/metamask-extension/pull/22553))
- Updated 'What's New' Blockaid image to have a transparent background ([#22539](https://github.com/MetaMask/metamask-extension/pull/22539))
- Fixed unresponsiveness on the phishing warning page ([#22645](https://github.com/MetaMask/metamask-extension/pull/22645))
- Improved Trezor integration by updating to the correct version of the SDK ([#22591](https://github.com/MetaMask/metamask-extension/pull/22591))
- Improved account list links to display the correct explorer domain based on the selected network ([#22483](https://github.com/MetaMask/metamask-extension/pull/22483))
- Improved the reliability of snap installations by resolving an underlying technical issue ([#22602](https://github.com/MetaMask/metamask-extension/pull/22602))

## [11.9.5]
### Fixed
- Fixed sometimes failing confirmation screen security validation checks ([$22978](https://github.com/MetaMask/metamask-extension/pull/22978))
Expand Down Expand Up @@ -4359,7 +4389,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c
### Uncategorized
- Added the ability to restore accounts from seed words.

[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.9.5...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.10.0...HEAD
[11.10.0]: https://github.com/MetaMask/metamask-extension/compare/v11.9.5...v11.10.0
[11.9.5]: https://github.com/MetaMask/metamask-extension/compare/v11.9.4...v11.9.5
[11.9.4]: https://github.com/MetaMask/metamask-extension/compare/v11.9.3...v11.9.4
[11.9.3]: https://github.com/MetaMask/metamask-extension/compare/v11.9.2...v11.9.3
Expand Down
2 changes: 1 addition & 1 deletion app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/es/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/fr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/hi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/id/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/ja/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/ko/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/pt/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/ru/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/tl/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/tr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/vi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/_locales/zh_CN/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions app/scripts/lib/createRPCMethodTrackingMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ export default function createRPCMethodTrackingMiddleware({
BlockaidResultType.NotApplicable;
eventProperties.security_alert_reason =
req.securityAlertResponse?.reason ?? BlockaidReason.notApplicable;

if (
req.securityAlertResponse?.result_type ===
BlockaidResultType.Errored &&
req.securityAlertResponse?.description
) {
eventProperties.security_alert_description =
req.securityAlertResponse.description;
}
///: END:ONLY_INCLUDE_IF

const snapAndHardwareInfo = await getSnapAndHardwareInfoForMetrics(
Expand Down
12 changes: 9 additions & 3 deletions app/scripts/lib/ppom/ppom-middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ const createMiddleWare = (
const networkController = {
state: { providerConfig: { chainId: chainId || CHAIN_IDS.MAINNET } },
};
const appStateController = {
addSignatureSecurityAlertResponse: () => undefined,
};

return createPPOMMiddleware(
ppomController as any,
preferenceController as any,
networkController as any,
appStateController as any,
() => undefined,
);
};

Expand Down Expand Up @@ -87,7 +93,7 @@ describe('PPOMMiddleware', () => {
expect(req.securityAlertResponse).toBeUndefined();
});

it('should set Failed type in response if usePPOM throw error', async () => {
it('should set error type in response if usePPOM throw error', async () => {
const usePPOM = async () => {
throw new Error('some error');
};
Expand All @@ -98,10 +104,10 @@ describe('PPOMMiddleware', () => {
};
await middlewareFunction(req, undefined, () => undefined);
expect((req.securityAlertResponse as any)?.result_type).toBe(
BlockaidResultType.Failed,
BlockaidResultType.Errored,
);
expect((req.securityAlertResponse as any)?.reason).toBe(
BlockaidReason.failed,
BlockaidReason.errored,
);
});

Expand Down
16 changes: 9 additions & 7 deletions app/scripts/lib/ppom/ppom-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@ export function createPPOMMiddleware(
.usePPOM(async (ppom: PPOM) => {
try {
const securityAlertResponse = await ppom.validateJsonRpc(req);
securityAlertResponse.securityAlertId = securityAlertId;
return securityAlertResponse;
} catch (error: any) {
sentry?.captureException(error);
const errorObject = error as unknown as Error;
console.error('Error validating JSON RPC using PPOM: ', error);
const securityAlertResponse = {
result_type: BlockaidResultType.Failed,
reason: BlockaidReason.failed,
description:
'Validating the confirmation failed by throwing error.',
result_type: BlockaidResultType.Errored,
reason: BlockaidReason.errored,
description: `${errorObject.name}: ${errorObject.message}`,
};

return securityAlertResponse;
Expand Down Expand Up @@ -114,12 +115,13 @@ export function createPPOMMiddleware(
}
}
} catch (error: any) {
const errorObject = error as unknown as Error;
sentry?.captureException(error);
console.error('Error validating JSON RPC using PPOM: ', error);
req.securityAlertResponse = {
result_type: BlockaidResultType.Failed,
reason: BlockaidReason.failed,
description: 'Validating the confirmation failed by throwing error.',
result_type: BlockaidResultType.Errored,
reason: BlockaidReason.errored,
description: `${errorObject.name}: ${errorObject.message}`,
};
} finally {
next();
Expand Down
13 changes: 7 additions & 6 deletions app/scripts/lib/transaction/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const PPOM_EXCLUDED_TRANSACTION_TYPES = [
export async function addTransaction(
request: AddTransactionRequest,
///: BEGIN:ONLY_INCLUDE_IF(blockaid)
updateSecurityAlertResponseByTxId: (
updateSecurityAlertResponseByTxId?: (
req: AddTransactionOptions | undefined,
securityAlertResponse: SecurityAlertResponse,
) => void,
Expand Down Expand Up @@ -169,19 +169,19 @@ export async function addTransaction(
return securityAlertResponse;
} catch (e) {
captureException(e);
const errorObject = e as unknown as Error;
console.error('Error validating JSON RPC using PPOM: ', e);
const securityAlertResponse = {
securityAlertId,
result_type: BlockaidResultType.Failed,
reason: BlockaidReason.failed,
description:
'Validating the confirmation failed by throwing error.',
result_type: BlockaidResultType.Errored,
reason: BlockaidReason.errored,
description: `${errorObject.name}: ${errorObject.message}`,
};
return securityAlertResponse;
}
})
.then((securityAlertResponse) => {
updateSecurityAlertResponseByTxId(request.transactionOptions, {
updateSecurityAlertResponseByTxId?.(request.transactionOptions, {
...securityAlertResponse,
securityAlertId,
});
Expand All @@ -193,6 +193,7 @@ export async function addTransaction(
securityAlertId,
};
} catch (e) {
console.error('Error validating JSON RPC using PPOM: ', e);
captureException(e);
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metamask-crx",
"version": "11.9.5",
"version": "11.10.0",
"private": true,
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion shared/constants/metametrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ export enum MetaMetricsEventUiCustomization {
FlaggedAsSafetyUnknown = 'flagged_as_safety_unknown',
FlaggedAsWarning = 'flagged_as_warning',
GasEstimationFailed = 'gas_estimation_failed',
SecurityAlertFailed = 'security_alert_failed',
SecurityAlertError = 'security_alert_error',
Siwe = 'sign_in_with_ethereum',
}

Expand Down
3 changes: 1 addition & 2 deletions shared/constants/security-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export enum BlockaidReason {
other = 'other',

// MetaMask defined reasons
failed = 'Failed',
errored = 'Error',
notApplicable = 'NotApplicable',
inProgress = 'validation_in_progress',
}
Expand All @@ -59,7 +59,6 @@ export enum BlockaidResultType {
Errored = 'Error',

// MetaMask defined result types
Failed = 'Failed',
NotApplicable = 'NotApplicable',
Loading = 'loading',
}
Expand Down
18 changes: 18 additions & 0 deletions test/e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,24 @@ const sendScreenToConfirmScreen = async (
await driver.fill('[data-testid="ens-input"]', recipientAddress);
await driver.fill('.unit-input__input', quantity);
if (process.env.MULTICHAIN) {
// check if element exists and click it
await driver
.findElement({
text: 'I understand',
tag: 'button',
})
.then(
(_found) => {
driver.clickElement({
text: 'I understand',
tag: 'button',
});
},
(error) => {
console.error('Element not found.', error);
},
);

await driver.clickElement({
text: 'Continue',
tag: 'button',
Expand Down
Loading

0 comments on commit 8b3f89a

Please sign in to comment.