Using --deploy-fixture (hardhat-deploy option) results in empty gas report
See original GitHub issueIt looks like by adding a call to ethers
my gas report goes from being populated to completely empty.
Here is the deploy script disabling the gas reporting: if I comment out the lines Iโve marked gar report comes back.
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { upgrades } = hre;
const factory = await hre.ethers.getContractFactory("ReceiversHolder"); // this is the culprit
const instance = await upgrades.deployProxy(factory, [[]]); // this must be comment to avoid compilation errors
await instance.deployed(); // this must be comment to avoid compilation errors
};
export default func;
My dev deps are:
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.4",
"@nomiclabs/hardhat-etherscan": "^2.1.8",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/contracts": "^4.4.0",
"@openzeppelin/contracts-upgradeable": "^4.4.0",
"@openzeppelin/hardhat-upgrades": "^1.13.0",
"@typechain/ethers-v5": "^7.2.0",
"@typechain/hardhat": "^2.3.1",
"@types/chai": "^4.3.0",
"@types/data-urls": "^2.0.1",
"@types/mocha": "^9.0.0",
"@types/node": "^16.4.0",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"base64-sol": "^1.1.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"data-urls": "^3.0.0",
"dotenv": "^10.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-promise": "^5.2.0",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.3",
"hardhat": "^2.7.1",
"hardhat-deploy": "^0.9.14",
"hardhat-deploy-ethers": "^0.3.0-beta.11",
"hardhat-gas-reporter": "^1.0.6",
"hardhat-packager": "^1.2.1",
"npm-prepare-dist": "^0.3.3",
"prettier": "^2.5.1",
"prettier-plugin-solidity": "^1.0.0-beta.13",
"recursive-copy": "^2.0.13",
"solhint": "^3.3.6",
"solidity-coverage": "^0.7.17",
"ts-node": "^10.1.0",
"typescript": "^4.3.5"
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
wighawag/hardhat-deploy - GitHub
This task will export the contract deployed (saved in deployments folder) to a file with a simple format containing only contract addresses and...
Read more >deploy-fixture (hardhat-deploy option) results in empty gas ...
It looks like by adding a call to ethers my gas report goes from being populated to completely empty. Here is the deploy...
Read more >Hardhat-Gas-Reporter reports empty with Waffle
My case was that those testcases were skipped thus gas-reporter reported empty one.
Read more >Deploying your contracts | Ethereum development ... - Hardhat
#Deploying your contracts ยท Start a local node. npx hardhat node ยท Open a new terminal and deploy the smart contract in the...
Read more >How to deploy your first smart contract on Ethereum with ...
Tagged with ethereum, solidity, web3, hardhat. ... the msg.value (amount of ether sent with the transaction) is empty (0 ethers)ย ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We experienced similar problems with missing gas reports for functions in many different use cases.
I was trying to reproduce the problem with a minimal configuration and I came to a conclusion that any usage of
ethers
in the deployment script along with the--deploy-fixture
flag causes the gas report to be broken.Please find an example in the repository https://github.com/nkuba/hardhat-gas-reporter-playground.
After running the
yarn test
you will get a following report:Itโs enough to comment out the line referenced below to get a correct report.
ethers.utils.isAddress("0xFaKeAddrEss")
Just tried adding this to the command from Bleeps (
HARDHAT_DEPLOY_FIXTURE=true HARDHAT_COMPILE=true mocha --bail --recursive test
) and looks like it invokedeth-gas-reporter
but it had problems connecting:In any case I think this answers my question - mocha is just using its own reporter and has to be configured to use
eth-gas-reporter
- which is what Hardhat does by default. This unfortunately does not solve the problem I had with it - I was hoping I could somehow get an unmodifiednpm run test
command to report gas - but itโs also not like itโs a huge problem.npm run test
would just be a bit less likely to break in case a project changes the command to run tests in a different way. I just thought it might have been a bug in the reporter but looks like itโs not ๐