From 9034b5b4a14eb032aba991179b4a245f144b3a9f Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 2 Oct 2024 11:00:58 -0230 Subject: [PATCH] Update `main` with changes from v14.0.2 (#340) * Request validation should not throw if verifyingContract is not defined in typed signature (#328) (#330) * 14.0.1 (#331) * [14.x] fix: support ethermint's EIP712 implementation (#333) * setting cosmos as allowed string for verifyingContract field * fixed and linter * readability * Update condition to match main branch * Remove duplicate copy of test --------- Co-authored-by: Jyoti Puri Co-authored-by: Mark Stacey * Version 14.0.2 (#339) * Version 14.0.2 * Fix typo Co-authored-by: Michele Esposito <34438276+mikesposito@users.noreply.github.com> --------- Co-authored-by: Michele Esposito <34438276+mikesposito@users.noreply.github.com> --------- Co-authored-by: Jyoti Puri Co-authored-by: Michael Tsitrin <114929630+mtsitrin@users.noreply.github.com> Co-authored-by: Michele Esposito <34438276+mikesposito@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- package.json | 2 +- src/wallet.ts | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11db726..9b47efe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [14.0.2] +### Fixed +- Allow the string "cosmos" in the "verifyingContract" field of EIP-712 signatures ([#333](https://github.com/MetaMask/eth-json-rpc-middleware/pull/333)) + - This change was made to support Ethermint's EIP-712 implementation, which was broken by validation added in v14.0.0 + ## [14.0.1] ### Fixed - Request validation should not throw if verifyingContract is not defined in typed signature ([#328](https://github.com/MetaMask/eth-json-rpc-middleware/pull/328)) @@ -206,7 +211,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `json-rpc-engine@5.3.0` ([#53](https://github.com/MetaMask/eth-json-rpc-middleware/pull/53)) - `eth-rpc-errors@3.0.0` ([#55](https://github.com/MetaMask/eth-json-rpc-middleware/pull/55)) -[Unreleased]: https://github.com/MetaMask/eth-json-rpc-middleware/compare/v14.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/eth-json-rpc-middleware/compare/v14.0.2...HEAD +[14.0.2]: https://github.com/MetaMask/eth-json-rpc-middleware/compare/v14.0.1...v14.0.2 [14.0.1]: https://github.com/MetaMask/eth-json-rpc-middleware/compare/v14.0.0...v14.0.1 [14.0.0]: https://github.com/MetaMask/eth-json-rpc-middleware/compare/v13.0.0...v14.0.0 [13.0.0]: https://github.com/MetaMask/eth-json-rpc-middleware/compare/v12.1.2...v13.0.0 diff --git a/package.json b/package.json index 54125b6..2a2b759 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/eth-json-rpc-middleware", - "version": "14.0.1", + "version": "14.0.2", "description": "Ethereum-related json-rpc-engine middleware.", "repository": { "type": "git", diff --git a/src/wallet.ts b/src/wallet.ts index d78e17e..60e5e10 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -461,6 +461,10 @@ WalletMiddlewareOptions): JsonRpcMiddleware { * Validates verifyingContract of typedSignMessage. * * @param data - The data passed in typedSign request. + * This function allows the verifyingContract to be either: + * - A valid hex address + * - The string "cosmos" (as it is hard-coded in some Cosmos ecosystem's EVM adapters) + * - An empty string */ function validateVerifyingContract(data: string) { const { domain: { verifyingContract } = {} } = parseTypedMessage(data);