metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

eth_signTypedData_v4 get: Internal Error : {"code": -32603, "message": "Internal error"}

Open Lu-Derik opened this issue 3 years ago • 7 comments

Describe the bug I use my Dapp in desktop chrome, and connect with my MetaMask wallet on Android mobile phone via WalletConnect V2 QR-code, and then I try to sign a permit message with eth_signTypedData_v4, but received the error: {code: -32603, message: 'Internal error'}.

This issue does not happen if I connect MetaMask extension in Chrome. Everything works well.

This issue does not happen if the permit token is USDC, not our project token AKRE. The difference of USDC and AKRE is that USDC use salt to send chainId, and we use chainId directly in EIP712Domain. The details are:

USDC Permit mesage: { "types":{ "EIP712Domain":[ {"name":"name","type":"string"}, {"name":"version","type":"string"}, {"name":"verifyingContract","type":"address"}, {"name":"salt","type":"bytes32"} ], "Permit":[ {"name":"owner","type":"address"}, {"name":"spender","type":"address"}, {"name":"value","type":"uint256"}, {"name":"nonce","type":"uint256"}, {"name":"deadline","type":"uint256"} ] }, "domain":{ "name":"USD Coin (PoS)", "version":"1", "verifyingContract":"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", "salt":"0x0000000000000000000000000000000000000000000000000000000000000089" }, "primaryType":"Permit", "message":{ "owner":"0x364a71eE7a1C9EB295a4F4850971a1861E9d3c7D", "spender":"0xA05A9677a9216401CF6800d28005b227F7A3cFae", "value":"10000000", "nonce":"0x01", "deadline":1688520409 } }

Our token permit message: { "types":{ "EIP712Domain":[ {"name":"name","type":"string"}, {"name":"version","type":"string"}, {"name":"chainId","type":"uint256"}, {"name":"verifyingContract","type":"address"} ], "Permit":[ {"name":"owner","type":"address"}, {"name":"spender","type":"address"}, {"name":"value","type":"uint256"}, {"name":"nonce","type":"uint256"}, {"name":"deadline","type":"uint256"} ] }, "domain":{ "name":"Arkreen Token", "version":"1", "chainId":137, "verifyingContract":"0x21B101f5d61A66037634f7e1BeB5a733d9987D57" }, "primaryType":"Permit", "message":{ "owner":"0x364a71eE7a1C9EB295a4F4850971a1861E9d3c7D", "spender":"0xA05A9677a9216401CF6800d28005b227F7A3cFae", "value":"10000000", "nonce":"0x00", "deadline":1688521126 } }

You can see the only difference is of salt/chainId. But USDC works, our token NOT.

Same code works well in WalletConnect V1, but it is shut down now. Same code works well on the 3rd wallet, imToken wallet.

Screenshots image

To Reproduce

Expected behavior Should works same as WallectConnect V1 and MetaMask extension on desktop.


to be added after bug submission by internal support / PM Severity

  • How critical is the impact of this bug on a user?
  • Add stats if available on % of customers impacted
  • Is this visible to all users?
  • Is this tech debt?

Lu-Derik avatar Jul 05 '23 03:07 Lu-Derik

If I select ETH mainnet, the permit with eth_signTypedData_v4 works well. Is there any checking/limitation on other eth-compatible blockchains, such as Polygon?

Lu-Derik avatar Jul 05 '23 12:07 Lu-Derik

Having the same issue with Polygon and Mumbai

zer0stars avatar Jul 05 '23 23:07 zer0stars

See: https://github.com/MetaMask/metamask-mobile/issues/6715 I believe this is the same issue. I propose a work around see what the actual error is.

equalogix avatar Jul 11 '23 17:07 equalogix

This issue has been solved in the release 7.2.0. Thanks!

Lu-Derik avatar Jul 12 '23 01:07 Lu-Derik

See: #6715 I believe this is the same issue. I propose a work around see what the actual error is.

I had tried to use hex before, but it received the same error. I think it is a bug or limitation in the previous release, and it is solved in the latest release.

Lu-Derik avatar Jul 12 '23 01:07 Lu-Derik

This issue has been solved in the release 7.2.0. Thanks!

It fixed somethings, my issue #6787 appears to be solved, I am able to complete the transaction in MM browser. Unfortunately I'm still getting the internal error from WalletConnect, it is most likely an error in my code, but with only internal error as the message it's going to be a lot of fun trying to debug the issue.

equalogix avatar Jul 12 '23 02:07 equalogix

Hey, @Lu-Derik Thanks for the report! I see the issue has been solved with version 7.2.0. Can you please confirm that it is okay for me to close this issue? Thanks!

anaamolnar avatar Jul 20 '23 19:07 anaamolnar