Metamask-extension: New chainId validations break evm chains that do not implement chain_id method

Created on 22 Oct 2020  路  7Comments  路  Source: MetaMask/metamask-extension

TomoChain in particular does not support the chain_id method, and so version 8.1 breaks support for it, since we validate the user-entered value against the RPC.

This means TomoChain is currently broken on Firefox, and those users should use Chrome.

Proposed solution: If a user enters a custom RPC for a network that does not implement chain_id, we should trust the chain_id value entered by the user (ideally indicating to the user if it duplicates any known networks).

S1-high T00-bug x02-customNetworks

All 7 comments

Not only that but FireFox is breaking as well on chains behind nginx. It works if I use http-proxy to serve the proxy pass.

Screen Shot 2020-10-26 at 7 55 18 PM

You can check the node with curl.

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' https://node.expanse.tech

It works fine with chrome though.

Local chains running on Ganache CLI are also breaking after upgrading Metamask to 8.1.3.
When adding custom networks to Metamask we started receiving the error The endpoint returned a different chain ID: 0x539.
In case it's helpful for anyone, the issue was caused by Ganache chain_id defaulting to 1337. Upgrading Ganache CLI to v6.11.0 and passing the option --chainId with the correct value fixed the problem.

Same problem when trying to connect to a https://www.kaleido.io/ node. They use basic auth.
Could not fetch chain ID. Is your RPC URL correct?
Worked with 8.0.10.

MetaMask Version: 8.1.3

I'm also seeing this break a dapp running with geth on a custom chainID even when the entered chain id matches the --networkid parameter to geth which also matches the config.chainId property in the genesis block. The error is "Could not fetch chain ID. Is your RPC URL correct?" Yes, it's the same RPC URL that worked with prior versions.

Forcing out breaking changes on all users without making it easy to revert to a version preceding the breaking changes is not cool.

@afmfe-iul I am getting the same error when trying to create a Custom RPC in Metamask. I am unable to get the right chainId

So, for an update, i figured out that cors wasnt set properly. I had cors on nginx AND the geth/gexp nodes. Once cors was set properly everything began working. Which is interesting that firefox was strict with cors but chrome was relaxed haha.

In the dapp I observed, it was because the node being connected to was running too old a version of geth (due to other blockers), before eth_chainId. Still, with issues like this and #9421, I maintain that forcing out breaking changes on all users without making it easy to revert to a version preceding the breaking changes is not cool.

Was this page helpful?
1 / 5 - 3 ratings

Related issues

aecc picture aecc  路  3Comments

rossbulat picture rossbulat  路  3Comments

BMillman19 picture BMillman19  路  3Comments

MarkOSullivan94 picture MarkOSullivan94  路  3Comments

1blockologist picture 1blockologist  路  3Comments