Skip to content

Conversation

lla-dane
Copy link
Contributor

@lla-dane lla-dane commented May 18, 2025

Description

This is a work-progress pull request for establishing interoperability between py-libp2p and rust-libp2p.

Changes

The directory structure is similar to ./interop-tests in rust-libp2p.

  • interop/exec/native_ping.py
  • interop/exec/config: env variables for ping test
  • interop/arch.py: RedisClient and SwarmBuilder utilities
  • interop/lib.py: handle_ping, send_ping and run_test(SwarmRunner) utilities

Current Status

Ping test is successful for 2 py-libp2p nodes with insecure, secio and mplex.

Logs

  • Listener

❯ transport=tcp ip=0.0.0.0 is_dialer=false redis_addr=6379 test_timeout_seconds=180 security=insecure muxer=mplex python3 native_ping.py

2025-05-18 22:29:13.035 | INFO     | interop.lib:run_test:69 - Starting run_test
2025-05-18 22:29:13.161 | INFO     | interop.lib:run_test:75 - Running ping test local_peer=Qmd5TtD5cr5sWfJsgexK6ESZr2FhvuzgLwPMVFyikKpWCB
2025-05-18 22:29:13.164 | INFO     | interop.lib:run_test:83 - Test instance, listening: /ip4/0.0.0.0/tcp/8000/p2p/Qmd5TtD5cr5sWfJsgexK6ESZr2FhvuzgLwPMVFyikKpWCB
received ping from QmcwusXZydtSbD9evrcHyaXEwMN8GjnTXHBsT67iYcm9yN
responded with pong to QmcwusXZydtSbD9evrcHyaXEwMN8GjnTXHBsT67iYcm9yN
  • Dialer

❯ transport=tcp ip=0.0.0.0 is_dialer=true port=8001 redis_addr=6379 test_timeout_seconds=180 security=insecure muxer=mplex python3 native_ping.py

2025-05-18 22:29:16.488 | INFO     | interop.lib:run_test:69 - Starting run_test
2025-05-18 22:29:16.572 | INFO     | interop.lib:run_test:75 - Running ping test local_peer=QmcwusXZydtSbD9evrcHyaXEwMN8GjnTXHBsT67iYcm9yN
2025-05-18 22:29:16.585 | INFO     | interop.lib:run_test:95 - Remote conection established
2025-05-18 22:29:16.585 | INFO     | interop.lib:run_test:100 - handshake time: 9.33ms
sending ping to Qmd5TtD5cr5sWfJsgexK6ESZr2FhvuzgLwPMVFyikKpWCB
received pong from Qmd5TtD5cr5sWfJsgexK6ESZr2FhvuzgLwPMVFyikKpWCB

Next Steps

Extend the support for Noise and Yamux, to test interoperability with rust-libp2p.

@seetadev @paschal533

paschal533 and others added 30 commits April 6, 2025 23:08
Fixed 	est_net_stream_read_after_remote_closed by updating NetStream.read to raise StreamEOF when the stream is remotely closed and no data is available, aligning with test expectations and Fixed 	est_net_stream_read_until_eof by modifying YamuxStream.read to block until the stream is closed (
ecv_closed=True) for
=-1 reads, ensuring data is only returned after remote closure.
Fixed 	est_net_stream_read_after_remote_closed by updating NetStream.read to raise StreamEOF when the stream is remotely closed and no data is available, aligning with test expectations and Fixed 	est_net_stream_read_until_eof by modifying YamuxStream.read to block until the stream is closed (
ecv_closed=True) for
=-1 reads, ensuring data is only returned after remote closure.
@seetadev
Copy link
Contributor

seetadev commented May 18, 2025

@lla-dane : Thank you for sharing the PR.

@acul71 and @paschal533 should land yamux PR this week.

Could you please merge the yamux changes locally and try interop tests with rust-libp2p?

@lla-dane
Copy link
Contributor Author

Migrated the relevant commits in #620 . Closing this PR.

@lla-dane lla-dane closed this May 20, 2025
@lla-dane lla-dane deleted the feat/interop branch September 1, 2025 11:41
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.

5 participants