Commit Graph

242 Commits

Author SHA1 Message Date
ddf68ee4e0 rebuild protobufs with protoc v30.1 2025-03-23 16:49:19 -06:00
bef8a82a52 fixed lint 2025-03-17 09:27:13 -06:00
3c01c03e4e incorporated import changes as suggested 2025-03-17 09:27:13 -06:00
c86f3d0467 added dedicated test file and moved timed_cache to tools 2025-03-17 09:27:13 -06:00
e5f3e88134 added : timed_cache sub-module 2025-03-17 09:27:13 -06:00
0fa8711ca7 updated : seen message map type to bool from int 2025-03-17 09:27:13 -06:00
d7eab27564 refactored and moved all interfaces to abc.py (#504)
* refactored : host_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored : network_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored : notifee_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored : net_connection_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored: raw_connection_interface, secure_conn_interface and stream_muxer abc.py

* refactored: addrbook_interface

* refactored :peerdata_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :peermetadata_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :multiselect_client_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :multiselect_communicator_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :multiselect_muxer_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :interfaces

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :security_transport_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :listener_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* moved all interfaces and typing files

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* fixed documentation and moved pubsub abc.py

Co-authored-by: Khwahish Patel <khwahish.p1@ahduni.edu.in>

* added exclude-members in custom_types docs

* added : newsfragment for moving all interfaces to libp2p.abc

---------

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>
Co-authored-by: Mystical <125946525+mystical-prog@users.noreply.github.com>
2025-02-21 16:01:45 -07:00
e7a9ee78a8 rename typing.py to custom_types.py for clarity 2025-02-02 07:18:52 -07:00
8787613e91 run lint with pyupgrade at py39-plus 2025-01-25 15:48:39 -07:00
33332d7106 sync handle_rpc docstring 2024-12-03 14:00:18 -07:00
f156668c1b fixed doc comments in pubsub.abc 2024-12-03 14:00:18 -07:00
e768682ab9 reject messages claiming to be from ourselves but not locally published 2024-11-15 15:16:19 +07:00
125df142f6 bump protobufs dep to >= 5.27.2 and rebuild protobufs definitions with protoc 27.2 2024-07-04 17:04:06 -06:00
c5cc0ee969 run mypy locally, bump mypy to 1.10.0, fix new errors 2024-07-04 13:19:00 -06:00
d9b92635c1 drop async-service dep and copy relevant code into a local async_service
tool, updated for modern handling of ExceptionGroup
2024-05-27 12:14:36 -06:00
c770a05d23 rebuild protobufs adding ECC_P256 to KeyType 2024-04-27 12:17:54 -06:00
8dda7b933e turn mypy checks back on, fix some errors 2024-04-27 10:12:39 -06:00
ee4e9c4645 rename libp2p test dir and rebuild protobufs 2024-03-02 11:10:05 -07:00
94483714a3 run lint and fix errors, except mypy 2024-02-19 16:05:58 -07:00
080f8edc8e Use trio.lowlevel instead of trio.hazmat
Since trio 0.15.0, hazmat has been deprecated.

trio-typing and mypy are bumped to support newer trio and each other.
2021-02-23 22:02:34 +07:00
857cc29d27 add content-addressed message id utility 2020-02-28 08:25:03 -08:00
ef666267bd Allow Pubsub creator to supply a custom msg_id 2020-02-28 08:25:03 -08:00
f1dbd52d67 Merge branch 'master' into feature/trio 2020-02-06 10:39:54 +08:00
ddbedc6c15 Pubsub: handle_talk
- Change from async function to sync
- Change the name to `notify_subscriptions`, which is clearer.
2020-02-05 21:44:33 +08:00
7f8c0f11f6 Pubsub: change channel size
To `32` to conform to the go implementation.
2020-02-05 21:30:26 +08:00
ba0fb8a833 Fix: use pass over ...(Ellipse)
Use `...`(Ellipse) only in abstract methods.
2020-02-05 20:36:42 +08:00
857bb34f4e Add checkpoints in PubsubNotifee
Since some of the methods in `PubsubNotifee` are doing nothing,
add checkpoints to yield control.
2020-02-04 17:45:37 +08:00
66975ae3f2 Pubsub: change run_task to run_daemon_task 2020-02-04 17:43:39 +08:00
1588be2be9 Change the channel size of peer queue
Back to `0`, to avoid unlimited buffer size.
2020-01-31 17:42:47 +08:00
095a848f30 Add clean-up logics into TrioSubscriptionAPI
Register an `unsubscribe_fn` when initializing the TrioSubscriptionAPI.
`unsubscribe_fn` is called when subscription is unsubscribed.
2020-01-28 00:29:05 +08:00
c3ba67ea87 Remove locks in PubsubNotifee
- Change `open_memory_channel(0)` to `open_memory_channel(math.inf)`, to
avoid `peer_queue.send` and `dead_peer_queue.send` blocking. This allows
us to remove the locks.
- Only catch `trio.BrokenResourceError`, which is caused by Pubsub when
it's closing.
2020-01-27 14:30:44 +08:00
92ea35e147 Fix IPubsub and add IPubsub.wait_until_ready 2020-01-27 00:10:33 +08:00
e3a1dd62e4 Use new type hinting for trio channel 2020-01-26 23:56:19 +08:00
6c7aa30191 Add events in Pubsub
To ensure `handle_peer_queue` and `handle_dead_peer_queue` are indeed
run before the tests finish. Previously, we get errors when performing
`iter_dag` after cancellation. This is because `handle_peer_queue` or
`handle_dead_peer_queue` is not actually run before the Service is
cancelled.
2020-01-18 00:17:30 +08:00
94f0fcb6ad Iterate dead_peer_receive_channel with async for 2019-12-26 20:44:32 +08:00
53dbb0aff1 Fix pubsub_notifee.py
For wrong syntax and import
2019-12-24 18:37:59 +08:00
573c049d0f Catch expections in PubsubNotifee
Also, add lock to avoid resource race condition
2019-12-24 18:31:39 +08:00
ce5663705f Merge branch 'master' into feature/porting-to-trio 2019-12-24 02:19:43 +08:00
adae81ca01 fix logging bug 2019-12-23 09:15:56 +01:00
96f6b80e51 Merge remote-tracking branch 'origin/master' into f-string_clean
# Conflicts:
#	libp2p/network/swarm.py
2019-12-23 09:14:15 +01:00
0827d0d9ef add 2 more instances of formatting violations 2019-12-19 18:09:47 +01:00
3c75c85d7f Fix extra white space 2019-12-19 23:07:20 +08:00
cb80cfc50b Update libp2p/pubsub/gossipsub.py
Co-Authored-By: Chih Cheng Liang <chihchengliang@gmail.com>
2019-12-19 16:33:56 +08:00
74092c1371 Apply PR feedback: update error msg 2019-12-19 16:26:37 +08:00
e51d376d5e Combine peers_gossipsub and peers_floodsub 2019-12-19 14:44:49 +08:00
6cd3eb8fae Apply PR feedback:
change param type and remove check before `discard`
2019-12-19 14:15:51 +08:00
f3732f9480 Fix tests 2019-12-18 12:37:04 +08:00
19ce8a2140 Fix mypy 2019-12-17 21:56:02 +08:00
474ed41652 Remove dead peer if floodsub write stream fail 2019-12-17 18:48:25 +08:00
009df257bc Check peer id exist in dict before access 2019-12-17 18:47:58 +08:00