You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked there isn't already an issue for the bug I encountered.
Viem Version
2.21.53
Current Behavior
I'm using nonceManager when instantiating my walletClient because my code can send multiple tx in parallel
I noticed that when calling walletClient.writeContract (or equivalent), if this method throws (for instance not enough gas and the tx is going to fail, hence the transaction is not triggered because estimateGas probably fails), the nonce has been incremented, and all the following transactions will just wait forever because there will be a nonce gap
Expected Behavior
If the call to writeContract or equivalent fails, the nonce should not be incremented (or be re-decremented)?
I don't think the stackblitz will work actually because the account is empty and the nounce will be 0 even after the failure, but using a private key that has transactions will show the issue I have
Also I wonder if the reset method of createNonceManager should not also call nonceMap.delete(key) ? However I'm not 100% sure I understand how the nonce manager works.
0xrouss
added a commit
to 0xrouss/viem
that referenced
this issue
Dec 21, 2024
Check existing issues
Viem Version
2.21.53
Current Behavior
I'm using
nonceManager
when instantiating mywalletClient
because my code can send multiple tx in parallelI noticed that when calling
walletClient.writeContract
(or equivalent), if this method throws (for instance not enough gas and the tx is going to fail, hence the transaction is not triggered becauseestimateGas
probably fails), the nonce has been incremented, and all the following transactions will just wait forever because there will be a nonce gapExpected Behavior
If the call to writeContract or equivalent fails, the nonce should not be incremented (or be re-decremented)?
Steps To Reproduce
No response
Link to Minimal Reproducible Example
https://stackblitz.com/edit/viem-getting-started-9lqybgzb?file=index.ts
Anything else?
No response
The text was updated successfully, but these errors were encountered: