Better nonce handling with many/parallel transactions #1338
Unanswered
deanpress
asked this question in
Idea / Feature Request
Replies: 2 comments 4 replies
-
That's a must need. |
Beta Was this translation helpful? Give feedback.
3 replies
-
I found this project implement a none manage. Anyone have read it? https://github.com/latticexyz/mud/blob/main/packages/common/src/createNonceManager.ts |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, viem lacks built-in support for efficient nonce management when making many transactions from the same account in quick/parallel succession. This can lead to nonce collisions or inconsistency, resulting in transactions failing with invalid nonce errors.
I propose the addition of improved nonce management in viem, specifically when it comes to many parallel transactions (similar to ethers' NonceManager plug-in). Nonces should be managed automatically for each transaction sent from the same Ethereum address, ensuring that transactions are processed properly without being reliant on manual nonce implementations, and minimizing "nonce too low/high" errors.
When one out of many (semi) parallel transactions fails, new and pending transactions should still be broadcast/retried without nonce errors, even if no nonce was manually specified.
Feature Details:
Auto-increment Nonce: The utility should keep track of the last used nonce for a given account and auto-increment it for the next transaction. Currently this appears to fail when many transactions are being broadcast in parallel.
Concurrency Support: Capability to handle multiple transactions in parallel, ensuring that each gets its own unique nonce.
Error Handling: Effective mechanisms to handle errors, including nonce collisions, to give a chance for transactions to be retried in viem's built-in retry system.
Beta Was this translation helpful? Give feedback.
All reactions