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

Metamask mobile. Incorrect error handling using eth_sendRawTransaction method.

Open darksyd94 opened this issue 3 years ago • 1 comments

Describe the bug We have developed an interface imitating ethereum JSON RPC interface to integrate our blockchain with metamask desktop and mobile application. We developed eth_sendRawTransaction method that returns an error instead of transaction hash when a transaction is rejected in our blockchain for some reason. After receiving that error Provider uses an error code -32603 'Internal JSON-RPC error.' {"code":-32603,"message":"[ethjs-query] while formatting outputs from RPC '{\"error\":306,\"message\":\"Error while executing account-script: FailedTransactionError(code = 1, error = AccountBalanceError(Map(3FY1GwbNSZyLKCVpwTkjnta2vgw676zn3gW -> negative waves balance: 3FY1GwbNSZyLKCVpwTkjnta2vgw676zn3gW, old: 999700000, new: -98900300000)), log =)\",\"transaction\":{\"type\":18,\"id\":\"EDKmKLayaBXorJJ1v9LUK65Hn5Pq1kyfbpMm12mFSeJJ\",\"fee\":500000,\"feeAssetId\":null,\"timestamp\":1662639042356,\"version\":1,\"chainId\":68,\"bytes\":\"0xf8b18601831d026f348502540be4008307a120947d1a54f985831a37bf2034e525a671cde171048380b84421d4a0390000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000081aba010b91146f64fddc5e12b026890def83baf43a5b139d8a160dd97605a5a911964a018a8ed2f1238c2a3413abe8dafaa0561305f1ed91fec6e98912e6a69d8609200\",\"sender\":\"3Fbo3zW4F1MeZvbw54TGAkstzk4Kzrkm3Sh\",\"senderPublicKey\":\"3T9fL3XpeaHYbumohePPUmeuUqhyEeyzifi9vKouV8QoNtAT6kYV1oPAe9e2KCVquPcyXJpr2QwUiQKEUQPGZnc6\"}}' for method 'sendRawTransaction' Error: [ethjs-format] hex string '[object Object]' must be an alphanumeric 66 utf8 byte hex (chars: a-fA-F) string, is 0 bytes","stack":"{\n \"code\": -32603,\n \"message\": \"[ethjs-query] while formatting outputs from RPC '{\\\"error\\\":306,\\\"message\\\":\\\"Error while executing account-script: FailedTransactionError(code = 1, error = AccountBalanceError(Map(3FY1GwbNSZyLKCVpwTkjnta2vgw676zn3gW -> negative waves balance: 3FY1GwbNSZyLKCVpwTkjnta2vgw676zn3gW, old: 999700000, new: -98900300000)), ...

Upon receiving that error metamask mobile starts permanently sending eth_getTransactionByHash requests with null hash params. { "id": 2145909897078296, "jsonrpc": "2.0", "method": "eth_getTransactionByHash", "params": [ {} ] }

Here’s the screenshot of that transaction that was made in Android Metamask application via internal browser. image

In desktop Metamask extension problem doesn't reproduce - that transactions is tagged 'Failed' instead of 'Submitted', error is displayed correctly.

Expected behavior After eth_sendRawTransaction method receives a response without transaction hash, mobile application doesn't start a loop of eth_getTransactionByHash requests with null hash params. Transaction in the transactions list is displayed as Failed.

Smartphone:

  • Xiaomi MI A1
  • Android 9
  • v5.6.0 (950)

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?

darksyd94 avatar Sep 08 '22 16:09 darksyd94

Hey @darksyd94, thanks for reporting! It would be helpful for us if you could give us an example of how to reproduce it so we can test it easily

tommasini avatar Sep 19 '22 13:09 tommasini

Hello @tommasini ! I give you a instruction how to reproduce it:

  1. Login in Metamask account in Metamask Mobile.

  2. Choose browser in Menu.

  3. Go to next link in Metamask Browser: https://metamask.wvservices.com/metamask/.

  4. Push Gear Button and choose testnet. image

  5. Reload the Page.

  6. Choose "Login via Metamask" image

  7. Accept Allowance to add a network. image

  8. In list of actions choose Invoke Script image

  9. Use Transaction data below: image

{ "dApp":"3MtEFgs9JgvadLTPHxmNTLoYdWeb2q6S8NB", "call":{ "function":"fail", "args":[] } } 10. Push Broadcast button.

  1. Confirm Transaction. image

  2. Look on Error. image

  3. Look on transaction in history: image

Device - Samsung Galaxy S22 Ultra.

darksyd94 avatar Sep 30 '22 14:09 darksyd94

hey @darksyd94 your dapp has been flagged as a phishing site, do you have another dapp that we can use that is non-malicious?

cortisiko avatar Oct 11 '22 17:10 cortisiko

Hey @cortisiko! We made an issue some time ago, to make our dApp trusted, unfortunately this issue still open by now time.

We have another dApp: https://signer-sandbox.waves.tech/. Instruction the same, but before you should use a seed phrase in "import an Account" menu. Seed on spoiler below.

seed slender test hungry field dinosaur special dash dish accuse crack paddle fashion

darksyd94 avatar Oct 13 '22 08:10 darksyd94

thank you @darksyd94 for sharing. I will pass this onto the rest of the team!

cortisiko avatar Oct 26 '22 17:10 cortisiko

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.

github-actions[bot] avatar Jun 04 '23 19:06 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.

github-actions[bot] avatar Sep 03 '23 15:09 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity. If you feel this was closed in error please reopen and provide evidence on the current production app. Thank you for your contributions.

github-actions[bot] avatar Sep 10 '23 16:09 github-actions[bot]