-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Whisper support #117
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0bce430
added shh_version delegation
shravan-shandilya 330aa46
added delegation of shh-post
shravan-shandilya 37fe2e2
added other methods
shravan-shandilya 63565f0
added filter method
shravan-shandilya 5e14efd
Merge remote-tracking branch 'upstream/master'-Fork Sync
shravan-shandilya bd1cc25
Added poll interval option and overided stop watching method
shravan-shandilya 2d2cfef
added flaky8 as a dependency
shravan-shandilya 5f5557f
started tests for shh-module
shravan-shandilya 21b1360
changed version requirement for py-geth
shravan-shandilya 33b20f4
Not implemented yet
shravan-shandilya b9d6702
Synced with Piper's tree
shravan-shandilya 1967ae4
Added few basic tests
shravan-shandilya b7bc4e5
Addressed review comments
shravan-shandilya 396dd3e
initial documentation
shravan-shandilya d558e43
completed documentation
shravan-shandilya 905a76d
added link to missing RPC methods issue in Geth
shravan-shandilya f169841
increase timeout
pipermerriam d4f0da8
add shh to CI
pipermerriam 1b9eda6
fixed bytearray comparision issue
shravan-shandilya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import gevent | ||
|
||
def test_shh_filter(web3, skip_if_testrpc): | ||
skip_if_testrpc(web3) | ||
recieved_messages = [] | ||
shh_filter = web3.shh.filter({"topics":[web3.fromAscii("test")]}) | ||
shh_filter.watch(recieved_messages.append) | ||
gevent.sleep(1) | ||
|
||
payloads = [] | ||
payloads.append(str.encode("payload1")) | ||
web3.shh.post({"topics":[web3.fromAscii("test")], "payload":web3.fromAscii(payloads[len(payloads)-1])}) | ||
gevent.sleep(1) | ||
|
||
payloads.append(str.encode("payload2")) | ||
web3.shh.post({"topics":[web3.fromAscii("test")], "payload":web3.fromAscii(payloads[len(payloads)-1])}) | ||
gevent.sleep(1) | ||
|
||
assert len(recieved_messages) > 1 | ||
|
||
for message in recieved_messages: | ||
assert web3.toAscii(message["payload"]) in payloads | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def test_shh_has_identity(web3, skip_if_testrpc): | ||
skip_if_testrpc(web3) | ||
new_identity = web3.shh.newIdentity() | ||
assert len(new_identity) == 132 | ||
assert web3.shh.hasIdentity(new_identity) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def test_shh_new_identity(web3, skip_if_testrpc): | ||
skip_if_testrpc(web3) | ||
new_identity = web3.shh.newIdentity() | ||
assert len(new_identity) == 132 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def test_shh_post(web3, skip_if_testrpc): | ||
skip_if_testrpc(web3) | ||
random_topic = "testing" | ||
assert web3.shh.post({"topics":[web3.fromAscii(random_topic)], "payload":web3.fromAscii("testing shh on web3.py")}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def test_shh_version(web3, skip_if_testrpc): | ||
skip_if_testrpc(web3) | ||
assert web3.shh.version == 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😄