Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HH201 error when using with hardhat-toolbox #229

Open
StephanGerbeth opened this issue May 11, 2024 · 6 comments
Open

HH201 error when using with hardhat-toolbox #229

StephanGerbeth opened this issue May 11, 2024 · 6 comments

Comments

@StephanGerbeth
Copy link

Hi,

i get the following error, after required the package

require('hardhat-gas-reporter');

in my hardhat config. No additional config.

Error HH201: Could not set param output for task gas-reporter:merge because its name is already used.

It seems the legacy tasks in your index file create those problem.

Or am I doing something wrong?

Cheers

@cgewecke
Copy link
Owner

@StephanGerbeth Could you provide additional details:

  • are you running the merge task?
  • what version of hardhat are you using?

@StephanGerbeth
Copy link
Author

@cgewecke i use hardhat@2.22.3 and this is my hardhat.config.cjs

require('@nomicfoundation/hardhat-toolbox');
require('@nomicfoundation/hardhat-ethers');
require('@nomicfoundation/hardhat-chai-matchers');
require('@unlock-protocol/hardhat-plugin');
require('hardhat-contract-sizer');
require('hardhat-gas-reporter');

const dotenv = require('dotenv-mono');

dotenv.config();

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: {
    version: '0.8.23',
    settings: {
      optimizer: {
        enabled: true,
        runs: 200
        // details: {
        //   yulDetails: {
        //     optimizerSteps: 'u'
        //   }
        // }
      },
      viaIR: true
    }
  },

  contractSizer: {
    alphaSort: true,
    disambiguatePaths: false,
    runOnCompile: true,
    strict: true
  },

  gasReporter: {
    enabled: false,
    currency: 'EUR',
    L2: 'base',
    coinmarketcap: '...'
  },

  paths: {
    cache: './cache/'
  },

  networks: {
    hardhat: {
      loggingEnabled: false,
      allowUnlimitedContractSize: true
    },
    // for mainnet
    'base-mainnet': {
      url: 'https://mainnet.base.org',
      accounts: [process.env.MASTER_PRIVATE_KEY],
      gasPrice: 1000000000
    },
    // for Sepolia testnet
    'base-sepolia': {
      url: 'https://sepolia.base.org',
      accounts: [process.env.MASTER_PRIVATE_KEY],
      gasPrice: 1000000000
    },
    // for local dev environment
    'base-local': {
      url: 'http://localhost:8545',
      gasPrice: 1000000000
    }
  },
  defaultNetwork: 'base-local'
};

i don't actively run the merge task.

@cgewecke
Copy link
Owner

@StephanGerbeth I think the problem is that hardhat-toolbox (at the top of your config) includes an earlier version (v1) of the gas reporter, so the plugin is being loaded twice.

Would it be possible to see if things work without the toolbox? The complete list of plugins it comes with is at the link below,

https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-toolbox

@cgewecke
Copy link
Owner

Another option would be to coerce the version of hardhat-gas-reporter used by the toolbox to the latest version using something like yarn resolutions and let the toolbox load the plugin itself.

@StephanGerbeth
Copy link
Author

@cgewecke thanks for the fast response.
i didn't realized that hardhat-toolbox is loading an older version of hardhat-gas-reporter.

I use npm so I have to make an override

"overrides": {
    "hardhat-gas-reporter": "2.1.1"
  }

And it works perfectly. Thanks :)

@cgewecke
Copy link
Owner

@StephanGerbeth Oh good, Am going to reopen this issue for visibility so people can see your workaround.

The error message is very confusing and I suspect other people will run into this until the toolbox upgrades.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants