TrueFiEng / useDApp

Framework for rapid Dapp development. Simple. Robust. Extendable. Testable
https://usedapp.io
MIT License
1.59k stars 368 forks source link

multicall error response data is empty, useCall error is undefined #742

Open Yuripetusko opened 2 years ago

Yuripetusko commented 2 years ago

I am calling useCall on moonbaseAlpha chain, it is using their multicall contract defined in useDapp code. When the function returns error, I get error thrown in browser console from rpc, I also get error code in rpc response payload, but useCall doesn't return any error

rpc response:

{"jsonrpc":"2.0","error":{"code":-32603,"message":"VM Exception while processing transaction: revert","data":""},"id":100}

Browser error:

Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32603,\"message\":\"VM Exception while processing transaction: revert\",\"data\":\"\"},\"id\":85}\n","error":{"code":-32603,"data":""},"requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0x4e2cfca20580747adba58cd677a998f8b261fc21\",\"data\":\"0x252dba42000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000093dceea2e035090f4b18b0723cfa456423814bfb00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024ffc9896b000000000000000000000000fbea1b97406c6945d07f50f588e54144ea8b684f0000000000000000000000000000000000000000000000000000000000000000000000000000000093dceea2e035090f4b18b0723cfa456423814bfb00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024f2b0a55d000000000000000000000000000000000000000000000000000000000000592900000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffd2aad7f60626608fa4a5d34768f7892d0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002470a08231000000000000000000000000fbea1b97406c6945d07f50f588e54144ea8b684f0000000000000000000000000000000000000000000000000000000000000000000000000000000093dceea2e035090f4b18b0723cfa456423814bfb00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024c0ea1f11000000000000000000000000000000000000000000000000000000000000592900000000000000000000000000000000000000000000000000000000\"},\"0x202577\"],\"id\":85,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://rpc.api.moonbase.moonbeam.network/"}, data="0x", code=CALL_EXCEPTION, version=providers/5.6.4)
    at Logger.makeError (index.js?dd68:219:1)
    at Logger.throwError (index.js?dd68:228:1)
    at checkError (json-rpc-provider.js?8679:59:1)
    at JsonRpcProvider.eval (json-rpc-provider.js?8679:518:1)
    at Generator.throw (<anonymous>)
    at rejected (json-rpc-provider.js?8679:6:42)

and yet error is undefined returned from useCall

mj426382 commented 2 years ago

It seems that you made a call with incorrect arguments or to wrong contract address or wrong chain.

maoueh commented 2 years ago

@mj426382 Seeing the same behavior, the real problem is not why the call failed, it's that useCall does not report the error properly and as such, there is no way to inform the user that something went wrong.

maoueh commented 2 years ago

Ok after different tries, this problem is not consistent and seems to happen mostly after some navigation within the site and not directly after a hard page refresh.

charlesAuthentik commented 2 years ago

Had the same issue here. The calls we made to the multicall contract are the same every time. However, we will see the error mentioned by Yuripetusko periodically.

yivlad commented 2 years ago

Does the issue still persist in the latest version of useDApp (v1.0.15)?

heycryptobob commented 1 year ago

I am still having this issue running on Hardhat. Current config:

const config: Config = {
  networks: [Hardhat],
  readOnlyChainId: Hardhat.chainId,
  readOnlyUrls: {
    [Hardhat.chainId]: "http://127.0.0.1:8545",
  }
}

any ideas?

rzadp commented 1 year ago

We're working on detecting the actual error better. (Note that it will properly work only with Multicall v2).

cc @jakvbs

this problem is not consistent

we will see the error mentioned by Yuripetusko periodically

This makes the problem difficult, so as much info as possible is appreciated.

@heycryptobob Is the problem also happening periodically and not consistently? Do you see any pattern?

TIM88-DOT commented 1 year ago

I'm facing the same error on BSC testnet and Mumbai, the weird part is if I make the calls using ethers only it works fine...