safe-global / safe-wallet-web

Safe{Wallet} – smart contract wallet for Ethereum (ex-Gnosis Safe multisig)
https://app.safe.global
GNU General Public License v3.0
295 stars 337 forks source link

[MetaMask Mobile] ChainId should be a hex string #3550

Open katspaugh opened 1 month ago

katspaugh commented 1 month ago

Executing a Safe tx on Arbitrum with MMM via WalletConnect gives this error:

could not coalesce error (error={ "code": 5000, "message": "Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: 42161" }, payload={ "id": 36, "jsonrpc": "2.0", "method": "eth_sendTransaction", "params": [ { "data":"..."}]}

42161 is Arbitrum's chain id. It looks like MM wants it in hex instead of decimal.

Check if we're sending the chainId correctly.

johannesmoormann commented 1 month ago

Adding some further detail: The user used WC to connect to MM mobile on iOS.

katspaugh commented 1 month ago

I couldn't reproduce this so far. I can both sign and execute with iOS MetaMask via WalletConnet. Sending over to QA to try.

francovenica commented 1 month ago

So I tried in prod to execute a tx in a safe 1/x with the MM phone app in iPhone. Executed 2 "send funds" type of tx, it was both a "sign&execute" action

I was able to execute both transactions just fine but I had a strange behavior: The tx form didn't close on its own, it stay there to sign again. After about 5 minutes or so I suddenly got 2 error notifications showing the message described in the ticket, one for each transaction: could not coalesce error (error={ "message": "Request expired. Please try again." }, payload={ "id": 44, "jsonrpc": "2.0", "method": "eth_sendTransaction", "params": [ { "data": "0x6a7612020000000000000000000000008aef2f5c3f17261f6f1c4da058d022be92776af800000000000000000000000000000000000000000000000000000000b2d05e0000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000410000000000000000000000008aef2f5c3f17261f6f1c4da058d022be92776af800000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000", "from": "0x8aef2f5c3f17261f6f1c4da058d022be92776af8", "gas": "0x166ea", "gasPrice": "0x989680", "nonce": "0x3a", "to": "0xd62269db700df2d274aca12ae95aba3eeb0b0914" } ] }, code=UNKNOWN_ERROR, version=6.11.1)

The only difference between them was the "nonce" field showing the nonce of the tx in the Phone app (58 and 59 in this case)

The transactions showed up just fine in the history tab and also in the phone app history, so I'm sure they were executed no problem, so I don't understand the error message 5 mins later (like if some type of timeout had happened)

This is the safe, tx 38 and 39: https://app.safe.global/transactions/history?safe=arb1:0xD62269DB700dF2D274Aca12Ae95AbA3eeB0B0914

Snapshot of the tx in the phone app, executed just fine: image

Snapshots of the error messages image image

francovenica commented 1 month ago

I tried the same type of tx in Optimism and Avalanche and I didn't have these issues.

katspaugh commented 1 month ago

Thanks Franco! Those errors are not the same as in the bug report, though.

I suspect it might be an issue with a custom RPC provider.

francovenica commented 1 month ago

Ah true, I saw the "could not coalesce error" So i thought it was the same error. My mistake.