Commit Graph

703 Commits

Author SHA1 Message Date
mhchia
6fe5871d96
Use async-exit-stack over contextlib
For `AsyncExitStack`
2019-12-24 14:44:28 +08:00
mhchia
ce5663705f
Merge branch 'master' into feature/porting-to-trio 2019-12-24 02:19:43 +08:00
Jonathan de Jong
adae81ca01 fix logging bug 2019-12-23 09:15:56 +01:00
Jonathan de Jong
96f6b80e51 Merge remote-tracking branch 'origin/master' into f-string_clean
# Conflicts:
#	libp2p/network/swarm.py
2019-12-23 09:14:15 +01:00
Kevin Mai-Husan Chia
1571bfac07
Merge pull request #386 from ShadowJonathan/issue_384
fixes #384
2019-12-23 14:25:38 +08:00
Jonathan de Jong
df8be6eb09 revert network/tcp.py and add changes to multiaddr_to_socket_fix 2019-12-19 21:09:11 +01:00
Jonathan de Jong
0827d0d9ef add 2 more instances of formatting violations 2019-12-19 18:09:47 +01:00
NIC Lin
28da206aea
Merge pull request #387 from NIC619/fix_inconsistent_pubsub_peer_record_update
Store peer ids in set instead of list and check if peer id exist before access
2019-12-20 00:34:14 +08:00
Jonathan de Jong
b1248ff315 enforced f-strings everywhere, %s on logging
extended _multiaddr_from_socket to support UDP and IPv6 automatically
changed TCPListener to use _ip4_or_6_from_multiaddr to get host, and not ip4 only

enforced `from error` everywhere with raises
added call braces to exceptions
2019-12-19 17:31:18 +01:00
NIC619
3c75c85d7f
Fix extra white space 2019-12-19 23:07:20 +08:00
NIC Lin
cb80cfc50b
Update libp2p/pubsub/gossipsub.py
Co-Authored-By: Chih Cheng Liang <chihchengliang@gmail.com>
2019-12-19 16:33:56 +08:00
NIC619
74092c1371
Apply PR feedback: update error msg 2019-12-19 16:26:37 +08:00
NIC619
e51d376d5e
Combine peers_gossipsub and peers_floodsub 2019-12-19 14:44:49 +08:00
NIC619
6cd3eb8fae
Apply PR feedback:
change param type and remove check before `discard`
2019-12-19 14:15:51 +08:00
Jonathan de Jong
6cf1b98a88 mark explicit modulo formatting (to get started with PR draft) 2019-12-19 00:37:09 +01:00
Jonathan de Jong
f54bc9d1af Make linter happy 2019-12-18 19:05:22 +01:00
Jonathan de Jong
81fe4049cf Apply PR review feedback
> add `if not addr` clause back
> use f-strings for exceptions instead of %s
2019-12-18 18:47:03 +01:00
Jonathan de Jong
4e4d91b2e2
Apply PR review suggestion (change "muxed" to "network" in docstrings)
Co-Authored-By: Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>
2019-12-18 10:54:52 +01:00
NIC619
f3732f9480
Fix tests 2019-12-18 12:37:04 +08:00
Jonathan de Jong
6b75901243 apply PR feedback (remote len == 0 block, remove redundant fixme comment + docstring line)
change wording of final SwarmException to include possible case of no addresses in returned address set

add `from error` in except clause
2019-12-17 20:20:09 +01:00
Alex Stokes
445c0f8e65
Dangling kademlia cleanup 2019-12-17 10:11:17 -08:00
NIC619
19ce8a2140
Fix mypy 2019-12-17 21:56:02 +08:00
Jonathan de Jong
3cbe24caab fixes #384
also adds MultiError to libp2p/exceptions.py

and an additional fixme I have noticed
2019-12-17 12:00:11 +01:00
NIC619
474ed41652
Remove dead peer if floodsub write stream fail 2019-12-17 18:48:25 +08:00
NIC619
009df257bc
Check peer id exist in dict before access 2019-12-17 18:47:58 +08:00
mhchia
47d10e186f
Add SubscriptionAPI
And `TrioSubscriptionAPI`, to make subscription io-agnostic.
2019-12-17 18:17:28 +08:00
Jonathan de Jong
794d2101e9 fixes #197 2019-12-17 11:00:45 +01:00
NIC619
f10e3099cb
Change type of peers in pubsub from list to set 2019-12-17 17:55:13 +08:00
NIC619
b4bd997932
Fix mypy 2019-12-17 17:49:49 +08:00
NIC619
65766ec9ac
Change type of local peers var from list to set 2019-12-17 17:36:15 +08:00
NIC619
f1d58ef8ff
Change type of peers from list to set:
`peers_gossipsub`, `peers_floodsub` and mesh/fanout peers
2019-12-17 17:30:24 +08:00
NIC619
7d6daa8e10
Minor cleanup:
- remove outdated comment
- add new peer at the end
- turn peers to send from list to set
2019-12-17 17:17:03 +08:00
mhchia
fb0519129d
Refine Mplex.close and SwarmConn.close
Ensure `close` cleans up things and cancel the service finally.
2019-12-17 15:50:55 +08:00
Alex Stokes
733b1d08b6
Merge pull request #372 from ralexstokes/add-py36-compatibility
Add py36 compatibility
2019-12-10 17:28:49 -08:00
Alex Stokes
3b9d7c7acd
Apply PR feedback 2019-12-10 17:20:41 -08:00
NIC Lin
ad379221b9
Merge pull request #373 from NIC619/refactor_and_cleanup_gossipsub
Refactor and cleanup gossipsub
2019-12-07 16:28:55 +08:00
NIC Lin
a675da52ee
Update libp2p/pubsub/gossipsub.py
Co-Authored-By: Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>
2019-12-07 15:46:42 +08:00
mhchia
837a249552
Fix security module 2019-12-07 00:14:01 +08:00
NIC619
2d3bfc8184
Apply PR feedback:
use defaultdict and init control message
2019-12-06 23:42:31 +08:00
mhchia
1929f307fb
Fix all modules except for security 2019-12-06 17:06:37 +08:00
Chih Cheng Liang
82dcce214a
Remove kademlia module (#377)
* Remove kademlia and routing/kademlia

* cleanup

* Fix routed_host test

* lint mypy

* fix doc

* remove set_up_nodes_by_transport_and_disc_opt and fix typing
2019-12-06 14:14:33 +08:00
NIC619
db0017ddbb
Fix lint after applying suggestion 2019-12-05 17:33:07 +08:00
NIC Lin
b4900d53da
Apply suggestions from code review
Co-Authored-By: Chih Cheng Liang <chihchengliang@gmail.com>
2019-12-05 15:21:09 +08:00
NIC619
67f02c512a
Remove unnecessary check and fix test 2019-12-05 15:10:04 +08:00
NIC619
e6813da5f5
Refactor _get_peers_to_send 2019-12-05 14:35:34 +08:00
NIC619
c08b2375e1
Fix: should not remove topic if no peers 2019-12-03 23:10:47 +08:00
NIC619
a9abf1e3dd
Fix list deletion and add list remove check 2019-12-03 22:37:49 +08:00
NIC619
bb15c817b1
Fix var access before assignment 2019-12-03 22:14:45 +08:00
NIC619
ea6cd30a16
Add back some comment and TODO. Add comment to tests 2019-12-03 18:45:33 +08:00
mhchia
e9ab0646e3
Fix Pubsub 2019-12-03 17:27:49 +08:00
NIC619
5efdf4c703
Group messages for peer in heartbeat 2019-12-03 15:48:23 +08:00
NIC619
ab1500c708
Remove unneccessary check in gossip heartbeat 2019-12-03 15:03:06 +08:00
Alex Stokes
63fd531ed0
Fixes to add python 3.6 compatibility 2019-12-02 16:33:32 -08:00
NIC619
920cf646ef
Fix lint and add check in fanout heartbeat 2019-12-02 22:49:27 +08:00
NIC619
a7e0c5d737
Add missing cleanup in gossipsub remove_peer 2019-12-02 22:41:49 +08:00
NIC619
357341e0d8
Remove unneccessary filter and check in gossipsub 2019-12-02 22:40:35 +08:00
NIC619
c2d88962c7
Add gossipsub heartbeat_initial_delay 2019-12-02 16:55:16 +08:00
NIC619
0672f5ae6d
Fix: move heartbeat delay to heartbeat 2019-12-02 16:38:48 +08:00
mhchia
bdbb7b2394
Add RoutedHostFactory
And skip the tests for `RoutedHost` for now, since there are too many to
be fixed in `Kademlia`, and it's not that necessary now.
2019-12-01 19:17:44 +08:00
mhchia
eb494e8682
Fix ping protocol 2019-12-01 19:17:32 +08:00
mhchia
31bf774a16
Fix tests in protocol_muxer and libp2p 2019-12-01 17:43:14 +08:00
mhchia
79fcdf3a02
Update tests in test_tcp.py
Besides, run `make format`
2019-12-01 16:26:16 +08:00
NIC619
50fd0acf41
Cleanup outdated TODOs in gossipsub 2019-11-30 20:19:17 +08:00
NIC619
0a52a05375
Del entry if no more peers subscribe to the topic 2019-11-30 20:02:11 +08:00
NIC619
e59ac6a250
Cleanup TODOs in pubsub 2019-11-30 17:12:37 +08:00
NIC Lin
dfdcf524b7
Merge pull request #362 from NIC619/add_signing_and_verification_to_pubsub
Add signing and verification to pubsub
2019-11-30 13:44:12 +08:00
NIC619
658a0ae156
Apply PR feedback:
move signature validation logic into signature validator
2019-11-29 19:37:48 +08:00
mhchia
1e600ea7e0
Fix Mplex and Swarm 2019-11-29 19:09:56 +08:00
NIC619
1c54c38ca7
Fix lint and add signing_strict to interop tests 2019-11-29 17:24:40 +08:00
NIC619
a262b94836
Apply PR feedback:
check if signing key and ID match
2019-11-29 14:12:42 +08:00
NIC619
064c109b64
Fix signature validator:
Add prefix and return verify result
2019-11-28 18:45:00 +08:00
Jason Carver
27ecd4b0ed Mock dependencies that are excluded in readthedocs
It seems preferable to import just fastecdsa. But if you do that,
then some kind of side-effect doesn't happen, which means that `sec1` is
not available as an attribute on `fastecdsa.encoding`.

So we specifically mock the sub-modules as well.
2019-11-27 14:07:14 -08:00
Jason Carver
2a9dc96269
Merge pull request #369 from carver/docs-travis-target
Add docs test to Travis CI
2019-11-27 10:36:15 -08:00
NIC619
d5d6962dce
Update Pubsub fixture and test 2019-11-27 17:15:24 +08:00
NIC619
0fd400fdf8
Sign and verify in Pubsub 2019-11-27 17:15:24 +08:00
NIC619
f3c9972159
Implement Pubsub signature validator 2019-11-27 17:15:24 +08:00
NIC619
683710573e
Add strict_signing: bool and sign_key to Pubsub 2019-11-27 17:15:23 +08:00
NIC Lin
da10fc8531
Merge pull request #360 from NIC619/store_our_keypair_in_peerstore
Store our keypair in peerstore
2019-11-27 17:14:36 +08:00
Jason Carver
d503950179 Fix all doc build warnings 2019-11-26 17:44:33 -08:00
NIC Lin
cac7e3909a
Merge pull request #357 from NIC619/minor_fix_replace_del
Replace (check and) del pattern with pop method
2019-11-26 19:39:41 +08:00
mhchia
ec43c25b45
Rewrite factories, made some of the test running 2019-11-26 19:24:30 +08:00
NIC619
9f3f2c53da
Apply PR feedback:
use defaultdict for peer data map
2019-11-26 16:18:15 +08:00
Chih Cheng Liang
417b5e7d61
remove unused asyncio 2019-11-26 15:27:06 +08:00
Chih Cheng Liang
6ab0e108d3
minor 2019-11-26 15:27:06 +08:00
Chih Cheng Liang
a397ccdc04
makes test_mplex_stream.py::test_mplex_stream_read_write work 2019-11-26 15:27:06 +08:00
Chih Cheng Liang
c55ea0e5bb
implement trio queue interface 2019-11-26 15:27:05 +08:00
Chih Cheng Liang
41ff884eef
rewrite tcp reader/writer interface 2019-11-26 15:27:05 +08:00
Chih Cheng Liang
d4d345c3c7
progressing 2019-11-26 15:27:05 +08:00
Chih Cheng Liang
ed17bfd663
hack chat example 2019-11-26 15:27:04 +08:00
NIC619
94c7a0bca4
Apply PR feedback and fix 2019-11-26 14:04:28 +08:00
NIC619
fab27b0357
Fix lint 2019-11-26 12:35:50 +08:00
NIC619
ffa73f5649
Check if pubkey matches peer ID before add 2019-11-26 12:33:55 +08:00
NIC619
0bfbdf7fab
Move keypair into PeerData 2019-11-26 12:27:59 +08:00
NIC619
828ae69c66
Apply PR feedback: add_key_pair 2019-11-26 11:52:31 +08:00
NIC619
566e4c080d
Fix lint 2019-11-25 17:32:53 +08:00
NIC619
e28a974425
Update peer store initialization in host factory 2019-11-25 17:17:09 +08:00
NIC619
8b4022328d
Update peer store interface 2019-11-25 17:16:47 +08:00
NIC619
e49de15227
Add get_private_key to Host 2019-11-25 16:57:00 +08:00
NIC619
a63f00d8f8
Store our pubkey/privkey info during
`initialize_default_swarm`
2019-11-25 16:55:55 +08:00
NIC619
144d93a023
Add pubkey/privkey info to PeerStore 2019-11-24 18:04:00 +08:00