diff --git a/tests/core/filtering/conftest.py b/tests/core/filtering/conftest.py index d69e7fc95a..c2de79645f 100644 --- a/tests/core/filtering/conftest.py +++ b/tests/core/filtering/conftest.py @@ -5,6 +5,7 @@ from eth_utils import ( encode_hex, event_signature_to_log_topic, + apply_key_map, ) @@ -113,17 +114,10 @@ def return_filter_by_api( return contract.eventFilter(*args) elif api_style == 'v4': event_name = args[0] - argument_filters = args[1].get('filter', {}) - topics = args[1].get('topics') - fromBlock = args[1].get('fromBlock', 'latest') - toBlock = args[1].get('toBlock') - address = args[1].get('address') - return getattr(contract.events, event_name).createFilter( - argument_filters=argument_filters, - topics=topics, - fromBlock=fromBlock, - toBlock=toBlock, - address=address) + kwargs = apply_key_map({'filter': 'argument_filters'}, args[1]) + if 'fromBlock' not in kwargs: + kwargs['fromBlock'] = 'latest' + return getattr(contract.events, event_name).createFilter(**kwargs) else: raise ValueError("api_style must be 'v3 or v4'")