trufflesuite / ganache

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
2.62k stars 682 forks source link

Ganache transactions become stuck in queued state with manual nonce management and concurrent senders #4522

Open kdelwat opened 1 year ago

kdelwat commented 1 year ago

I use Ganache as a local development server for an application which uses manual nonce management, and has concurrent senders of transactions from the same origin / Ethereum account.

Occasionally, and apparently non-deterministically, transactions will get stuck in the txpool in the queued state. The txpool_content RPC command shows the transaction has been assigned a nonce (e.g. 2), and checking the sender account using eth_getTransactionCount shows that the account nonce is up to the same nonce (2). I would expect that the transaction is then unqueued and mined.

Some thoughts:

Reproduction

This can be tricky to reproduce because it's race-condition-y / non-deterministic. I've set up a repo here with a minimal example that fails. Note that I often have to run this multiple times (>5) until I see the failure case.

https://github.com/kdelwat/ganache-repro