Closed piyushnh closed 2 years ago
Hey @piyushnh,
Can you post the steps to reproduce these things?
Thanks
Hey @piyushnh,
Can you post the steps to reproduce these things?
Thanks
networks: {
hardhat: {
forking: {
url: "https://eth-mainnet.alchemyapi.io/v2/<key>";
}
}
}
Added this to hardhat config file and ran npx hardhat node
. Get the error and sometimes don't, with nothing else changed.
Hey @piyushnh, Can you post the steps to reproduce these things? Thanks
networks: { hardhat: { forking: { url: "https://eth-mainnet.alchemyapi.io/v2/<key>"; } } }
Added this to hardhat config file and ran
npx hardhat node
. Get the error and sometimes don't, with nothing else changed.
Also, when the hardhat network has frozen, I get this error whenever I try to run tasks against it:
Error HH109: Network connection timed-out.
Please check your internet connection and networks config
We need more info to be able to reproduce this. What exactly where you executing? version of hardhat? operating system?
We need more info to be able to reproduce this. What exactly where you executing? version of hardhat? operating system?
I was forking the mainnet using Alchemy. I get this error when I run npx hardhat node
Hardhat version: 2.0.4 OS: Ubuntu 16.04 Node version: 14.15.5
I spun up a ganache-cli mainnet fork using the same Alchemy provider to see if it's an issue just with my system. Turns out, ganache-cli works completely fine. Seems to be an issue just with the hardhat network.
Yes, this is probably an issue with hardhat, but we can't reproduce it if you don't tell us which transactions/rpc-calls you were making.
Also, if you have an stack trace, please post it here.
I'm encountering the same issue when running tests via Mainnet forking (Chain Id 1). They seem to be appear randomly which leads to not being able to run it in CI atm. Did not encounter those errors when forking Kovan.
Hardhat: 2.5.0 OS: Mac OS 11.5.1
This is the entire stack trace I got:
HardhatError: HH109: Network connection timed out.
Please check your internet connection and networks config
at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:184:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Same as the above.
Ubuntu 18.04.5 LTS Hardhat version 2.6.4 Node v16.9.0
Just added this to config
forking: {
url: gateway.alchemyMainnet,
blockNumber: 11095000
}
...then run npx hardhat node
and got this
Error HH109: Network connection timed out.
Please check your internet connection and networks config
Funny, while writing this tried with --show-stack-traces and it worked)) Will try to catch those traces later if I can.
UPD. Same with a test that uses forked contract. Sometimes it works, sometimes network connection is timed out.
UPD2. Here are stack-traces from running tests.
$ npx hardhat test --show-stack-traces
Old meh
1) Should should return block info
0 passing (40s)
1 failing
1) Old meh
Should should return block info:
HardhatError: HH109: Network connection timed out.
Please check your internet connection and networks config
at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:184:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29)
at getLatestBlockNumber (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:116:30)
at Object.makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:44:23)
at Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:153:9)
at HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:234:28)
at HardhatNetworkProvider._send (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:182:5)
at HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:108:18)
at EthersProviderWrapper.send (node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
Error HH109: Network connection timed out.
Please check your internet connection and networks config
HardhatError: HH109: Network connection timed out.
Please check your internet connection and networks config
at HttpProvider._fetchJsonRpcResponse (/my/project/dir/node_modules/hardhat/src/internal/core/providers/http.ts:184:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at HttpProvider.request (/my/project/dir/node_modules/hardhat/src/internal/core/providers/http.ts:55:29)
at getLatestBlockNumber (/my/project/dir/node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:116:30)
at Object.makeForkClient (/my/project/dir/node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:44:23)
at Function.create (/my/project/dir/node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:153:9)
at HardhatNetworkProvider._init (/my/project/dir/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:234:28)
at HardhatNetworkProvider._send (/my/project/dir/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:182:5)
at HardhatNetworkProvider.request (/my/project/dir/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:108:18)
at SimpleTaskDefinition.action (/my/project/dir/node_modules/hardhat/src/builtin-tasks/test.ts:107:37)
Caused by: FetchError: network timeout at: https://eth-mainnet.alchemyapi.io/v2/deleted-my-key-from-logs
at Timeout.<anonymous> (/my/project/dir/node_modules/node-fetch/lib/index.js:1476:13)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
Hey, I am running into the same error here with a hardhat fork of arbitrum.
I seem to have been able to get past the error by removing my usage of:
provider().send("evm_increaseTime", [time]);
I have always been using a fork to test my repo. I added in a test where I needed to increase the time, then I started to get the same error as everyone else. I started to debug around it. My fork node output always looked like so when failing:
eth_chainId
eth_call
Contract call: <UnrecognizedContract>
From: 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1
To: 0x30df229cefa463e991e29d42db0bae2e122b2ac7
eth_chainId
eth_getBlockByNumber
evm_increaseTime
evm_mine
Mined empty block #2297136 with base fee 431756256
eth_chainId
[?25l[Feth_chainId (2)[K
[?25heth_getBlockByNumber
eth_chainId
eth_getTransactionReceipt
eth_chainId
eth_estimateGas
It fails at estimate_gas
when starting up the next transaction after an evm_increaseTime
is used.
Wondering if anyone else can confirm they were also using evm_increaseTime
? If so, it seems pretty likely this is related to the error.
same issue here... sometimes it works and in most cases fails
same issue here... sometimes it works and in most cases fails
I was able to get past this by using the timeout key value. I believe since I was running this in docker compose with other services that the default of 20s was not sufficient. You can see the documentation for this variable here: https://hardhat.org/config/.
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [
{
version: "0.8.11",
settings: {
optimizer: {
enabled: true,
runs: 2000
}
}
},
]
},
networks: {
hardhat: {
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/${config.alchemyKey}`
},
allowUnlimitedContractSize: true,
timeout: 120000
},
tests: {
url: `${'http://eth:8545'}`,
accounts: {
mnemonic: `cruel rebel frown short month love belt weather sense hood cage pact`
},
timeout: 120000
}
},
mocha: {
timeout: 120000,
retries: 2,
bail: true,
}
};
Stumbled into this error and was stuck until I cleaned all artifacts and cache.
Hi everyone. This seems to either not be happening anymore, or it's very infrequent and reproducing it is hard, or it's related to an issue related to timeouts that it's already reported in a different issue (#3136).
In any case, I'm going to close it for bookkeeping reasons, but feel free to comment or open a new one if you run into this and have reproduction steps (even if part of the reproduction is "run this 10 times and it might happen once").
me the same, found it happens when doing forking using infura
Locking this issue.
If you are running into this and have clear, minimal reproduction steps, please open a new issue.
I keep getting this error when trying to fork mainnet using Alchemy. Do not get the error after running
npx hardhat node
a couple of times. Along with this, the local network just freezes sometimes and gets disconnected from metamask. Have to re-runnpx hardhat node
to get it working again.