2

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?

bguiz
  • 27,371
  • 47
  • 154
  • 243
  • try the https://ethereum.stackexchange.com – Kof Jun 11 '22 at 14:21
  • @Kof RSK is EVM *compatible* ... but not ethereum. For example if working with ethereum you don't even run into this issue - the hardhat docs simply work out of the box... you reckon the folks at the other Stackexchange site will be able to help (despite this)? – bguiz Jun 12 '22 at 01:10
  • Ethereum is a protocol, it's implemented in C++, C#, Go, Haskell, Java, JavaScript, Python, Ruby, Rust, Elixir, Erlang - they're all under the ethereum.stackexchange.com umbrella – Kof Jun 12 '22 at 10:15
  • @bguiz Have you resolved this problem? I have found this one solution, but can't apply it - https://github.com/NomicFoundation/hardhat/issues/2106 – Dmytro Zarezenko Aug 24 '23 at 13:27
  • @DmytroZarezenko unfortunately not - I believe that it is solvable with a newer release of RSKj (but I'm no longer working on this). I'll pass it on, and see if someone can help you! – bguiz Aug 24 '23 at 23:47

0 Answers0