-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Bug]: Periodical errors when using RPC gateways #18467
Comments
@andrew-webatix Can you share the zip files in another form? For instance, could you post a github repo containing those files? |
Sure. All files can be found here: https://github.com/andrew-webatix/metamask-issue-18467 |
thanks! |
This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 45 days if there is no further activity. The MetaMask team intends on reviewing this issue before close, and removing the stale label if it is still a bug. We welcome new comments on this issue. We do not intend on closing issues if they report bugs that are still reproducible. Thank you for your contributions. |
This issue was closed because there has been no follow up activity in the last 45 days. If you feel this was closed in error, please reopen and provide evidence on the latest release of the extension. Thank you for your contributions. |
Describe the bug
In our application we are using https://polygon-rpc.com - RPC gateway that relies on globally distributed nodes. Sometimes that gateway switches from one node to another where the last block number is less than in previous node. If in this case we are trying to perform a call to some smart contract method (e.g. 'balanceOf' of the ERC20 token):
MetaMask itself do not treat '0x' as an error and successfully caches this value as a valid result of a call. We are using Ethers library in our application, which actually treat '0x' result as a BAD_DATA error. And this BAD_DATA can stay there for up to 20 seconds as MetaMask returns cached '0x' result all that time. Obviously our application stuck in such cases.
We suppose that more correct behavior of MetaMask in such situations is to treat '0x' response as an empty value error and perform several retries internally before throwing an actual error. In this case RPC gateway can get a chance to re-route following requests to more suitable node with correct height.
It looks like similar issues were faced already few years ago.. it was claimed to fix as a part of go-ethereum (that was related to Metamask), but have been returned after some major changes:
Couldn't decode _____ from ABI: 0x
Need to throw error when methods are called at future blocks
Potentially this issue can be fixed with patches attached here: patches.zip
Steps to reproduce
Here is the test page which can reproduce the problem: test.zip It performs series of calls (3000 iterations, one per a second) to 'balanceOf' method of arbitrary ERC20 smart contract and address. In most cases it returns valid balance value. But from time to time an error messages can be noticed in DevTools / Console and this error stays there for about 20 seconds (cache lifetime?). Such an errors breaks our application. Test page can be started with use of a simple static HTTP server.
Error messages or log output
No response
Version
10.27.0
Build type
None
Browser
Chrome
Operating system
Linux
Hardware wallet
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: