Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

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

Closed
LogvinovLeon opened this issue Jan 18, 2019 · 8 comments
Closed

Comments

@LogvinovLeon
Copy link
Contributor

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
@davidmurdoch
Copy link
Member

My hunch is that when tracing the transaction with debug_traceTransaction the transaction reply hits the EVM's cache, which contains a stale nonce value from the initial transaction. I believe this has been fixed in the develop branch and will be in the next release.

I'll leave this issue open until I can confirm if its fixed or not. Thanks again, @LogvinovLeon!

@BlinkyStitt
Copy link

@davidmurdoch Have you been able to confirm if this is fixed or not?

@LogvinovLeon
Copy link
Contributor Author

@davidmurdoch Ping

@davidmurdoch
Copy link
Member

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

@LogvinovLeon
Copy link
Contributor Author

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

@dikshasonics2000
Copy link

"TXRejectedError: the tx doesn't have the correct nonce. account has nonce of: 0 tx has nonce of: 4\n" +
' at validateNonce (C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\lib\statemanager.js:1017:11)\n' +
' at C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\lib\statemanager.js:1026:7\n' +
' at C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\lib\blockchain_double.js:444:5\n'
+
' at C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:97:9\n' +
' at C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:520:18\n' +
' at Object._return [as return] (C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:545:13)\n' +
' at processNode (C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:328:34)\n' +
' at processNode (C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:579:9)\n' +
' at C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:574:17\n' +
' at C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\static\node\node_modules\ganache-core\node_modules\merkle-patricia-tree\baseTrie.js:212:11\n' +
' at processTicksAndRejections (internal/process/task_queues.js:75:11)',
name: 'TXRejectedError'
}
}

Ca
Screenshot (523)Can someone tell how to solve this, I am sending a transaction and using ganache provider for this. But i dont know whts wrong with this nonce

@davidmurdoch
Copy link
Member

@dikshasonics2000
Copy link

@dikshasonics2000 try updating ganache UI to v 2.7 0 https://github.com/trufflesuite/ganache-ui/releases/tag/v2.7.0

Yes i will try doing that, thanks for the help :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants