The tx doesn't have the correct nonce when calling `debug_traceTransaction`
See original GitHub issueExpected Behavior
I expect ganache to return a transaction trace.
Current Behavior
Currently it throws that error:
Error: the tx doesn't have the correct nonce. account has nonce of: 0 tx has nonce of: 1
at /Users/leonidlogvinov/0x/ganache-core/node_modules/ethereumjs-vm/dist/runTx.js:117:12
at /Users/leonidlogvinov/0x/ganache-core/node_modules/ethereumjs-vm/dist/cache.js:57:7
at /Users/leonidlogvinov/0x/ganache-core/node_modules/ethereumjs-vm/dist/cache.js:44:5
at /Users/leonidlogvinov/0x/ganache-core/node_modules/merkle-patricia-tree/baseTrie.js:77:5
at /Users/leonidlogvinov/0x/ganache-core/node_modules/merkle-patricia-tree/baseTrie.js:461:14
at Object.return (/Users/leonidlogvinov/0x/ganache-core/node_modules/merkle-patricia-tree/baseTrie.js:485:9)
at processNode (/Users/leonidlogvinov/0x/ganache-core/node_modules/merkle-patricia-tree/baseTrie.js:285:30)
at processNode (/Users/leonidlogvinov/0x/ganache-core/node_modules/merkle-patricia-tree/baseTrie.js:521:5)
at /Users/leonidlogvinov/0x/ganache-core/node_modules/merkle-patricia-tree/baseTrie.js:516:13
at /Users/leonidlogvinov/0x/ganache-core/node_modules/merkle-patricia-tree/baseTrie.js:180:7
at process._tickCallback (internal/process/next_tick.js:61:11)
It’s surprising that this nonce issue doesn’t happen when I send the transaction. It’s successfully mined. And then when I ask for a trace it breaks with that message.
Here is the ganache verbose log of what was happening before the failure.
Possible Solution
Steps to Reproduce (for bugs)
I’ve created a repro branch.
Context
I’m trying to measure code coverage using debug traces, but I can’t get them out of ganache because of that issue.
Your Environment
- Version used: latest development using npm links (but latest published has the same problem)
- Environment name and version (e.g. PHP 5.4 on nginx 1.9.1):
- Server type and version:
- Operating System and version: Mac
- Link to your project: https://0x.org
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
The tx doesn't have the correct nonce when calling ... - GitHub
My hunch is that when tracing the transaction with debug_traceTransaction the transaction reply hits the EVM's cache, which contains a stale ...
Read more >TestRPC/Ganache: the tx doesn't have the correct nonce
Resetting an Account In the Settings menu, MetaMask has a "Reset Account" button. This button wipes the current account's transaction history, which is...
Read more >How to solve TX doesn't have the correct nonce when using ...
To solve this error, you have to reset your Metamask account so that it can re-sync with your local blockchain. To do that,...
Read more >debug_traceTransaction - Alchemy Docs
Attempts to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@davidmurdoch My bad. I just confirmed that the newest release of Ganache has it fixed! Thanks! Now you can use @0x/sol-trace and @0x/sol-coverage with Ganache.
@LogvinovLeon When running
yarn && yarn teston the provided repository (on branchfeature/ganache-nonce-issue-repo) the test passes (1 passing). Do I need to change the truffle-config in order to reproduce?