question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1) enable reporter for imported contracts 2) gas-reporter discrepancies with mainnet

See original GitHub issue

Hi @cgewecke ,

I realized that hardhat-gas-reporter only seems to report for contracts who were compiled with hardhat and thus have certain files associated with them in artifacts/ .

Is this correct?

In our integration testing we make use of forking and thus instantiate many contracts with await ethers.getContractAt(abi, addresss) , where the abi is in a pre-compiled/ folder.

It would be amazing if hardhat-gas-reporter would also report gas usage of methods called on those instances.

What would need to change for that to happen?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cgeweckecommented, Dec 2, 2020

@gitpusha The remoteContracts option is now published with 1.0.2. And I suspect the discrepancy in gas readings is only fixable at hardhat.

Going to close this for now. Thanks for reporting all this stuff though.

1reaction
gitpushacommented, Nov 20, 2020

Here in the contract I shared you can see the console.logs.

    function execViaRoute0AndOpenVault(TaskReceipt memory _taskReceipt) public {
        uint256 gasLeft = gasleft();
        IGelatoCore(gelatoCore).exec(_taskReceipt);
        console.log(
            "Gas Cost execViaRoute0AndOpenVault: %s",
            gasLeft - gasleft()
        );
    }

And here is the TX from mainnet which is almost identical to the execViaRoute0AndOpenVault test transaction: https://etherscan.io/tx/0xdc810ac1cdd34a613ac739eea49807f62c17ba31ec9b1c5516837c07c35c1ab6

As you can see gasUsed is 2,215,931 here which is closer to the console.log value.

Read more comments on GitHub >

github_iconTop Results From Across the Web

upgrades.deployProxy did *not* deploy proxy (confused, fun ...
I have recently deployed a contract to the Ethereum Mainnet that I ... Obtain one at https://etherscan.io/ apiKey: etherScan }, gasReporter: ...
Read more >
hardhat-gas-reporter - UNPKG
The CDN for hardhat-gas-reporter. ... 1, import fs from "fs". 2, import path from "path" ... 41, * Filters out contracts to exclude...
Read more >
How to deploy your first smart contract on Ethereum ... - StErMi
Configure Hardhat to compile, deploy, test, and debug your Solidity code; Write a smart contract; Test your smart contract; Deploy your ...
Read more >
Ashish Kumar Singh on LinkedIn: #solidity #blockchain #ethereum ...
1. How to use a Library? You can either use an already deployed libraries like 'SafeMath' or 'Counters' by simply importing it, and...
Read more >
How to deploy your first smart contract on Ethereum with ...
Shall we proceed? What are you going to learn today? Configure Hardhat to compile, deploy, test, and debug your Solidity code; Write a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found