Add support for flexible topics length matching using wildcard in getEvents#419
Conversation
ad414bf to
5ed38c0
Compare
This seems like an unnecessary restriction given that you can get |
Does this mean that Or does |
No, it will match any event that >= 3 topics.
No, it does not.
By this I meant that, the existing limit of max of 4 filter segments per filter is unchanged. The "**" wildcard is exempt from this count. so Also, per the docs the max limit for filter segments is 5 while the code currently enforces a limit of 4. So either the docs are wrong or it's been implemented incorrectly. |
yes, we can do that for the sake of consistency but using [**] is effectively the same as no filter at all. |
Shaptic
left a comment
There was a problem hiding this comment.
Something is wonky with the commit history here but otherwise this LGTM! I'm surprised there were no query changes necessary but I guess the fact that it's an OR clause for topic filters helps!
5dd5b07 to
f0f3262
Compare
Yikes! Fixed it. |
What
A new wildcard
"**"is introduced in thegetEventsRPC endpoint for flexible topic length matching of zero or more topics.This eliminates the need for manual padding in filters. For eg, previously, to match events where the first topic is
"X"followed by any number of subsequent topics, you'd need to specify multiple filters like["X"], ["X", "*"], ["X", "*", "*"]and so on. The new "**" wildcard simplifies this to a single filter like["X", "**"].Rules for the new wildcard
"**"wildcard can only appear as the last segment in a filterInvalid:
["X", "**", "*"]❌Valid:
["X", "*", "**"]✅ - matches events with at least two topics, where the first topic is "X".The existing limit of max of 4 filter segments per filter is unchanged. The "" wildcard is exempt from this count.
Invalid ["A","B","C","D","*"] ❌
Valid: ["A","B","C","D",""] ✅
Why
Fixes #358
Known limitations