You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The contract.events.myEvent.createFilter and contract.eventFilter both allow entering topics directly along with "argument filters" via filter param dict. The implementation is built on a false assumption about the topic list. The constructed topics are merged with the raw topics in a simple list addition:
if topics is None:
topic_set = construct_event_topic_set(event_abi, argument_filters)
else:
topic_set = [topics] + construct_event_topic_set(event_abi, argument_filters)
Merging two topic lists with additive results is impossible with a single filter. Merging two topic lists by using the available OR logic within single topic positions would yield all topic combinations.
Example:
Given the following "logs": AA BB AB
Topic list 1 ["A", "A"] would match AA
Topic list 2 ["B", "B"] would match BB
merged list [["A", "B"], ["A","B"]] would match AA BB AB
How can it be fixed?
Option 1. Remove option of entering raw topics along with argument filters that generate topics.
Option 2. Provide the functionality of merging topic lists, by extending the Filter object to manage multiple node filters.
I think Option 1 is better. Clearly it's subtle enough that reasonable people can get confused by what merging is supposed to do. So let's just remove the opportunity for mistake. People can still manually merge topics themselves first, if they like.
What was wrong?
The
contract.events.myEvent.createFilter
andcontract.eventFilter
both allow entering topics directly along with "argument filters" viafilter
param dict. The implementation is built on a false assumption about the topic list. The constructed topics are merged with the raw topics in a simple list addition:Merging two topic lists with additive results is impossible with a single filter. Merging two topic lists by using the available OR logic within single topic positions would yield all topic combinations.
Example:
Given the following "logs": AA BB AB
Topic list 1 ["A", "A"] would match AA
Topic list 2 ["B", "B"] would match BB
merged list [["A", "B"], ["A","B"]] would match AA BB AB
How can it be fixed?
Option 1. Remove option of entering raw topics along with argument filters that generate topics.
Option 2. Provide the functionality of merging topic lists, by extending the Filter object to manage multiple node filters.
something like:
The text was updated successfully, but these errors were encountered: