Here's the hardhat.config.js
, as per the reference: hardhat mainnet forking
module.exports = {
solidity: '0.8.9',
networks: {
hardhat: {
// Ref: https://hardhat.org/hardhat-network/guides/mainnet-forking.html
forking: {
url: 'https://public-node.rsk.co/',
blockNumber: 4e6,
},
},
},
};
When running npx hardhat test
, the following error/ stacktrace is output:
Main
1) "before all" hook in "Main"
0 passing (4s)
1 failing
1) Main
"before all" hook in "Main":
InvalidResponseError: Invalid JSON-RPC response's result.
Errors: Invalid value null supplied to : RpcBlockWithTransactions | null/transactions: RpcTransaction Array/1: RpcTransaction/v: QUANTITY, Invalid value null supplied to : RpcBlockWithTransactions | null/transactions: RpcTransaction Array/1: RpcTransaction/r: QUANTITY, Invalid value null supplied to : RpcBlockWithTransactions | null/transactions: RpcTransaction Array/1: RpcTransaction/s: QUANTITY
at decodeJsonRpcResponse (node_modules/hardhat/src/internal/core/jsonrpc/types/output/decodeJsonRpcResponse.ts:15:11)
at JsonRpcClient._perform (node_modules/hardhat/src/internal/hardhat-network/jsonrpc/client.ts:277:48)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at ForkBlockchain._getBlockByNumber (node_modules/hardhat/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts:236:22)
at ForkBlockchain.getBlock (node_modules/hardhat/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts:66:13)
at ForkBlockchain.getLatestBlock (node_modules/hardhat/src/internal/hardhat-network/provider/BlockchainBase.ts:61:19)
at Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:196:31)
at HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:251:28)
at HardhatNetworkProvider._send (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:192:5)
at HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:118:18)
What can I do to resolve this?