In Truffle, gas used by a Migration in deployer.deploy() is tracked by a Reporter using events emitted by the Migration.

If I have code of the form:

  .then(instance => instance.callSomeExpensiveMethod())

where a contract is deployed then a function is called on the deployed instance (for example an expensive configuration function that would cost too much gas to call during contract creation) the gas cost of the first line will be tracked but the gas cost of the second line will not (because it doesn't emit any events that the Reporter can use to update the total gas used).

Is this correct?

If this is correct, is there a way of notifying the Reporter that extra gas has been used so that the totals reported at the end are accurate?

Or would this be an incorrect use of the reporter?

I'm currently tracking and reporting on non-contract-creation transaction gas usage separately so if that is the correct approach I can keep doing that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.