From 75fed5256044abc60fb929371424b863ac9d74cd Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Wed, 11 Sep 2024 15:37:07 +0000 Subject: [PATCH 1/6] Version v12.2.3 --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6d7f827ca85..58113296a846 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [12.2.3] + ## [12.2.2] ### Fixed - This build was needed to fix release publishing on our master branch. It also includes the addition of the missing v12.2.0 changelog. Functionality and code is equivalent to v12.2.0. @@ -5044,7 +5046,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c - Added the ability to restore accounts from seed words. -[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.2.2...HEAD +[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.2.3...HEAD +[12.2.3]: https://github.com/MetaMask/metamask-extension/compare/v12.2.2...v12.2.3 [12.2.2]: https://github.com/MetaMask/metamask-extension/compare/v12.2.1...v12.2.2 [12.2.1]: https://github.com/MetaMask/metamask-extension/compare/v12.2.0...v12.2.1 [12.2.0]: https://github.com/MetaMask/metamask-extension/compare/v12.1.3...v12.2.0 diff --git a/package.json b/package.json index 174a929240c4..f04c060bd55b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metamask-crx", - "version": "12.2.2", + "version": "12.2.3", "private": true, "repository": { "type": "git", From 5eaa9d312684e40ca2fae9625a45668a505de81b Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Wed, 11 Sep 2024 22:28:10 +0530 Subject: [PATCH 2/6] fix (cherry-pick): Adding patch on eth-json-rpc-middleware to disable verifyContract field validation for cosmos (#27065) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cherry-picks https://github.com/MetaMask/metamask-extension/pull/27021 (https://github.com/MetaMask/metamask-extension/commit/4ee09fc71ff5915f3b4b64173d98312c913bf7f4) ## **Description** Adding patch on eth-json-rpc-middleware to disable verifyContract field validation for cosmos ## **Related issues** Fixes: https://github.com/MetaMask/metamask-extension/issues/26980 ## **Manual testing steps** 1. Submit a types signature request with verifyingContract set to `cosmos` 2. Ensure that you are able to sign it ## **Screenshots/Recordings** Screenshot 2024-09-10 at 4 08 00 PM ## **Pre-merge author checklist** - [X] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- ...rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch | 13 ++++++ package.json | 2 +- yarn.lock | 41 ++++++++++++++----- 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 .yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch diff --git a/.yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch b/.yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch new file mode 100644 index 000000000000..e82feb182c3a --- /dev/null +++ b/.yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch @@ -0,0 +1,13 @@ +diff --git a/dist/wallet.js b/dist/wallet.js +index fce8272ab926443df4c5971c811664f849791425..9237ffcaaea2260e01182feecec667b10edd35a0 100644 +--- a/dist/wallet.js ++++ b/dist/wallet.js +@@ -293,7 +293,7 @@ exports.createWalletMiddleware = createWalletMiddleware; + */ + function validateVerifyingContract(data) { + const { domain: { verifyingContract } = {} } = (0, normalize_1.parseTypedMessage)(data); +- if (verifyingContract && !(0, utils_1.isValidHexAddress)(verifyingContract)) { ++ if (verifyingContract && verifyingContract !== 'cosmos' && !(0, utils_1.isValidHexAddress)(verifyingContract)) { + throw rpc_errors_1.rpcErrors.invalidInput(); + } + } diff --git a/package.json b/package.json index f04c060bd55b..541a6a7bba82 100644 --- a/package.json +++ b/package.json @@ -303,7 +303,7 @@ "@metamask/design-tokens": "^4.0.0", "@metamask/ens-controller": "^10.0.1", "@metamask/eth-json-rpc-filters": "^7.0.0", - "@metamask/eth-json-rpc-middleware": "^14.0.1", + "@metamask/eth-json-rpc-middleware": "patch:@metamask/eth-json-rpc-middleware@npm%3A14.0.1#~/.yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch", "@metamask/eth-ledger-bridge-keyring": "patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch", "@metamask/eth-query": "^4.0.0", "@metamask/eth-sig-util": "^7.0.1", diff --git a/yarn.lock b/yarn.lock index 41d26bdef14e..bd7c41b54bb8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5036,7 +5036,7 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-block-tracker@npm:^9.0.2": +"@metamask/eth-block-tracker@npm:^9.0.2, @metamask/eth-block-tracker@npm:^9.0.3": version: 9.0.3 resolution: "@metamask/eth-block-tracker@npm:9.0.3" dependencies: @@ -5088,26 +5088,45 @@ __metadata: languageName: node linkType: hard +"@metamask/eth-json-rpc-middleware@npm:14.0.1": + version: 14.0.1 + resolution: "@metamask/eth-json-rpc-middleware@npm:14.0.1" + dependencies: + "@metamask/eth-block-tracker": "npm:^11.0.1" + "@metamask/eth-json-rpc-provider": "npm:^4.1.1" + "@metamask/eth-sig-util": "npm:^7.0.3" + "@metamask/json-rpc-engine": "npm:^9.0.2" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/utils": "npm:^9.1.0" + "@types/bn.js": "npm:^5.1.5" + bn.js: "npm:^5.2.1" + klona: "npm:^2.0.6" + pify: "npm:^5.0.0" + safe-stable-stringify: "npm:^2.4.3" + checksum: 10/39beecb0d2be19854b132fd615aee1f29195602d3db902f52755260b26a2c37c0a91cd635a09d4dc16f922d32bb229003b338228ae29577c5151d880fad04637 + languageName: node + linkType: hard + "@metamask/eth-json-rpc-middleware@npm:^12.1.1": - version: 12.1.1 - resolution: "@metamask/eth-json-rpc-middleware@npm:12.1.1" + version: 12.1.2 + resolution: "@metamask/eth-json-rpc-middleware@npm:12.1.2" dependencies: - "@metamask/eth-block-tracker": "npm:^9.0.2" - "@metamask/eth-json-rpc-provider": "npm:^2.1.0" + "@metamask/eth-block-tracker": "npm:^9.0.3" + "@metamask/eth-json-rpc-provider": "npm:^3.0.2" "@metamask/eth-sig-util": "npm:^7.0.0" - "@metamask/json-rpc-engine": "npm:^7.1.1" + "@metamask/json-rpc-engine": "npm:^8.0.2" "@metamask/rpc-errors": "npm:^6.0.0" "@metamask/utils": "npm:^8.1.0" klona: "npm:^2.0.6" pify: "npm:^5.0.0" safe-stable-stringify: "npm:^2.4.3" - checksum: 10/0018da198a4f8fbdeab25aa8184377b3215e365b2a631d0f8d7f0577e281c860a1d19fc58ad310afb6d005291c0797dabfe14bdb4adb16300c7f28b11fb26cbc + checksum: 10/1c0f186a35765394a28695bcade84c636b0c92cf3252219d1e9cbdd31231ad09fea5ec7bff7d31e2c7fe4d2158f15b54a5e42166549b69af1f7e475a1c7ae536 languageName: node linkType: hard -"@metamask/eth-json-rpc-middleware@npm:^14.0.1": +"@metamask/eth-json-rpc-middleware@patch:@metamask/eth-json-rpc-middleware@npm%3A14.0.1#~/.yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch": version: 14.0.1 - resolution: "@metamask/eth-json-rpc-middleware@npm:14.0.1" + resolution: "@metamask/eth-json-rpc-middleware@patch:@metamask/eth-json-rpc-middleware@npm%3A14.0.1#~/.yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch::version=14.0.1&hash=96e7e0" dependencies: "@metamask/eth-block-tracker": "npm:^11.0.1" "@metamask/eth-json-rpc-provider": "npm:^4.1.1" @@ -5120,7 +5139,7 @@ __metadata: klona: "npm:^2.0.6" pify: "npm:^5.0.0" safe-stable-stringify: "npm:^2.4.3" - checksum: 10/39beecb0d2be19854b132fd615aee1f29195602d3db902f52755260b26a2c37c0a91cd635a09d4dc16f922d32bb229003b338228ae29577c5151d880fad04637 + checksum: 10/d1d97a845a8a9a5931c3853c6e2768a97ba289d676a2a8b6111077531943f9647430ef8e3f2a05f4643760ffdab1af0dc72574ca3010feadbdfab3dec345b7c8 languageName: node linkType: hard @@ -25272,7 +25291,7 @@ __metadata: "@metamask/eslint-config-typescript": "npm:^9.0.1" "@metamask/eslint-plugin-design-tokens": "npm:^1.1.0" "@metamask/eth-json-rpc-filters": "npm:^7.0.0" - "@metamask/eth-json-rpc-middleware": "npm:^14.0.1" + "@metamask/eth-json-rpc-middleware": "patch:@metamask/eth-json-rpc-middleware@npm%3A14.0.1#~/.yarn/patches/@metamask-eth-json-rpc-middleware-npm-14.0.1-b6c2ccbe8c.patch" "@metamask/eth-ledger-bridge-keyring": "patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch" "@metamask/eth-query": "npm:^4.0.0" "@metamask/eth-sig-util": "npm:^7.0.1" From 36118362c0ab59802ef9f749d412451650d65188 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Wed, 11 Sep 2024 14:32:32 -0230 Subject: [PATCH 3/6] v12.2.3 changelog (#27073) Updates the changelog for v12.2.3 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58113296a846..ad00f06ec372 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [12.2.3] +### Fixed +- Fixes dapps integrating with the cosmos chain that rely on setting the `verifyingContract` field of a signature to `"cosmos"` ## [12.2.2] ### Fixed From 5de824bce89ad7126d07c9aab40440947f76d3e4 Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Tue, 17 Sep 2024 09:57:17 +0000 Subject: [PATCH 4/6] Version v12.2.4 --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad00f06ec372..bc3b1ad214ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [12.2.4] + ## [12.2.3] ### Fixed - Fixes dapps integrating with the cosmos chain that rely on setting the `verifyingContract` field of a signature to `"cosmos"` @@ -5048,7 +5050,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c - Added the ability to restore accounts from seed words. -[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.2.3...HEAD +[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.2.4...HEAD +[12.2.4]: https://github.com/MetaMask/metamask-extension/compare/v12.2.3...v12.2.4 [12.2.3]: https://github.com/MetaMask/metamask-extension/compare/v12.2.2...v12.2.3 [12.2.2]: https://github.com/MetaMask/metamask-extension/compare/v12.2.1...v12.2.2 [12.2.1]: https://github.com/MetaMask/metamask-extension/compare/v12.2.0...v12.2.1 diff --git a/package.json b/package.json index 541a6a7bba82..e796cab76162 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metamask-crx", - "version": "12.2.3", + "version": "12.2.4", "private": true, "repository": { "type": "git", From 4b48aa972980e61cd8fb8fb09762039337dd1f3d Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Tue, 17 Sep 2024 07:39:45 -0230 Subject: [PATCH 5/6] Update changelog for v12.2.4 (#27207) V12.2.4 changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc3b1ad214ec..529d6764a977 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [12.2.4] +### Fixed +- Fixes token approvals for users who have the "Decode smart contracts" setting toggled off ([#27203](https://github.com/MetaMask/metamask-extension/pull/27203)) ## [12.2.3] ### Fixed From a09d076095d06cfa2010ace41d9c495bc5048db7 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Tue, 17 Sep 2024 18:22:19 +0530 Subject: [PATCH 6/6] fix(cherry-pick) : selector getKnownMethodData should return empty object if user has opted out for using 4Byte Resolution (#27213) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** If user has toggled off **Decode smart contracts** setting he is not able to approve ERC20. This is regression introduced recently. ## **Related issues** Fixes: https://github.com/MetaMask/metamask-extension/issues/27188 ## **Manual testing steps** 1. Toggle off setting "Decode smart contracts" 2. Try to approve an ERC 20 3. It should not throw error ## **Screenshots/Recordings** https://github.com/user-attachments/assets/7f0fd8f9-3d97-4f4b-8e99-c694445ad929 ## **Pre-merge author checklist** - [X] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../components/confirm/info/hooks/useFourByte.test.ts | 6 +++--- .../info/shared/transaction-details/transaction-details.tsx | 2 +- ui/selectors/selectors.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/pages/confirmations/components/confirm/info/hooks/useFourByte.test.ts b/ui/pages/confirmations/components/confirm/info/hooks/useFourByte.test.ts index 1c3d66570d8b..bdff31ac33e6 100644 --- a/ui/pages/confirmations/components/confirm/info/hooks/useFourByte.test.ts +++ b/ui/pages/confirmations/components/confirm/info/hooks/useFourByte.test.ts @@ -34,7 +34,7 @@ describe('useFourByte', () => { expect(result.current.params).toEqual([]); }); - it('returns undefined if resolution is turned off', () => { + it('returns empty object if resolution is turned off', () => { const currentConfirmation = genUnapprovedContractInteractionConfirmation({ address: CONTRACT_INTERACTION_SENDER_ADDRESS, txData: depositHexData, @@ -54,7 +54,7 @@ describe('useFourByte', () => { }, ); - expect(result.current).toBeUndefined(); + expect(result.current).toEqual({}); }); it("returns undefined if it's not known even if resolution is enabled", () => { @@ -75,6 +75,6 @@ describe('useFourByte', () => { }, ); - expect(result.current).toBeUndefined(); + expect(result.current).toEqual({}); }); }); diff --git a/ui/pages/confirmations/components/confirm/info/shared/transaction-details/transaction-details.tsx b/ui/pages/confirmations/components/confirm/info/shared/transaction-details/transaction-details.tsx index 992e16f1baad..89bee67f4c51 100644 --- a/ui/pages/confirmations/components/confirm/info/shared/transaction-details/transaction-details.tsx +++ b/ui/pages/confirmations/components/confirm/info/shared/transaction-details/transaction-details.tsx @@ -70,7 +70,7 @@ const MethodDataRow = () => { const methodData = useFourByte(currentConfirmation); - if (!methodData) { + if (!methodData?.name) { return null; } diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index e2f208149092..68187a1874b3 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -1236,7 +1236,7 @@ export function getKnownMethodData(state, data) { const fourBytePrefix = prefixedData.slice(0, 10); const { knownMethodData, use4ByteResolution } = state.metamask; // If 4byte setting is off, we do not want to return the knownMethodData - return use4ByteResolution ? knownMethodData?.[fourBytePrefix] : undefined; + return use4ByteResolution ? knownMethodData?.[fourBytePrefix] ?? {} : {}; } export function getFeatureFlags(state) {