hardhat-gas-reporter
hardhat-gas-reporter copied to clipboard
Apparent deadlock when combining plugin with `hardhat-ganache`
When combining hardhat-gas-reporter
with @nomiclabs/hardhat-ganache
plugin, there seems to be a deadlock and no test is ran:
$ npx hardhat --network ganache test --verbose --show-stack-traces
...
hardhat:core:hre Creating HardhatRuntimeEnvironment +0ms
hardhat:core:hre Running task test +76ms
hardhat:plugin:ganache Starting Ganache +0ms
hardhat:plugin:ganache-service Initializing server +0ms
hardhat:plugin:ganache-service Starting server +21ms
hardhat:core:hre Running test's super +608ms
hardhat:core:hre Running task compile +0ms
hardhat:core:hre Running task compile:get-compilation-tasks +0ms
hardhat:core:hre Running compile:get-compilation-tasks's super +0ms
hardhat:core:hre Running task compile:solidity +1ms
hardhat:core:hre Running task compile:solidity:get-source-paths +0ms
hardhat:core:hre Running task compile:solidity:get-source-names +30ms
hardhat:core:hre Running task compile:solidity:get-dependency-graph +7ms
hardhat:core:hre Running task compile:solidity:read-file +2ms
hardhat:core:hre Running task compile:solidity:read-file +1ms
hardhat:core:hre Running task compile:solidity:read-file +1ms
hardhat:core:hre Running task compile:solidity:read-file +14ms
hardhat:core:hre Running task compile:solidity:get-compilation-jobs +10ms
...
hardhat:core:tasks:compile No compilation jobs to compile +0ms
hardhat:core:hre Running task compile:solidity:log:nothing-to-compile +0ms
hardhat:core:hre Running task compile:solidity:log:compilation-result +3ms
hardhat:core:hre Running task compile:vyper +0ms
hardhat:core:hre Running task compile:vyper:get-source-paths +0ms
hardhat:core:hre Running task compile:vyper:get-source-names +4ms
hardhat:core:hre Running task compile:vyper:read-file +2ms
hardhat:core:hre Running task compile:vyper:log:compilation-result +8ms
hardhat:core:hre Running task compile:remove-obsolete-artifacts +0ms
hardhat:core:hre Running task test:get-test-files +11ms
hardhat:core:hre Running task test:setup-test-environment +1ms
hardhat:core:hre Running task test:show-fork-recommendations +0ms
hardhat:core:hre Running task test:run-mocha-tests +0ms
hardhat:core:hre Running test:run-mocha-tests's super +793ms
Greeter
At this point no more output appears and the process needs to be terminated.
When I remove require('hardhat-gas-reporter');
from hardhat.config.js
, tests are running fine:
$ npx hardhat --network ganache test --verbose --show-stack-traces
...
hardhat:core:hre Creating HardhatRuntimeEnvironment +0ms
hardhat:core:hre Running task test +91ms
hardhat:plugin:ganache Starting Ganache +0ms
hardhat:plugin:ganache-service Initializing server +0ms
hardhat:plugin:ganache-service Starting server +22ms
hardhat:core:hre Running test's super +635ms
hardhat:core:hre Running task compile +0ms
hardhat:core:hre Running task compile:get-compilation-tasks +0ms
hardhat:core:hre Running compile:get-compilation-tasks's super +1ms
hardhat:core:hre Running task compile:solidity +0ms
hardhat:core:hre Running task compile:solidity:get-source-paths +0ms
hardhat:core:hre Running task compile:solidity:get-source-names +30ms
hardhat:core:hre Running task compile:solidity:get-dependency-graph +9ms
hardhat:core:hre Running task compile:solidity:read-file +2ms
hardhat:core:hre Running task compile:solidity:read-file +1ms
hardhat:core:hre Running task compile:solidity:read-file +0ms
hardhat:core:hre Running task compile:solidity:read-file +14ms
hardhat:core:hre Running task compile:solidity:get-compilation-jobs +11ms
...
hardhat:core:tasks:compile No compilation jobs to compile +1ms
hardhat:core:hre Running task compile:solidity:log:nothing-to-compile +0ms
hardhat:core:hre Running task compile:solidity:log:compilation-result +3ms
hardhat:core:hre Running task compile:vyper +0ms
hardhat:core:hre Running task compile:vyper:get-source-paths +1ms
hardhat:core:hre Running task compile:vyper:get-source-names +4ms
hardhat:core:hre Running task compile:vyper:read-file +4ms
hardhat:core:hre Running task compile:vyper:log:compilation-result +7ms
hardhat:core:hre Running task compile:remove-obsolete-artifacts +1ms
hardhat:core:hre Running task test:get-test-files +13ms
hardhat:core:hre Running task test:setup-test-environment +1ms
hardhat:core:hre Running task test:show-fork-recommendations +0ms
hardhat:core:hre Running task test:run-mocha-tests +0ms
Greeter
hardhat:core:hre Creating provider for network ganache +56ms
✔ Should return the new greeting once it's changed (727ms)
1 passing (936ms)
hardhat:plugin:ganache Stopping Ganache +2s
hardhat:plugin:ganache-service Stopping server +1s
hardhat:core:cli Killing Hardhat after successfully running task test +0ms
There is no special config for networks.ganache
or gasReporter
.
Contents of hardhat.config.js
:
require('hardhat-gas-reporter');
require('@nomiclabs/hardhat-ganache');
require('dotenv').config();
module.exports = {
solidity: '0.8.4',
gasReporter: {
enabled: true,
currency: 'USD',
outputFile: undefined,
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
},
networks: {
hardhat: {
forking: {
url: '<redacted>',
},
},
}
};