Usage of FakeTransaction from ethereumjs-tx
See original GitHub issueI 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:
- Created 5 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Just solved that mystery -
ganache-core
depended onethereumjs-tx@^1.3.0
and1.3.4
was the version found in itspackage-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 selectedethereumjs-tx@1.3.6
, putting ethereumjs/ethereumjs-tx#113 into play forganache-cli@6.1.5
.I’ve fixed this by pinning
ganache-core
’sethereumjs-tx
dependency to1.3.4
(dropped the carat operator), and releasingganache-core@2.1.5
. This is the only difference between 2.1.4 and 2.1.5. I’m now in the process of releasingganache-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!
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