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

Write Contract retries 3 times when UnknownRpcError code -1 received from Wallet Connect/Fireblocks #3137

Closed
1 task done
alexwalchli opened this issue Dec 17, 2024 · 5 comments
Labels
needs reproduction Misc: Needs Reproduction

Comments

@alexwalchli
Copy link

Check existing issues

Viem Version

viem: 2.21.55, wagmi: 2.14.3

Current Behavior

Contract writes retry three times in some cases. Potentially specific to Wallet Connect / Fireblocks and mishandling an exception thrown by during use of that combination.

Expected Behavior

I think I would expect no retries at all for any contract write whatsoever. In the wagmi documentation it stays the default for retry count for mutations is 0 here.

It is quite dangerous and has caused confusion with us and our customers alike. In our context, it happens when a customer goes to use our app to buy or sell tokens. Transaction approvals land in Fireblocks, if they take too long to approve, or have insufficient funds for the network fee, it will retry three times, tripping up users trying to approve or deny these transactions.

Steps To Reproduce

  1. Connect a Fireblocks account to a web app using Wallet Connect that does not have enough ETH to do a write.
  2. Attempt to do a transaction that will result in a failure due to insufficient funds for network fee.
  3. Note the screenshot below that captures the error: "Session Settlement Failed", code -1, this falls into a shouldRetry=true case.
  4. This results in write contract's trying 3 times if they have insufficient funds.

We have seen this occur in some other cases as well, like taking too long to approve a transaction in Fireblocks, but the above is the easiest way to reproduce.

This may not be specific though to using Wallet Connect and Fireblocks, from a brief look, it's simply if an RPC error is thrown with code -1.

image

Link to Minimal Reproducible Example

No response

Anything else?

No response

@jxom
Copy link
Member

jxom commented Dec 18, 2024

Hard to tell what’s going on without a minimal reproduction.

Regardless of if shouldRetry is true or false, it should not retry as retryCount is zero for all mutation actions, in this case, sendTransaction (which writeContract internally uses).

@jxom
Copy link
Member

jxom commented Dec 18, 2024

Attempted to reproduce, but cannot.

@jxom jxom added the needs reproduction Misc: Needs Reproduction label Dec 18, 2024
Copy link
Contributor

Hello @alexwalchli.

Please provide a minimal reproduction using StackBlitz, TypeScript Playground (for type issues), or a separate minimal GitHub repository.

Minimal reproductions are required as they save us a lot of time reproducing your config/environment and issue, and allow us to help you faster.

Once a minimal reproduction is added, a team member will confirm it works, then re-open the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2024
@alexwalchli
Copy link
Author

@jxom This may be an issue with Dynamic.xyz, I should have mentioned we are using that. Thanks for looking into it, I'll see what they say.

Copy link
Contributor

github-actions bot commented Jan 2, 2025

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs reproduction Misc: Needs Reproduction
Projects
None yet
Development

No branches or pull requests

2 participants