Provided install instruction doesn't works
See original GitHub issue- Installing:
npm install --save-dev eth-gas-reporter
- Updating
truffle.js
:mocha: { reporter: 'eth-gas-reporter', reporterOptions: { currency: 'USD', gasPrice: 10 } }
- Starting test that call single contract method (contract is not abstract or empty):
npm test
Results:
TypeError: Cannot read property 'gasUsed' of undefined
at names.forEach.name (/home/alp/proj/coinbet/smartcontracts/node_modules/eth-gas-reporter/gasStats.js:396:52)
at Array.forEach (<anonymous>)
at files.forEach.file (/home/alp/proj/coinbet/smartcontracts/node_modules/eth-gas-reporter/gasStats.js:371:11)
at Array.forEach (<anonymous>)
at Object.mapMethodsToContracts (/home/alp/proj/coinbet/smartcontracts/node_modules/eth-gas-reporter/gasStats.js:367:9)
at Runner.Gas.runner.on (/home/alp/proj/coinbet/smartcontracts/node_modules/eth-gas-reporter/index.js:119:65)
at emitNone (events.js:111:20)
at Runner.emit (events.js:208:7)
at start (/home/alp/proj/coinbet/smartcontracts/node_modules/mocha/lib/runner.js:826:10)
at Runner.run (/home/alp/proj/coinbet/smartcontracts/node_modules/mocha/lib/runner.js:854:5)
at Mocha.run (/home/alp/proj/coinbet/smartcontracts/node_modules/mocha/lib/mocha.js:572:17)
at /home/alp/proj/coinbet/smartcontracts/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:125:1
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! Test failed. See above for more details.
Some internals of call:
name=Bookmaker,
receipt=undefined,
networkDeployment={"events":{"0x935856f3097b8ffdc9b085ee61554545ca742030543944cd41d542d796b51af5":{"anonymous":false,"inputs":[{"indexed":false,"name":"packed","type":"bytes32"},{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"isPartial","type":"bool"},{"indexed":false,"name":"partialAmount","type":"uint256"},{"indexed":false,"name":"partialRefund","type":"uint256"}],"name":"BetMatched","type":"event"},"0x68a467eb69c9153bb488325db1dec0f7ffc2197d32b3532509c15e9b72da40bf":{"anonymous":false,"inputs":[{"indexed":false,"name":"packed","type":"bytes32"},{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"isPartial","type":"bool"}],"name":"BetReturned","type":"event"},"0x686d72213469ef6c12d025ee2ba86e632776edb3735da5a259b88ede34865e5c":{"anonymous":false,"inputs":[{"indexed":false,"name":"packed","type":"bytes32"},{"indexed":false,"name":"homeOrAway","type":"uint256"},{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"isPartial","type":"bool"}],"name":"BetPaid","type":"event"}},"links":{"MyLib":"0xf5ca4f56211c3b879902bd43b290d2160ae0dbaa"}},
networkId=1537711868842,
networkDeployment.transactionHash=undefined
contract.networks={"1537711868842":{"events":{"0x935856f3097b8ffdc9b085ee61554545ca742030543944cd41d542d796b51af5":{"anonymous":false,"inputs":[{"indexed":false,"name":"packed","type":"bytes32"},{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"isPartial","type":"bool"},{"indexed":false,"name":"partialAmount","type":"uint256"},{"indexed":false,"name":"partialRefund","type":"uint256"}],"name":"BetMatched","type":"event"},"0x68a467eb69c9153bb488325db1dec0f7ffc2197d32b3532509c15e9b72da40bf":{"anonymous":false,"inputs":[{"indexed":false,"name":"packed","type":"bytes32"},{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"isPartial","type":"bool"}],"name":"BetReturned","type":"event"},"0x686d72213469ef6c12d025ee2ba86e632776edb3735da5a259b88ede34865e5c":{"anonymous":false,"inputs":[{"indexed":false,"name":"packed","type":"bytes32"},{"indexed":false,"name":"homeOrAway","type":"uint256"},{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"isPartial","type":"bool"}],"name":"BetPaid","type":"event"}},"links":{"MyLib":"0xf5ca4f56211c3b879902bd43b290d2160ae0dbaa"}}}
OS: Linux Mint 18 Node: 8.11.3 Truffle: 4.1.14 Ganache-cli: 6.1.8
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
How to troubleshoot Windows Installer errors - Microsoft Support
Click Start windows icon · At the command prompt, type MSIExec, and then press Enter. · If the MSI engine is working, you...
Read more >Install Windows 10 on your Mac with Boot Camp Assistant
Use the Boot Camp installer in Windows Follow the onscreen instructions to install Boot Camp and Windows support software (drivers). You will ...
Read more >Nest Power Connector - Google Nest Help
Use a helper if possible and avoid installing the device when home alone. Basic installation guide. The Nest Power Connector comes with instructions...
Read more >Software & Installation Instructions - IDHS - Illinois
ROCS Version 6.13 is available for 64-bit operating systems like Windows 10 Professional only. HOME PREMIUM versions of Windows operating systems are NOT...
Read more >Installation Guide - BTAWiki - Battletech Advanced 3062
BTA3062 IS NOT COMPATIBLE WITH THE XBOX GAME PASS VERSION OF ... the BattleTech Advanced 3062 Installer from the link provided above.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just ran into this issue. My local environment is: OS: Ubuntu 18.04.4 LTS 64-bit Truffle v5.1.14 (core: 5.1.14) Solidity - 0.5.16 (solc-js) Node v10.19.0 Web3.js v1.2.1 eth-gas-reporter 0.2.15
The issue happened after I deleted a couple of contracts and removed them from my migration script file.
After some investigation, I noticed in file
gasData.js
the call to the method.getContractNames(file)
(line 43) was still returning the name of one of the deleted files, and when trying to process it, it would throw this error (it couldn’t get a valid receipt for the invalid transactionHash, which was not null - but probably some stale value).I identified that my folder
build/contracts
still contained the ABI .json files for the deleted contracts. So as a workaround, I delete the entirebuild/contracts/
folder and runtruffle compile --all
to recompile the contracts.It fixed the issue for me. Not sure why this was important, but maybe something related to inheritance between existing and deleted contracts ( 🤔 ❓ ).
PS: After I fixed it, I tried to reproduce the issue again but couldn’t. I’ll try again when I have some spare time and if I’m able to reproduce it, I’ll try to submit a PR with a fix or at least, open another issue with more specific details on how to reproduce it.
@fodisi Thanks for analyzing this!
Yes, I wonder if a simple remedy might be to wrap some of this logic in a try/catch and ignore stale deployments…
https://github.com/cgewecke/eth-gas-reporter/blob/e48894857888f7cfe1c1886bdef0f6a7916be491/lib/gasData.js#L62-L68
I’m going to open this as a separate issue so it doesn’t get lost…