-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Disallow configuring filters with both manual and generated topic lists #976
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c7807f7
Check in failing test for merging topic lists
dylanjw f69f30e
Create normalize_topic_list function
dylanjw bec2e4e
Disallow merging topic lists
dylanjw 0f204ff
Check in topic filtering with options test
dylanjw 4f55e98
Bump eth-tester version to include topic list bugfixes
dylanjw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
tests/core/filtering/test_contract_createFilter_topic_merging.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
|
||
|
||
def test_merged_topic_list_event( | ||
web3, | ||
emitter, | ||
emitter_event_ids, | ||
wait_for_transaction): | ||
manual_topics = [ | ||
'0xf16c999b533366ca5138d78e85da51611089cd05749f098d6c225d4cd42ee6ec', # event sig | ||
'0x0000000000000000000000000000000000000000000000000000000000000457', # 1111 | ||
'0x0000000000000000000000000000000000000000000000000000000000000457', # 1111 | ||
'0x0000000000000000000000000000000000000000000000000000000000000457', # 1111 | ||
] | ||
with pytest.raises(TypeError): | ||
emitter.events.LogTripleWithIndex().createFilter( | ||
fromBlock="latest", | ||
topics=manual_topics, | ||
argument_filters={'arg0': 2222, 'arg1': 2222, 'arg2': 2222}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API change doesn't have any downstream effects in the public API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There shouldn't be a bad effect. Because the topic list permutations were removed,
construct_event_topics
only needs to return a nested list when there are multiple options for a single argument filter.There was a bug in how the topic list was being generated. This is an example of a correctly formated topic list to match logs with either of two values for the first indexed event arg:
whereas this is what we were generating to be equivalent to the above; we would pass full topic list permutation against each option:
This topic topic list actual means: any of
[event_sig_topic, option1_for_arg1, arg2_topic ]
in the first position and any of[event_sig_topic, option1_for_arg1, arg2_topic]
in the second position. Node filters don't understand nested lists as full topic lists. The spec defines a single topic list that can have nested lists of options for each positional element.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can break this part out into another PR, and add a failing test.
This issue has been fixed in the new api: #953. Im fixing this function to make it easier to integrate the new filter builder api.