Skip to content
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

Supply log topic as bytes #185

Closed
carver opened this issue May 14, 2020 · 0 comments · Fixed by #266
Closed

Supply log topic as bytes #185

carver opened this issue May 14, 2020 · 0 comments · Fixed by #266

Comments

@carver
Copy link
Contributor

carver commented May 14, 2020

What was wrong?

It's pretty natural to want to supply a log topic as a 32-byte bytes value instead of a hex string.

Right now, only hex-encoded strings of 32 bytes are supported.

How can it be fixed?

Add tests that 32-byte values will be accepted, like these, but with a decode_hex():

(_make_filter_params(topics=[TOPIC_A]), True),
(_make_filter_params(topics=[TOPIC_A, TOPIC_B]), True),
(_make_filter_params(topics=[TOPIC_A, None]), True),
(_make_filter_params(topics=[[TOPIC_A], [TOPIC_B]]), True),
(_make_filter_params(topics=[TOPIC_A, [TOPIC_B, TOPIC_A]]), True),
(_make_filter_params(topics=[[TOPIC_A], [TOPIC_B, None]]), True),

Add tests that 31 or 33-byte values are not accepted.

Add tests that the logs are correctly found when a bytes-value is supplied to create_log_filter():

def test_log_filter_picks_up_new_logs(self, eth_tester, filter_topics, expected):

Implement any conversions needed to make ^ pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant