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

Ganache crashes when estimating gas for a transaction #433

Closed
cag opened this issue Jun 11, 2019 · 1 comment
Closed

Ganache crashes when estimating gas for a transaction #433

cag opened this issue Jun 11, 2019 · 1 comment

Comments

@cag
Copy link

cag commented Jun 11, 2019

Expected Behavior

Ganache doesn't crash. I've tried the same set of actions against geth --dev successfully.

Current Behavior

Ganache crashes during a transaction(/gas estimation?) which otherwise works fine with geth --dev (requires some finagling and I haven't tried it with Parity dev mode or anything else yet).

Steps to Reproduce (for bugs)

This is kind of gnarly to reproduce, as I haven't isolated the issue yet. I'll update this later to be more focused if I have some bandwidth to do so.

  1. Run node -e "require('.').server().listen(8545)" in a clone of ganache-core.
  2. In another terminal, clone https://github.com/gnosis/hg-first-decentralized-market and checkout the update-deps branch.
  3. Run npm i && npm run migrate && npm start.
  4. Navigate to http://localhost:8080, click "Approve Market Maker", and then select "Yes", enter an amount, and click "Buy".
  5. Observe the following stack trace:
/path/to/ganache-core/lib/utils/gasEstimation.js:88
      rootBegin: steps.systemOps[begin][0],
                                       ^
TypeError: Cannot read property '0' of undefined
    at findRootScope (/path/to/ganache-core/lib/utils/gasEstimation.js:88:40)
    at getTotal (/path/to/ganache-core/lib/utils/gasEstimation.js:155:36)
    at getTotal (/path/to/ganache-core/lib/utils/gasEstimation.js:192:25)
    at /path/to/ganache-core/lib/utils/gasEstimation.js:42:21
    at /path/to/ganache-core/node_modules/ethereumjs-vm/dist/runTx.js:70:9
    at /path/to/ganache-core/node_modules/async/dist/async.js:969:16
    at next (/path/to/ganache-core/node_modules/async/dist/async.js:5225:18)
    at /path/to/ganache-core/node_modules/ethereumjs-vm/dist/cache.js:160:13
    at /path/to/ganache-core/node_modules/merkle-patricia-tree/util.js:51:36
    at /path/to/ganache-core/node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:52:16
    at done (/path/to/ganache-core/node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:246:17)
    at /path/to/ganache-core/node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:44:16
    at /path/to/ganache-core/lib/database/levelupobjectadapter.js:110:7
    at /path/to/ganache-core/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/path/to/ganache-core/node_modules/async/dist/async.js:1064:13)
    at /path/to/ganache-core/node_modules/async/dist/async.js:969:16
    at /path/to/ganache-core/node_modules/level-sublevel/shell.js:53:51
    at /path/to/ganache-core/node_modules/level-sublevel/nut.js:109:13
    at /path/to/ganache-core/lib/database/filedown.js:64:7
    at /path/to/ganache-core/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/path/to/ganache-core/node_modules/async/dist/async.js:1064:13)
    at /path/to/ganache-core/node_modules/async/dist/async.js:969:16

What's strange is that there's a line await lmsrMarketMaker.trade(...) which causes Ganache to crash, but the same kind of transaction can be found many times in the test cases for https://github.com/gnosis/hg-market-makers, and there, Ganache has no issue with the test suite.

Your Environment

@cag cag changed the title Ganache crashes when running a transaction Ganache crashes when estimating gas for a transaction Jun 11, 2019
@cag
Copy link
Author

cag commented Jun 17, 2019

The rewrite of the gas estimation logic in #435 resolves this issue.

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

2 participants