hardhat-gas-reporter icon indicating copy to clipboard operation
hardhat-gas-reporter copied to clipboard

hardhat-gas-reporter conflicts with smockit library

Open notsegfault opened this issue 3 years ago • 1 comments

When both are specified in hardhat.config.js

using version 1.0.4

require('@eth-optimism/smock/build/src/plugins/hardhat-storagelayout');
require("hardhat-gas-reporter");

It's impossible to create mocks like this:

const MyMock = await ethers.getContractFactory(
  "MyMockContract"
);
const mock = await MyMock.deploy();
await mock.deployed();

Error:

TypeError: Cannot read property 'from' of undefined
at addGasToAbiMethodsIfNecessary (node_modules/@nomiclabs/hardhat-ethers/src/helpers.ts:313:30)
at getContractFactoryByAbiAndBytecode (node_modules/@nomiclabs/hardhat-ethers/src/helpers.ts:254:27)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

If I try to yarn add ethers, the error changes to this:

TypeError: provider._init is not a function
at exports.smockit (node_modules/@eth-optimism/smock/src/smockit/smockit.ts:22:35)

It seems to be related to a conflict in both library ethers versions or BigNumber. If the bug is not related to hardhat-gas-reporter, I'll report to smockit instead.

notsegfault avatar Feb 17 '21 01:02 notsegfault

Thanks for reporting. Suspect it's a bug here, unfortunately 😄

Will investigate.

cgewecke avatar Feb 17 '21 02:02 cgewecke