Commit Graph

299 Commits

Author SHA1 Message Date
mhchia
1f3c9af45b
Add the missing is_proc_running=True 2019-09-04 22:19:11 +08:00
mhchia
0e3d4508d6
PR feedback
- Use `Sequence` instead of `List`
- Add note
- Remove redundant words in docstring
2019-09-04 20:52:18 +08:00
mhchia
db0da8083a
Do p2pd.close if not all of them succeed 2019-09-04 20:52:17 +08:00
Kevin Mai-Husan Chia
51d547ccc5
Update tests/interop/utils.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-09-04 20:38:38 +08:00
Kevin Mai-Husan Chia
b72c489f4e
Update tests/interop/daemon.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-09-04 20:36:42 +08:00
Kevin Mai-Husan Chia
a843514afb
Update tests/interop/daemon.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-09-04 20:35:42 +08:00
Kevin Mai-Husan Chia
155f523c9f
Update tests/interop/daemon.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-09-04 20:33:50 +08:00
Kevin Mai-Husan Chia
bd21b2f66f
Update tests/interop/conftest.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-09-04 20:33:29 +08:00
mhchia
dddaacad62
Move install script under tests/interop/go_pkgs 2019-09-04 16:33:25 +08:00
mhchia
677531db76
Fix pubsub tests 2019-09-04 15:33:07 +08:00
Alex Stokes
8e8318aa5c
Introduces IO abstractions apart from asyncio or those attached to IRawConnection
Also adds `msgio` utilities to mirror the Go implementation
2019-09-03 21:59:50 -07:00
mhchia
7f20ab781d
Fix gosssipsub tests 2019-09-03 23:37:34 +08:00
mhchia
5280f3965c
Update install script for interop
And adjust the structure of go packages for interop
2019-09-03 17:41:17 +08:00
mhchia
749ff275ed
Refactor make_p2pd
Let `make_p2pd` get rid of `unused_tcp_port_factory`, which should only
exist in fixtures/tests.
2019-09-03 16:55:42 +08:00
mhchia
7385a7a677
Add is_gossipsub fixture in interop test
To use the same code to test against both routers: floodsub and
gossipsub.
2019-09-03 16:49:00 +08:00
mhchia
33dae87c35
Add pubsub test for gossipsub 2019-09-03 16:07:44 +08:00
mhchia
194b494057
Tested against subscriptions and publish 2019-09-02 23:21:57 +08:00
mhchia
3717dc9adf
Add helper functions 2019-09-02 21:01:13 +08:00
mhchia
a883816881
Add connect utility function 2019-09-02 18:40:12 +08:00
mhchia
56ef0b962c
Add test for host connect and disconnect 2019-09-02 17:32:15 +08:00
mhchia
dfd9ebdc5e
Change PeerInfo to remove dep on PeerData 2019-09-02 14:30:27 +08:00
mhchia
b77834d129
Use asyncio.subprocess over pexpect
In the test for pubsub, since there were unknown issues when I test
against pexpect.
2019-09-02 14:30:27 +08:00
mhchia
1b5d064a8d
Add utility functions for libp2p bindings
To prepare for pubsub interop test
2019-09-02 14:30:25 +08:00
mhchia
b955c0fa02
Explicitly import ID, Transport from secio 2019-08-31 22:38:46 +08:00
Kevin Mai-Husan Chia
9e8a6bdf29
Update tests/conftest.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-08-31 22:32:43 +08:00
mhchia
cec2aea928
Move shared fixtures and constants to files 2019-08-29 22:38:08 +08:00
mhchia
9ceb5f55bb
Call make_echo_proc with is_host_insecure
Use the fixture, this way we can configure `is_host_insecure` to support
the test against secio.
2019-08-29 22:08:27 +08:00
mhchia
c61a06706a
Refactor interop tests and factories
- Add `close` and `disconnect` in `Host`
- Add `close` and `close_peer` in `Network`
- Change `IListener.close` to async, to await for server's closing
- Add factories for security transports, and modify `HostFactory`
2019-08-29 21:38:06 +08:00
mhchia
64c0dab3af
Fix isort 2019-08-29 00:01:48 +08:00
mhchia
b726d7c9da
Add tox and CI for interop 2019-08-28 23:39:33 +08:00
mhchia
d35b8ffc64
Conform stream_id to go-mplex 2019-08-28 21:43:34 +08:00
Alex Stokes
66c3bacf7e
Merge pull request #254 from ralexstokes/implement-secio
Implement `secio`
2019-08-26 19:22:00 +02:00
Alex Stokes
fa0acd9fc5
Apply PR feedback 2019-08-26 10:03:12 -07:00
NIC619
5e68aff1d1
Fix conn attribute and docstring in mplex 2019-08-25 14:42:44 +08:00
Alex Stokes
f08aa339b4
Verify the channel can pass some plaintext 2019-08-24 23:26:26 +02:00
Alex Stokes
737195f461
Simplify testing connection w/ other simplifications 2019-08-24 23:15:31 +02:00
Alex Stokes
10e30beb42
Disable "friendly" IDs for tests that expect a full string 2019-08-24 22:57:22 +02:00
Alex Stokes
9355f33da8
Add basic test for secio
Two peers in-memory can create a secure, bidirectional channel
2019-08-24 22:38:26 +02:00
Alex Stokes
3f4589d497
Get tests working 2019-08-24 22:38:25 +02:00
Alex Stokes
8e913a3faa
Dispatch serialization of keys based on key type
- Add some tests to check high-level roundtrip
2019-08-24 22:37:45 +02:00
Alex Stokes
7ccdeaf308
Remove test suite for asyncio, *not* py-libp2p 2019-08-24 22:10:47 +02:00
Alex Stokes
73495038e1
remove simple security 2019-08-24 21:39:25 +02:00
mhchia
16a4fd33c1
PR feedbacks
- Move exceptions to exceptions.py
- Raise `UpgradeFailure` in upgrader
- Refine the try/catch for upgraders in swarm
2019-08-22 22:53:49 +08:00
mhchia
3e04480d62
Raise HandshakeFailure in transport
Change the exception handling flow.
Raise `SecurityUpgradeFailure` in security_multistream.
2019-08-22 22:53:48 +08:00
mhchia
0b62321265
Fix test_security_multistream
By passing initiator keypairs to node.
2019-08-22 22:53:47 +08:00
Alex Stokes
87d943aa39
Internalize the protobuf serialization to the concept of a Key
Given its use across various components of `libp2p` (not just peer IDs),
it makes the abstraction cleaner to pull the serialization into the
key class and expose the canonical serialization to bytes.
2019-08-20 19:01:36 +02:00
Alex Stokes
7535a02da7
Clean up key gen 2019-08-15 19:24:30 -07:00
Alex Stokes
d17e6f3392
Fix some test imports that got botched in rebase 2019-08-15 16:46:23 -07:00
Alex Stokes
82bae341a7
Run isort over files that were missing it 2019-08-15 16:33:35 -07:00
Alex Stokes
cda74dd382
Update tests for new logic 2019-08-15 16:33:34 -07:00
Alex Stokes
fb43728661
Mark some slow tests as such 2019-08-15 16:33:33 -07:00
Alex Stokes
b98025c379
Move security transports into their respective sub-packages 2019-08-15 16:33:33 -07:00
Alex Stokes
67744bcb0f
Add a basic interop test for Go and Python peer IDs 2019-08-14 09:00:40 -07:00
Alex Stokes
ad20d8cb00
Make a KeyPair dataclass for passing around key pairs 2019-08-14 09:00:40 -07:00
Alex Stokes
329bd4eb0f
Clean up peer ID tests 2019-08-14 09:00:40 -07:00
Alex Stokes
3debd2c808
Run black and isort w/ the new config 2019-08-13 14:36:42 -07:00
Chih Cheng Liang
c536aa3e07 flake8 2019-08-08 16:09:02 +08:00
NIC619
a1dc68ab70
Apply PR feedback:
add validation failed test to `push_msg` test
2019-08-07 11:53:54 +08:00
NIC619
1cea1264a4
Raise exception when topic validation failed 2019-08-06 12:38:31 +08:00
NIC619
b96ef0e6c7
Fix:
`_is_subscribed_to_msg` need only subscribe to one of the topics
2019-08-05 18:20:04 +08:00
NIC619
e1b86904e3
Add validate_msg and test 2019-08-05 18:19:32 +08:00
NIC619
f8ca4fa1ef
Add get_msg_validators and test 2019-08-05 18:19:32 +08:00
NIC619
1ed14d0cc8
Add remove_topic_validator test 2019-08-05 18:19:32 +08:00
NIC619
cf69f7e800
Rename to set_topic_validator and add test 2019-08-05 18:19:31 +08:00
Chih Cheng Liang
7a04ebb51f
run black 2019-08-05 11:21:20 +08:00
Alex Stokes
7477b29508 run black w/ extended line length 2019-08-04 12:37:41 +08:00
Alex Stokes
cb301fcc51 Opt-out of linting on the special cases we have, given new ignore rules 2019-08-04 12:37:27 +08:00
mhchia
0a5b4a88ca
Fix flake8 for the existing code 2019-08-04 00:18:30 +08:00
Alex Stokes
c8005c8113 Run isort in repo 2019-08-03 17:50:14 +08:00
Alex Stokes
21e013e753
Merge pull request #214 from ralexstokes/remove-third-party-key-in-id
Refactor ID to not use third-party type for cryptographic keys
2019-08-02 22:50:53 -07:00
Alex Stokes
6090d2ca3b
Clean up old comments, print stmts, formatting, etc. 2019-08-02 21:58:31 -07:00
Alex Stokes
bd8d45fbc1
Refactor ID to not use third-party type for cryptographic keys
Remove `ID.from_privkey` which would require specific knowledge per cryptosystem
2019-08-02 21:51:16 -07:00
Alex Stokes
d47cddee24
Clean up extraneous files in tests 2019-08-02 14:54:40 -07:00
Alex Stokes
7b7c8ad30d
run black over dangling files 2019-08-02 11:47:08 -07:00
mhchia
2e94fcf56c
Remove pylint:disable 2019-08-02 23:26:06 +08:00
NIC619
568454534f
Remove unused ID type conversions 2019-08-02 16:48:38 +08:00
NIC619
924e965537
Change argument name of Network.listen and blakc format 2019-08-02 14:45:59 +08:00
NIC619
cd684aad9e
Update peer_id to type peer.ID in pubsub folder 2019-08-02 14:45:23 +08:00
NIC619
9562cb2a46
Rename:
`KadPeerInfo.peer_id` to `KadPeerInfo.peer_id_bytes`
2019-08-02 14:43:01 +08:00
NIC619
f00e80bc25
Fix wrong peer id type used in KadPeerInfo 2019-08-02 14:42:10 +08:00
NIC619
b928bdb356
Convert from base58/pubkey/privkey to class method 2019-08-02 14:42:10 +08:00
NIC619
80481252ca
Refactor ID to take in type bytes only 2019-08-02 14:42:10 +08:00
mhchia
716c60ca6d
Reflect PR feedback
- Remove leftover `int` in `GossipsubParams`
- Remove default fields in tests
2019-08-01 21:38:14 +08:00
mhchia
4eb846be7c
Remove the assertions for connect
Because it fails in `test_security_multistream.py` and this check is
indeed not necessary inside `connect`.(Should probably be outside the
function.)
2019-08-01 13:30:09 +08:00
mhchia
c72dfe1dd3
Use factories and fixtures in pubsub tests
Done
- Add factories using factory-boy
- Modify fixtures and tests to use factories
- Modify tests to use fixtures and factories
- Clean up
2019-08-01 13:30:08 +08:00
Alex Stokes
0ae9840928
Run black over repo 2019-07-31 15:00:12 -07:00
mhchia
ce369d47e9
Refine exception message 2019-07-31 16:23:07 +08:00
Kevin Mai-Husan Chia
c0e253a524
Update tests/pubsub/conftest.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-07-31 16:07:48 +08:00
Kevin Mai-Husan Chia
3bb63612a9
Update tests/pubsub/conftest.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-07-31 16:07:04 +08:00
mhchia
9683d5e8ac
Add tests for Pubsub
- `test_handle_subscription`
- `test_handle_talk`
- `test_message_all_peers`
2019-07-31 14:15:11 +08:00
mhchia
037b95252d
Add tests for Pubsub
- `test_get_hello_packet`
- `test_continuously_read_stream`
- `test_publish`
- `test_push_msg`
2019-07-31 14:15:10 +08:00
mhchia
550289a439
Combine test_subscription.py to test_pubsub.py
And add a bunch of tests for pubsub
2019-07-31 14:15:10 +08:00
mhchia
96563c0d84
Add fixtures for pubsub and router
And a starting `test_pubsub.py`
2019-07-31 14:14:13 +08:00
NIC619
f2de986c74
Add type hints to peer folder 2019-07-30 16:24:51 +08:00
mhchia
f02d38c0ee
Reflect PR feedback
* Rename `src` to `msg_forwarder` in pubsub/floodsub/gossipsub
* Rename Variables
* Sort imports
* Clean up
2019-07-29 12:09:35 +08:00
mhchia
c028aef2de
Fix all tests
- Dedup `perform_test_from_obj` and the test cases used in both
`test_floodsub` and `test_gossipsub_backward_compatibility.py`.
Therefore, they are put in the standalone file
`tests/pubsub/floodsub_integration_test_settings.py`. The functions
and testcases are imported from there then.
- IMO still need a refactor on the tests. There are still some duplicate
code.
2019-07-27 11:49:03 +08:00
mhchia
65aedcb25a
Fix several tests 2019-07-26 18:35:25 +08:00
mhchia
035d08b8bd
Fix test_floodsub.py 2019-07-25 23:11:27 +08:00
mhchia
dadcf8138e
Fix the tests according to pubsub.Publish
And refactored a bit.
2019-07-25 16:58:00 +08:00
mhchia
cae4f34034
Refactor floodsub.publish
Passed the first test of floodsub
2019-07-25 14:08:16 +08:00
NIC619
b0b4ddd0ca
Fix test_handle_prune 2019-07-24 11:35:14 +08:00
NIC619
99eabe49eb
Add handle_prune test 2019-07-23 23:00:43 +08:00
NIC619
42093e40ec
Add handle_graft test 2019-07-23 22:53:01 +08:00
NIC619
0cc8a205fb
Fix test and reduce number of nodes in test_join 2019-07-23 17:28:46 +08:00
NIC619
c0a3af69e0
Apply PR feedback:
Check that node is in mesh peer's mesh after subscribe
2019-07-23 16:45:54 +08:00
NIC Lin
042e0ac916
Update tests/pubsub/test_gossipsub.py
Co-Authored-By: Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>
2019-07-23 16:37:41 +08:00
NIC Lin
3c3a9ac90b
Update tests/pubsub/test_gossipsub.py
Co-Authored-By: Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>
2019-07-23 16:37:01 +08:00
NIC619
cdbeb63879
Add test 2019-07-22 19:28:12 +08:00
NIC619
14ee44c549
Lint test and add cleanup to the end 2019-07-21 23:16:42 +08:00
NIC619
2c1c8dc8cf
Add gossipsub.join test 2019-07-21 23:16:41 +08:00
NIC619
a26c7783d6
Add one_to_all_connect 2019-07-21 23:14:08 +08:00
NIC Lin
1e78c21eca
Merge pull request #181 from NIC619/fix_handle_unsubscribe
Fix: handle unsubscribe message
2019-07-21 20:09:51 +08:00
mhchia
a2d1aadf25
Add test for checking p2p code 2019-07-20 22:43:32 +08:00
mhchia
d3eb68fa50
Increase coverage 2019-07-20 22:43:32 +08:00
mhchia
73125b99b0
Fix the error due to the breaking change
In multiaddr, `split` is moved to `Multiaddr`'s method.
2019-07-20 22:43:31 +08:00
NIC619
29aae7dca4
Add gossipsub join/leave test 2019-07-19 20:16:53 +08:00
NIC619
183eee0e85
Add self subscription tests 2019-07-18 13:39:22 +08:00
Stuckinaboot
a4529d827d Modify peer_id str 2019-05-22 11:37:07 -04:00
Stuckinaboot
4b40339b63 Update peerid tests for longer peerids 2019-05-22 11:37:07 -04:00
ZX
49384ad3d7
Merge pull request #159 from libp2p/security-dev
Implement security
2019-05-07 09:56:19 -04:00
Robert Zajac
9052e8f8bd
The Gossipsub PR (#162)
* Add handle_rpc call to pubsub

* Scaffold gossipsub functions

* Add timer

* Implement most of mesh construction

* Implement emit and handle

* Implement fanout heartbeat

* Refactor emit

* some gossipsub cleanup and test

* minor lint stuff, more to come

* Implement publish

* Fix comment

* Modify pubsub/gossipsub so that floodsub tests pass using gossipsub router

* Add floodsub tests to gossipsub

* Handle case where select_from_minus, num_to_select > size(pool-minus)

* Add topic membership

* Implement handle ihave

* Implement most of iwant

* Add mcache.add and comments

* Refactor handle_ihave

* Implement stream write in handle_iwant

* Implement gossip heartbeat

* unresolved vars

* initial mcache code

* documenting mcache

* writing test/debugging mcache

* finished mcache test and debugged

* Make gossipsub backward compatibility its own file

* remove mcache prints

* DEBUGGING

* Add sender_peer_id to handle_rpc to get gossip test passing

* Modify gossipsub to make fanout work

* fanout maintenance test

* debugging gsub GOSSIP

* DEBUGGING

* debugged sender seen cachce

* adding lru, removing prints

* pylint cleanup

* Fix github comments in PR

* minor floodsub possible bugfix
2019-05-06 23:44:13 -04:00
Alex Haynes
eea6a9fda7
Merge pull request #157 from libp2p/router-refactor
Refactored RoutedHost into Injected Router
2019-05-05 14:45:22 -04:00
stuckinaboot
ff500e6d8e
Merge branch 'master' into security-dev 2019-05-01 17:26:23 -04:00
Stuckinaboot
144dc8d854 Move simple security to libp2p/security 2019-05-01 17:21:11 -04:00
Stuckinaboot
515a461172 Add more security tests 2019-05-01 17:13:01 -04:00
Stuckinaboot
4333c2d061 Fix linting issues' 2019-05-01 13:54:19 -04:00
Stuckinaboot
e555f17a7b Fix bug in security multistream 2019-04-30 16:07:26 -04:00
Stuckinaboot
a0bd6e5eb0 Add simple security with communication test 2019-04-30 03:27:06 -04:00
Stuckinaboot
f59f27d4d0 Integrate security selectin into libp2p system 2019-04-30 03:09:05 -04:00
Stuckinaboot
999e64854c Add security tests 2019-04-29 18:05:49 -04:00
zixuanzh
db7be2d561 add simple test 2019-04-28 17:57:57 -04:00
Alex Haynes
2efc0d3b5c updated peerinfo encoding stored in DHT 2019-04-28 17:38:40 -04:00
zixuanzh
3b1a3fb198 fix tests 2019-04-28 13:58:57 -04:00
Alex Haynes
fdaa4f56b9 working on adding tests 2019-04-27 21:59:25 -04:00
Alex Haynes
e7424d3673 added RoutedHost and updated new_node to support it 2019-04-20 17:35:05 -04:00
Alex Haynes
1228b11bc9
Update test_basic.py 2019-04-17 21:44:45 -04:00
zixuanzh
9906e23b55 fixed linting 2019-04-17 21:39:30 -04:00
ZX
14da7d49fe
Merge branch 'master' into peer_routing 2019-04-17 21:22:37 -04:00
zixuanzh
3c6ad886bb add dependencies 2019-04-17 21:21:17 -04:00
Alex Haynes
d5c7cc7cb7 added changes from future commits to last passing bmuller commit 2019-04-17 20:21:59 -04:00
zixuanzh
7a298adc33 add simple lru test 2019-04-05 21:46:18 -04:00
Stuckinaboot
b4aa64bc39 Change >I to >Q for 64-bit big endian int 2019-04-05 17:30:35 -04:00
Stuckinaboot
3c0fca8979 Remove prints 2019-04-04 17:10:41 -04:00
Stuckinaboot
22e503a260 Add test for ring topology multiple messages from two origins 2019-04-03 23:32:03 -04:00
Stuckinaboot
fc78928037 Add test for multiple messages from two origins 2019-04-03 23:32:03 -04:00
Stuckinaboot
211d6f6860 Add dummy node test 2019-04-03 23:32:03 -04:00
Stuckinaboot
9d16aa834d Modify pubsub to have seen message check incorporate seqno and node id 2019-04-03 23:32:03 -04:00
Stuckinaboot
c2b5389362 Adjust floodsub tests for new seqno util 2019-04-03 23:32:03 -04:00
zixuanzh
0238dff217 remove unused code 2019-04-02 21:17:48 -04:00
zixuanzh
41d1aae55b clean up 2019-04-01 16:55:44 -04:00