Giter Site home page Giter Site logo

Comments (7)

laurentsenta avatar laurentsenta commented on May 21, 2024 1

Sorry for the commit spam, I had a trial & error time with our CI.

We don't mind you closing this ticket since we don't need the measure of the inner contract's new().

FWIW, the workaround we came up with:

  • Give the contract its own file,
  • artifacts.require the contract during migration. That way eth-gas-reporter knows about it during test setup.

The reports looks fine now, thanks for maintaining the lib!

from eth-gas-reporter.

cgewecke avatar cgewecke commented on May 21, 2024

@elenadimitrova Thanks for raising this - adding it to the README as a shortcoming. To capture this data automatically I think we'd need to inspect each transaction trace for CREATE opcodes, get the contract creation address from memory and track gas usage at the opcode level.

At the moment the only work around is to have a fake test that calls new on the 'interior' contract in order to get the gas reading. Not sure if that's viable for your case.

from eth-gas-reporter.

laurentsenta avatar laurentsenta commented on May 21, 2024

Thanks for the details @cgewecke

I think the another issue we're experiencing comes from the mapMethodToContract that relies on listing .sol files. Our inner contract doesn't have its own file.
https://github.com/cgewecke/eth-gas-reporter/blob/master/gasStats.js#L312

I'm not familiar with the truffle stack yet, maybe an unknown mapping is common.
Else, It could be nice to log a warning that happens:
https://github.com/cgewecke/eth-gas-reporter/blob/master/index.js#L51

from eth-gas-reporter.

cgewecke avatar cgewecke commented on May 21, 2024

@lsenta Yes, that's a good idea.

Actually, I looked through your repo and was wondering where the missing contract is. Even the trace tracking idea mentioned above would require the existence of a source file and a truffle build 'artifact' that contains information like the ABI, the contract name, and the solc AST.

If that information is available the gas-reporter (as written) should be able to collect data about method calls. It can't capture deployment costs if the contract only deploys via another contract though.

from eth-gas-reporter.

cgewecke avatar cgewecke commented on May 21, 2024

Ok excellent! Thanks for the solution @lsenta.

Will leave this open for the time being because I think it's still an issue / confusing for anyone who is using a factory method for deployments.

from eth-gas-reporter.

flockonus avatar flockonus commented on May 21, 2024

+1 to this issue. I'm deploying contracts multiple times during test to reset the contract state, so would be pretty nice to have an option to track contracts deployed while the test is running.

*ps: just found this lib, it's amazing

from eth-gas-reporter.

sebastiantf avatar sebastiantf commented on May 21, 2024

This would be really nice to have. I have a factory contract that deploys a contract, for which the source is not part of the codebase, but available in one of the dependency packages. I have tests that call the child contract, but no report is generated for such calls. I tried using remoteContracts for this, but didnt work out

from eth-gas-reporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.