-
Notifications
You must be signed in to change notification settings - Fork 795
Pagination / Streaming for Event Logs #954
Comments
Some additional thoughts and notes: Most probably knew this but I didn't. The de facto approach appears to be use the block range as a substitute for a There are edge cases where a single block may contain >1000 (or an RPCs max responses) events. Infura actually bumped their response limit up to 10k for this reason. I am basing this off of this thread from 2019. While dynamically resizing the block range down may be a useful feature, I'm not sure if accomadating this edge case where a single block has greater than 1000 responses (or the limit of the RPC) is worth it as it would require splitting topics or addresses. So a starting solution could have the user pass in a filter and a |
Graph protocol has some neat dynamics around elastic block ranges when they do the indexing https://github.com/graphprotocol/graph-node/blob/38d2a8428c92ae837c1d324e15de1c433267e19c/graph/src/blockchain/polling_block_stream.rs#L352-L375 |
@meetmangukiya WDYT about taking this issue? |
Is your feature request related to a problem? Please describe.
As event logs can yield more results than an RPC will allows (for example, infura failing when the response has over 10k items), looping over a stream of event logs based on a filter or providing a paginated API would be very useful.
Describe the solution you'd like
Gnosis has a potential solution here where
past_logs_pages
/stream
can return a filter based log stream.I think something similar would be the easiest implementation. The draft implementation could start by adding a
get_logs_pages
method on the provider that accepts aFilter
object. However, I am open to feedback / suggestions in terms of how it's designed.Additional context
Understanding the nuances of how eth_getLogs is handled by the RPC provider may be required and may introduce additional complexity. Below is a list of use cases to research to determine how they differ and how to best handle their use cases:
The text was updated successfully, but these errors were encountered: