ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Non-whitelisted methods: Treat them as unsupported.

Open andrewpeters9 opened this issue 1 year ago • 2 comments

Ethers Version

6.13.1

Describe the Problem

  • Some networks do not support eth_newFilter, this issue was addressed here:
    • #4162
  • However, some networks support the method, but an individual RPC (particularly public) can choose to not whitelist it
  • When sending eth_newFilter to some public Abitrum RPCs, such as https://sepolia.optimism.io/ instead of returning:
    • the {{method}} method does not exist
    • they instead return rpc method is not whitelisted

The quick fix for this would be allowing this line to also match for rpc method is not whitelisted

https://github.com/ethers-io/ethers.js/commit/1dc8986a33be9dce536b24189326cbfaabf1342e#diff-864f267214cf0d0dd7bdcf86d9da9cb2fd4f4df51f75d17351f26594adc7d6b0R964

Errors

could not coalesce error (error={ "code": -32001, "message": "rpc method is not whitelisted" }, payload={ "id": 5, "jsonrpc": "2.0", "method": "eth_newFilter", "params": [ { "address": [ "{{OMMITTED}}" ], "topics": [ "{{OMMITTED}}", null, "{{OMMITTED}}" ] } ] }, code=UNKNOWN_ERROR, version=6.13.2)

Environment

node.js (v12 or newer)

Environment (Other)

No response

andrewpeters9 avatar Aug 01 '24 08:08 andrewpeters9

@ricmoo let me know if you'd like an MR

andrewpeters9 avatar Aug 02 '24 07:08 andrewpeters9

Yes, this makes sense. A lot of error handling has to be string-matching based, since there isn't a cohesive error standard all nodes follow.

I can certainly add the additional string to match.

ricmoo avatar Aug 31 '24 00:08 ricmoo