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

Contract log filters #1372

Open
khaidarkairbek opened this issue Dec 23, 2024 · 3 comments · May be fixed by #1367
Open

Contract log filters #1372

khaidarkairbek opened this issue Dec 23, 2024 · 3 comments · May be fixed by #1367

Comments

@khaidarkairbek
Copy link
Collaborator

Version

0.8.8

Current behavior

Currently, filter field for contracts is restrictive, allowing only either filtering multiple events with no arguments or only one event with or without arguments. This restricts the following functionality: filtering multiple different events with arguments or filtering one event with multiple combination of arguments.

Expected behavior

I am suggesting to build on existing filter field adding a functionality to specify the array of filters, with identical api. So it would look something as follows:

{
  filter?: {
    event: string; 
    args?: <arg types>
  } | {
    event: string[]; 
  } | ({
    event: string; 
    args?: <arg types>
  } | {
    event: string[];
  })[]
}

Steps to reproduce

No response

Link to repository

No response

Anything else?

No response

@kyscott18
Copy link
Collaborator

While we are at it I think we should remove the event: string[] option. It doesn't actually do anything because Ponder looks at which indexing functions are registered and filters down based on that.

@khaidarkairbek
Copy link
Collaborator Author

khaidarkairbek commented Dec 27, 2024

While we are at it I think we should remove the event: string[] option. It doesn't actually do anything because Ponder looks at which indexing functions are registered and filters down based on that.

That sounds good. Currently, we are validating that no indexing function is defined for the events excluded by the filter. If we are looking into filtering certain event by the arguments, it would be a bit inconvenient from devx to include other events with no particular argument filtering in the config. Do you mean we are to include the logSources for the event if there is an indexing function defined for it? Then, we would need to remove that validation. I personally think it would be much cleaner, but let me know what you think.

@kyscott18
Copy link
Collaborator

I think that we should use registered indexing functions as topic0 filtering, and anything defined in the filters option as topic1/2/3.

Also, if there is a filter defined for an event that doesn't have a registered indexing function, that should probably be an error

@kyscott18 kyscott18 linked a pull request Jan 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants