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.

Usage of FakeTransaction from ethereumjs-tx

See original GitHub issue

I have a fairly simple setup: deploy some contracts and then run some tests. Initially it worked via ganache-cli, but encountered an issue which is addressed in this PR: https://github.com/trufflesuite/ganache-core/pull/130.

To fix it I started to use server from ganache-core, but strangely enough the results were bit different and core breaks first time eth_sendRawTransaction is used. cli seems to work fine. The transaction’s data is exactly the same and contracts are deployed successfully in both cases. The error message said: TXRejectedError: the tx doesn\'t have the correct nonce. account has nonce of: 0 tx has nonce of: 6, but it seemed rather suspicious as I always obtain nonce directly from the rpc node via eth_getTransactionCount. I pinned down the problem to missing from field after the transaction was re-created on the server side. This: https://github.com/unao/ganache-core/commit/f656b6e846b13d6896248ef7468fedd280cd6e7d seems to fix the issue.

To be honest I do not understand what is the root cause of it and if my hacky fix is safe/good enough.

The real mysterious part is why it works in case of cli, but not core. From what I saw cli just starts the server. My best hypotheses would be that webpack build somehow modifies the semantics slightly.

Your Environment

  • Version used: ganache-core 2.1.2, ganache CLI v6.1.3 (ganache-core: 2.1.2)
  • Environment name and version (e.g. PHP 5.4 on nginx 1.9.1): node 8.11.2
  • Server type and version:
  • Operating System and version: ubuntu 16.04
  • Link to your project:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
benjamincburnscommented, Jul 9, 2018

The real mysterious part is why it works in case of cli, but not core. From what I saw cli just starts the server. My best hypotheses would be that webpack build somehow modifies the semantics slightly.

Just solved that mystery - ganache-core depended on ethereumjs-tx@^1.3.0 and 1.3.4 was the version found in its package-lock.json however it seems that npm doesn’t give a hoot about transitive dependencies’ package-lock.json files, so when I refreshed that file prior to cutting the last release it selected ethereumjs-tx@1.3.6, putting ethereumjs/ethereumjs-tx#113 into play for ganache-cli@6.1.5.

I’ve fixed this by pinning ganache-core’s ethereumjs-tx dependency to 1.3.4 (dropped the carat operator), and releasing ganache-core@2.1.5. This is the only difference between 2.1.4 and 2.1.5. I’m now in the process of releasing ganache-cli@6.1.6 which will point at this new release. I’ll catch up with the Ganache project (electron UI) tomorrow.

Thanks for this, @kipliklotrika!

0reactions
ajhodgescommented, Jul 25, 2018

I think this issue was related to a bug that was fixed in https://github.com/ethereumjs/ethereumjs-tx/pull/118

ethereumjs-tx@1.3.7 contains the fix! Should also fix https://github.com/trufflesuite/ganache-cli/issues/523

Read more comments on GitHub >

github_iconTop Results From Across the Web

Usage of FakeTransaction from ethereumjs-tx #131 - GitHub
I have a fairly simple setup: deploy some contracts and then run some tests. Initially it worked via ganache-cli, but encountered an issue ......
Read more >
@ethereumjs/tx - npm
Start using @ethereumjs/tx in your project by running `npm i @ethereumjs/tx`. ... Creating a fake transaction for use in e.g. VM.
Read more >
ethereumjs-tx | Yarn - Package Manager
Chain and Hardfork Support​​ The Transaction and FakeTransaction constructors receives a second parameter that lets you specify the chain and hardfork to be...
Read more >
Ethereumjs-tx NPM - npm.io
The Transaction and FakeTransaction constructors receives a second parameter that lets you specify the chain and hardfork to be used.
Read more >
ethereumjs-tx - npm Package Health Analysis - Snyk
A simple module for creating, manipulating and signing Ethereum transactions For more information about how to use this package see README · Security...
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