-
-
Notifications
You must be signed in to change notification settings - Fork 93
Add option to collect gas data in before / beforeEach blocks #97
Comments
@vongohren The module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
},
truffle: {
host: "localhost",
port: 9545,
network_id: "*" // Match any network id
}
},
mocha: {
reporter: 'eth-gas-reporter'
}
}; |
@cgewecke Trololo, those late nights of coding! Quick question though. |
@vongohren Ah, weird. I'll check it out..... |
@cgewecke @vongohren Looking at the contracts most of the functions are just views so not changing the state and e.g |
@andreafspeziale so yeah there are alot of view methods in this test, but there is state change on all three methods, changeOwner, addDelegate, addAttribute, but they are internal methods. They are called during the test, and probably where the gas estimation pops up during mocha reporting. They are called from methods that either does a sign check before, or methods that calls them directly, but using msg.sender onwards. But yeah @andreafspeziale, it seems that its mentioned in that issue that methods that are not directly called is troublesome. Any further comments on that @cgewecke in regards to #94 |
@vongohren @andreafspeziale I'm not sure....just scanning the tests it seems like the public methods call the internal methods and it should be working. I'm going pull the uport repo down and look at what's happening. Will report back tomorrow, sorry :) Get some sleep! |
@vongohren It turns out the problem is that the gas reporter intentionally excludes transactions that happen in a It's quite common for tests like it('should change owner mapping', async () => {
tx = await didReg.changeOwner(identity, delegate, {from: identity})
owner = await didReg.owners(identity)
assert.equal(owner, delegate)
}) |
@cgewecke I see, it is a good choice of architecture, but if one see this pattern happening more and more, maybe add a flag or something in config? |
@vongohren Yes I think you're right - it might be good idea even if that pattern is really rare. Thanks for raising this. |
@cgewecke yeah i can agree. But if you include this I was going to to a PR adding this to their repo. Free marketing towards uPort :P |
Ah ok! I'll ping you. |
@cgewecke did anything happen here :)? Was doing some cleaning of open issues |
Hi! eth-gas-reporter is being deprecated in favor of hardhat-gas-reporter. The latest version at Hardhat has been completely decoupled from mocha. https://github.com/cgewecke/hardhat-gas-reporter/releases/tag/v2.0.0 |
So i just want to check what are the dependencies to get this to run.
I have done a simple unbox, getting metacoin example.
~/code/truffle/node_modules/.bin/truffle unbox
Yes im running from the cloned main repo cause im testing some other stuff that needs new developments
Then I got this lib
npm install --save-dev eth-gas-reporter
I started a truffle develop instance on the side.
~/code/truffle/node_modules/.bin/truffle develop
I configured the truffle.js with mock example and added network truffle to target truffle develop instance.
The I ran truffle test
~/code/truffle/node_modules/.bin/truffle test --network truffle
But no report.
What did I miss along the way?
The text was updated successfully, but these errors were encountered: