question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The tx doesn't have the correct nonce when calling `debug_traceTransaction`

See original GitHub issue

Expected 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:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
LogvinovLeoncommented, Feb 26, 2019

@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.

0reactions
davidmurdochcommented, Feb 25, 2019

@LogvinovLeon When running yarn && yarn test on the provided repository (on branch feature/ganache-nonce-issue-repo) the test passes (1 passing). Do I need to change the truffle-config in order to reproduce?

Read more comments on GitHub >

github_iconTop 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 >
TX doesn't have the correct nonce - Metamask
I'm trying to call the leafPicked ...
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found