Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition: User rejected the request #2146

Open
miohtama opened this issue Mar 26, 2024 · 4 comments
Open

Race condition: User rejected the request #2146

miohtama opened this issue Mar 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@miohtama
Copy link

miohtama commented Mar 26, 2024

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).

  • Rabby opens Sign and Create pop-up for signing EIP-3009 TransferWithAuthorization message
  • Rabby opens Sign and Create for a Polygon transaction

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

  • Rabby for Chrome version 0.92.59.
  • Using Viem and Wagmi libraries to interact with the wallet
  • "It was working fine before" - so something happened with Rabby and it started to trigger this bug
  • There are no console logs related to the error

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
Copy link
Member

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

@miohtama
Copy link
Author

miohtama commented Mar 27, 2024

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
Copy link

Mstfamn commented Apr 5, 2024

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

@vvvvvv1vvvvvv vvvvvv1vvvvvv added the bug Something isn't working label May 17, 2024
@miohtama
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants