-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
eth_getFilterChanges
returns "filter not found"
#11589
Comments
For anyone else having this issue, https://github.com/filecoin-station/on-contract-event/tree/main is a temporary workaround |
Thanks to @dumikau for finding this code path in
|
Lines 89 to 96 in 1b2dde1
Every HTTP request gets its own new Lines 647 to 648 in 1b2dde1
The problem is that filters are long-lived inside a Lotus node and it's perfectly valid to do this via non-websocket requests. It seems to me that the desire here is to partition the filter and subscription space per-user, but that's not really possible to achieve with the way this all works. However, filter IDs are generated via UUIDv4, so we have some guarantees about uniqueness and guess-ability already. I'm not sure what other leakage we would try and protect against in a public gateway. So, we could either share a @magik6k am I missing something from 22231dc and 1286d76? Is there a reason I'm missing that we can't just pass these through without checking? |
FWIW, it's easy to configure Ethers v6 const provider = new ethers.JsonRpcProvider(fetchRequest, undefined, {
polling: true
}) |
IMO the action item here is to remove the stateful call tracker from this call path and just pass it through to the node; I don't see a good reason it's gated. |
Looking at this again; the tracking was originally introduced in #9863, and then extended in #10027 to cover subscribe.
My original comment from above is wrong. The purpose of these checks is to limit the number of filters installed on a lotus node for each "user", which is an appropriate thing for a gateway to do because of the cost of having active filters. This works find when using websockets, but we currently don't have any per-IP tracking, and even if we did we'd have to deal with people using reverse proxies in front of lotus-gateway (like glif does). We're then in the realm of deciding whether to accept It seems like glif doesn't expose websockets, but api.chain.love does, so this ~works (at leas it doesn't error, I don't know an address to use to get something more active): import { ethers } from 'ethers'
const provider = new ethers.WebSocketProvider('wss://api.chain.love/rpc/v1')
console.log('provider:', provider)
const filterId = await provider.send('eth_newFilter', [{
address: ['0x811765acce724cd5582984cb35f5de02d587ca12'],
topics: []
}])
console.log('filterId:', filterId)
provider.on('block', async() => {
const logs = await provider.send('eth_getFilterChanges', [filterId])
console.log('logs:', logs)
}) I think that we might be forced to just block these stateful API endpoints from HTTP like suggested in #11153 unless we want to go down the rabbit hole of per-IP tracking. We could also be encouraging public API providers to offer websockets option. I'd really like to know how this is handled in Ethereum-land. How do public providers offer this normally? |
I was thinking that something like the Arbitrum option gets us around the limit problems with this. We get rid of the per-connection limit entirely but setup a liveness check in the gateway that will automatically remove the filter from the lotus node if it's not polled after a certain period of time. I wouldn't mind offering more options for public API providers, but this is something we could evolve over time. And already now they have the option of excluding these APIs from what they offer with a reverse proxy and they could even do API key gating too. |
Alas we already have that with |
After some discussion on Slack I think that the way forward here is to:
|
This should be resolved in #12327 |
Closing as completed as this should be resolved in #12327, which has been shipped in Lotus v1.29.0 which most RPC-providers has updated to now. Please reopen if you still encounter this issue @juliangruber |
Checklist
Latest release
, the most recent RC(release canadiate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.Lotus component
Lotus Version
Repro Steps
Describe the Bug
After upgrading to
ethers@6
, it's now failing to subscribe to events. See repro steps above. It responds with"filter not found"
although theid
returned frometh_newFilter
was used.Logging Information
This was on glif. Same results on chain.love.
I tried reproducing locally, but failed on this:
I did already set
EnableEthRPC = true
The text was updated successfully, but these errors were encountered: