cgewecke / hardhat-gas-reporter

Gas Usage Analytics for Hardhat
MIT License
412 stars 57 forks source link

eth-gas-reporter with Hardhat multiple compiler versions #133

Open R-Santev opened 1 year ago

R-Santev commented 1 year ago

Hello,

I have a Hardhat configuration with multiple compiler versions, but I can't see how the hardhat-gas-reporter handles it. It would be fantastic if you provide more information about that.

My compiler setup:

solidity: {
    compilers: [
      {
        version: '0.8.17',
        settings: {
          optimizer: {
            enabled: true,
            runs: 800,
          },
        },
      },
      {
        version: '0.5.4',
        settings: {
          optimizer: {
            enabled: true,
            runs: 200,
          },
        },
      },
    ],
  }

hardhat-gas-reporter output when I run all my tests (including contracts compiled with 0.8.17 and 0.5.4):

image

I tried to run only the tests for contracts compiled with 0.5.4 but the eth-gas-reporter output was the same: image

I expected at least in this situation to see a different result, but no.

I really appreciate any help you can provide.

ToJen commented 1 year ago

Similar experience here

zeGzD commented 6 months ago

It would be nice to have this feature.

SvenMeyer commented 4 months ago

All my contract use (now) 0.8.25 , but the gas reporter always showed Solidity: 0.5.8:

···················································································································
|  Solidity and Network Configuration                                                                             │
······························|·················|···············|·················|································
|  Solidity: 0.5.8            ·  Optim: true    ·  Runs: 200    ·  viaIR: false   ·     Block: 30,000,000 gas     │
······························|·················|···············|·················|································

For a long time I was wondering why nobody else has (apparently) that issue, complains, and it gets fixed ... No matter what I finally thought I should create an issue ... but then quickly found this one.

... and yes, I had an old solc configuration for 0.5.8 still in my hardhat.config.ts which I actually do not need any more. So, I just removed that and now the gas reporter is correctly showing my solc 0.8.25 , which is now the only configured compiler.

Maybe at least show the latest solc version in the output ? ... or all which were used ?