Skip to content

Commit

Permalink
trying to fix gas report generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Jan 11, 2024
1 parent fa87080 commit be18c18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
env:
FORCE_COLOR: 1
GAS: true
GAS_REPORT: gasReporterOutput.json
steps:
- uses: actions/checkout@v4
- name: Set up environment
Expand Down
24 changes: 11 additions & 13 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,16 @@ const argv = require('yargs/yargs')()
},
}).argv;

// implies doesn't work correcly. we force gas if gasReport is set

Check failure on line 58 in hardhat.config.js

View workflow job for this annotation

GitHub Actions / codespell

correcly ==> correctly
argv.gas ||= !!argv.gasReport

require('@nomicfoundation/hardhat-toolbox');
require('@nomicfoundation/hardhat-ethers');
require('hardhat-ignore-warnings');
require('hardhat-exposed');
require('solidity-docgen');
argv.coverage && require('solidity-coverage');
argv.gas && require('hardhat-gas-reporter');
argv.foundry && require('@nomicfoundation/hardhat-foundry');

if (argv.foundry && argv.coverage) {
Expand Down Expand Up @@ -101,30 +106,23 @@ module.exports = {
networks: {
hardhat: {
allowUnlimitedContractSize: !withOptimizations,
initialBaseFeePerGas: argv.coverage ? 0 : undefined,
},
},
exposed: {
imports: true,
initializers: true,
exclude: ['vendor/**/*'],
},
docgen: require('./docs/config'),
};

if (argv.gas) {
require('hardhat-gas-reporter');
module.exports.gasReporter = {
gasReporter: {
enabled: argv.gas,
showMethodSig: true,
currency: 'USD',
outputFile: argv.gasReport,
coinmarketcap: argv.coinmarketcap,
};
}

if (argv.coverage) {
require('solidity-coverage');
module.exports.networks.hardhat.initialBaseFeePerGas = 0;
}
},
docgen: require('./docs/config'),
};

function hasFoundry() {
return proc.spawnSync('forge', ['-V'], { stdio: 'ignore' }).error === undefined;
Expand Down

0 comments on commit be18c18

Please sign in to comment.