Skip to content

Whisper support #117

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

Merged
merged 19 commits into from
Oct 21, 2016
Merged

Whisper support #117

merged 19 commits into from
Oct 21, 2016

Conversation

shravan-shandilya
Copy link
Contributor

What was wrong?

Shh delegations were not implemented.

How was it fixed?

Added missing implementations and basic tests.

Cute Animal Picture

pr

@shravan-shandilya
Copy link
Contributor Author

@pipermerriam How do I configure Travis to run Shh related testcases?

Copy link
Member

@pipermerriam pipermerriam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. If you can do the few minor cleanup comments I posted I think this will be good to merge.


def test_shh_filter(web3,skip_if_testrpc):
skip_if_testrpc(web3)
topic = "".join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(10))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using random here can we use something deterministic or non-random. I have sound that unless the test is intentionally fuzzing the inputs that randomness can lead to infuriating hard to reproduce test failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

gevent.sleep(1)

for message in recieved_messages:
assert web3.toAscii(message["payload"]) in payloads
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will pass silently if there are zero received messages. I think you need to add another assertion that ensures that at least some messages were received.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea.How did I miss that? Will add one more assert.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what code review is for 😄

class Shh(object):
"""
TODO: flesh this out.
"""
def __init__(self, web3):
self.web3 = web3
self.request_manager = web3._requestManager
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of storing this, can you either make a property that accesses this or access it directly through the web3 object. This pattern will break some of the new managers that I've been working on that distribute requests across multiple providers or managers.

@property
def request_manager(self):
    return self.web3._requestManager

Copy link
Contributor Author

@shravan-shandilya shravan-shandilya Oct 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.I'll go with the property approach.

@@ -0,0 +1,21 @@
import random,string,gevent

def test_shh_filter(web3,skip_if_testrpc):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick

Can you add a space after the , here and in the other test cases as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot the flake check.I will update with correct flake syntax.

@shravan-shandilya
Copy link
Contributor Author

@andylockran
Copy link

Yeah, that's weird - just checked it out locally and it's worked for me - was hoping I'd be able to contribute. 🎱

@shravan-shandilya
Copy link
Contributor Author

@andylockran Thanks for checking!

@pipermerriam
Copy link
Member

This just happens sometimes. Been meaning to increase that timeout. I restarted the run. Should pass and I'll get this merged.

@pipermerriam
Copy link
Member

Doh, ok, one more hoop if you're willing to jump through it. Can you add/update the docs @ docs/web3.shh.rst with basic explanations of how to use these methods?

Bonus points for functional example code for a common use case 😈

@shravan-shandilya
Copy link
Contributor Author

Sure.Will update soon.

@shravan-shandilya
Copy link
Contributor Author

@pipermerriam Am I missing anything?

@pipermerriam
Copy link
Member

This looks great. Thank you for doing this. Very well rounded PR. Going to get this merged now but likely not released until early next week.

@pipermerriam pipermerriam merged commit 74a8178 into ethereum:master Oct 21, 2016
@shravan-shandilya
Copy link
Contributor Author

@pipermerriam Thanks to you!

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

Successfully merging this pull request may close these issues.

3 participants