RabbyHub / Rabby

The game-changing wallet for Ethereum and all EVM chains
https://rabby.io
Other
1.35k stars 379 forks source link

Race condition: User rejected the request #2146

Open miohtama opened 5 months ago

miohtama commented 5 months ago

We have integrated Rabby Chrome plugin into our DeFi website.

We encountered a difficult-to-repeat bug with Rabby. When doing a deposit flow that requires Sign a message (EIP-3009) and then send a transaction (with the message as its payload).

On problematic setup, Rabby never opens the second "Sign and Create" dialog. Instead the frontend received an error message "User rejected the request."

This is what EIP-3009 pop up looks like (if relevant):

image

Here is Viem/Wagmi output when the error happens - "User rejected the request" comes before Rabby opens the second pop up:

confirmPayment error: 2c0b51633e344a03a1db1091d13544f8 TransactionExecutionError: User rejected the request.

Request Arguments:
  from:  0xd747cCEAE75Bb70227C3cB938a14938597aDF8dD
  to:    0xb71F8d2cd7E6aC4d0C6810a293a1Ea0fCaE9d6a4
  data:  0xe6b02fac000000000000000000000000d747cceae75bb70227c3cb938a14938597adf8dd000000000000000000000000b71f8d2cd7e6ac4d0c6810a293a1ea0fcae9d6a40000000000000000000000000000000000000000000000000000000000124f800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006602d9a20d6e93ef51f60d195043b8d2271d829b07d3c729ff46cb30076239fb4c8c9095000000000000000000000000000000000000000000000000000000000000001c1b28bc0f8dc5a3065e41082472e193dce72c0b0fdcf2f3a71d3e1f38767da5b8460a8328aa8c2ade3411277793f0658b519541d4b49236af182ad939b115d10a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000000

Details: User rejected the request.
Version: viem@2.5.0
    at nt (getTransactionError.js:11:12)
    at pt (sendTransaction.js:123:15)
    at async jt (writeContract.js:25:18)
(anonymous) @ console.js:36
fail @ +page.svelte:114
c @ index.js:31
d @ index.js:35
Promise.catch (async)
confirm @ +page.svelte:80
c @ index.js:31
d @ index.js:35
Show 5 more frames
Show less

This error is incorrect: The user never really rejected the transaction and never saw the second "Sign and Create" dialog. Instead, the Rabby fires "User rejected the request" right after the first dialog has been confirmed by pressing "Sign and Create" button.

The problem happens only on certain computers. When it happens, it happens repeatedly. When it does not happen, it may happen very rarely, but cannot be repeated to test on those computers. We had really hard time to pin point the root cause, but we believe we found it.

By adding a small timeout (500ms in our case) before the second "Sign and Create" dialog, we fixed the issue.

We believe there might be some race condition, either in Chrome or Rabby, that incorrectly causes "User rejected the request" when an old dialog pop-up is closing or about to close.

vvvvvv1vvvvvv commented 5 months ago

Please use a short-time timeout as workaround, will check why it happens

miohtama commented 5 months ago

It's very hard to repeat unless you "have the right device". We believe it might be "CPU speed" issue that you need a fast enough computer.

Mstfamn commented 5 months ago

are you using pocket uiverse? I have issue like this and deactive pocket universe and refresh and it would be ok

miohtama commented 4 months ago

No this was not related to pocket universe - I have no idea what's that 😅

Long-Vuong commented 2 months ago

I also had the same problem.

RIP21 commented 1 month ago

Have a similar problem even on M1 Pro Mac. Repeated signatures are the problem as well.