Skip to content

Commit

Permalink
Update topic list validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjw committed Jul 31, 2018
1 parent f289312 commit 0392b0c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions eth_tester/normalization/inbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@
)


def normalize_topic(topic):
if topic is None:
return None
else:
return decode_hex(topic)


@to_tuple
def normalize_topic_list(topics):
for topic in topics:
if topic is None:
yield None
else:
yield decode_hex(topic)
yield normalize_topic(topic)


@to_tuple
Expand All @@ -56,11 +60,11 @@ def normalize_filter_params(from_block, to_block, address, topics):

if topics is None:
yield topics
elif is_flat_topic_array(topics):
yield normalize_topic_list(topics)
elif all(is_flat_topic_array(item) for item in topics):
elif is_valid_topic_array(topics):
yield tuple(
normalize_topic_list(item)
if is_list_like(item) else
normalize_topic(item)
for item
in topics
)
Expand Down

0 comments on commit 0392b0c

Please sign in to comment.