Skip to content
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

[Feature] Filter::filter(Log) -> Option<Log> #1943

Open
kayabaNerve opened this issue Jan 23, 2025 · 2 comments
Open

[Feature] Filter::filter(Log) -> Option<Log> #1943

kayabaNerve opened this issue Jan 23, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@kayabaNerve
Copy link
Contributor

Component

rpc

Describe the feature you would like

Filters can specify a block range to fetch all logs within that range. Sometimes, the desired range is a single transaction. This leaves the user:

A) To fetch all logs within the block, then filter by transaction ID
B) To fetch all logs within the transaction, then filter by topics and so on

The former is trivial, yet requires requesting the data of a larger object. The latter would be trivial if filters could be applied to in-memory logs, but unfortunately, they cannot be at this time.

The proposed fn would check if a given Log matches the Filter in order to make the latter flow trivial.

Additional context

No response

@kayabaNerve kayabaNerve added the enhancement New feature or request label Jan 23, 2025
@mattsse
Copy link
Member

mattsse commented Jan 23, 2025

tbh unclear what this means, could you perhaps prototype this?

@kayabaNerve
Copy link
Contributor Author

If I have a Log in memory, I just want to check if it'd pass a Filter in memory. That'd mean for all topics the filter filters to, checking if the log has those topics (along with any other filter options set). If the log has topics not filtered to, None is returned.

I don't want to have make an RPC request to the node with my Filter for the node to fetch all logs which match it, return those to me, and then check if the log I already have is present within the list (an extremely naive way to see if the held log matches the held filter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants