-
Notifications
You must be signed in to change notification settings - Fork 309
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
feat: track filters in state for eth_getFilterChanges #448
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start, but we want to be verifying all data returned by the filter is valid. The current standard we hold ourselves to is that an RPC should be able to withhold parts of the data, but should not be able to insert additional incorrect data (we'd like to check for exhaustiveness at some point too but there are some unfortunate blockers there for a few of the rpc methods like log fetching).
It looks like we aren't checking validity for the non-log filter return types. We should be able to do this by checking if any returned block, blockhash, transaction, or transaction hash has actually been seen by Helios. All of the data to perform these checks should be accessible from the State
type.
So the For now, have added comments in the code with these notes. |
Oh this is a good point. How that I think about it we should probably be managing more of the filter logic ourselves rather than farming it out to the RPC. We should keep track of what filters we have, and only use the RPC to manage log and pending transaction filters. For new block filters we don't really need to use the rpc at all. We can just keep track of those filters in Helios and implement the logic directly for returning all the heads that helios has seen. |
That makes sense. We can maintain a list of filter IDs for |
If Helios sees an unknown filter ID I think we would want to return an error? All filters that a client asks for should have been previously created through Helios before. The same would be true when using an RPC. If we maintain a list of all filters and their types internally in Helios we should be able to understand whether an inbound request for a filter had been correctly registered prior, and whether it needs to be forwarded off to the rpc or handled entirely internally in the newHeads case. |
@ncitron; Implemented tracking filter and changes (for eth_newBlockFilter) in state. PTAL. LMK if you think I missed anything. |
Closes #447.