-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
What conditions would cause getLogs
requests to be "too broad" and "may get dropped"?
#1798
Comments
Heya! The "too broad" means that:
It's great when backend gives an rpc error, at least you know it. But sometimes (#1389), the backend just "discards" some entries and returns only the latest 100 entries or so. Does that help? |
Hi @zemse thank you for the answer! All of that makes sense. I would like to provide more information and specifics because I think what we are dealing with, however, is not a request that is too large but may be a more underlying issue. We run a watcher that uses ethers.js and Infura to look for an event on a specific contract on mainnet. We do it with the following ethers.js code using a JSON RPC endpoint from Infura:
We have noticed that this code sometimes misses events in real time. We verified this by running two instances of this code -- one where We are in contact with Infura and they mentioned the following:
I'm not sure where the root issue may be, but I'd like to start a discussion to figure it out. I believe the fact that, according to this quote, ethers.js and Infura not "being compatible" seems like a pretty big issue. I am curious if you are aware of such a race condition mentioned in this quote. I am in contact with Infura and would be happy to provide as much information as you may need! |
I am going to close this in favor of #1814 . Thank you! |
That documentation was included purely on anecdotal evidence. I have witnessed, especially early on in the Ethereum days, that some backends would drop (prune) old state and not return some events. Things are much better now, but still depend very much on your backend. INFURA has been very reliable in that area, but often running your own gets may result in timeouts if the range is too long. I also believe Alchemy now has better support for this, but at one point they would only honour getLogs with a range less than 1000 blocks. But for recent block ranges, where there are a reasonable number of events (less than 10,000), I have not witnessed this. |
Thanks @ricmoo . I spoke with Infura earlier this week and they said they have identified an issue with the way that Infura interacts with ethers.js. They said they will have a PR in this repo by the end of this week. Because it seems like they are handling it, I will now close this and #1814. Thank you for being so responsive! |
Thanks! Can you link me to that PR if you have it? I'm curious what the issue is and what their fix is. I thought ethers should handle consistency automatically. :) |
I do not believe they have submitted it yet. Here is their communication with me from an email:
This was in response to their previous comment:
Happy to provide additional information. I'm communicating with them through a support ticket, so I don't have a super direct line of communication open with them at this time. |
No worries. I can bug them too. :) |
The ethers
provider.getLogs()
documentation mentions the following:I have two questions about that statement:
n
logs are returned from a single request, wouldn-1
logs be returned in the case of a log "drop"?I recognize these may be questions for Infura (or another provider), so feel free to close this and I will ask there. Thank you!
The text was updated successfully, but these errors were encountered: