Skip to content

Commit 4ed8e53

Browse files
committed
Update topic list validation
1 parent cca86e8 commit 4ed8e53

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

eth_tester/normalization/inbound.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
to_tuple,
1717
)
1818

19+
from eth_tester.utils.filters import (
20+
is_tuple,
21+
)
22+
1923
from .common import (
2024
normalize_array,
2125
normalize_dict,
@@ -27,13 +31,17 @@
2731
)
2832

2933

34+
def normalize_topic(topic):
35+
if topic is None:
36+
return None
37+
else:
38+
return decode_hex(topic)
39+
40+
3041
@to_tuple
3142
def normalize_topic_list(topics):
3243
for topic in topics:
33-
if topic is None:
34-
yield None
35-
else:
36-
yield decode_hex(topic)
44+
yield normalize_topic(topic)
3745

3846

3947
@to_tuple
@@ -56,11 +64,11 @@ def normalize_filter_params(from_block, to_block, address, topics):
5664

5765
if topics is None:
5866
yield topics
59-
elif is_flat_topic_array(topics):
60-
yield normalize_topic_list(topics)
61-
elif all(is_flat_topic_array(item) for item in topics):
67+
elif is_valid_topic_array(topics):
6268
yield tuple(
6369
normalize_topic_list(item)
70+
if is_tuple(item) else
71+
normalize_topic(item)
6472
for item
6573
in topics
6674
)

0 commit comments

Comments
 (0)