Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem calling eth_chainId on mainnet #5664

Closed
danjm opened this issue Nov 3, 2018 · 2 comments
Closed

Problem calling eth_chainId on mainnet #5664

danjm opened this issue Nov 3, 2018 · 2 comments

Comments

@danjm
Copy link
Contributor

danjm commented Nov 3, 2018

On 4.17.0, there is a bug that causes MetaMask to take an extremely long time to connect to mainnet.

One public report of the bug can be found here: https://twitter.com/poopie_cat/status/1058786439993806848?s=21

The bug was introduced by #5552, which was reverted #5662. This revert was a hotfix, published with 4.17.1

The cause of the bug is not the code change in #5552 directly, but rather an interaction between that code change and infura.

For some reason, the GET https://api.infura.io/v1/jsonrpc/mainnet/eth_chainId?params=%5B%5D request initiated by the ethQuery.sendAsync({ method: 'eth_chainId' }, (err, chainIdHex) => { call found at https://github.com/MetaMask/metamask-extension/pull/5552/files#diff-684dc3d1f34ef1201f93c566be5530abR111, takes very long time to resolve on mainnet, but not on other networks.

On other networks I am seeing it resolve in ~100ms, with a 400 error. On mainnet it takes 2 minutes or more. And eventually resolves with a 503 error:

screenshot from 2018-11-03 19-21-18

If we log the error passed to the callback from the above referenced line of code, we see this error:

Error: InfuraProvider - cannot complete request. All retries exhausted.
Original Error:
Error: Gateway timeout. The request took too long to process. This can happen when querying logs over too wide a block range.
    at createAsyncMiddleware (index.js:40)

It is unclear whether this bug can be resolved within MetaMask's provider or JSON rpc related dependencies, or if it needs to be addressed by Infura.

Please comment if you have further insights or questions.

@kumavis
Copy link
Member

kumavis commented Nov 4, 2018

We can hardcode the response to eth_chainId for each network

@tejaslende
Copy link

Please check out this web3auth https://web3auth.io/docs/connect-blockchain/bnb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants