Skip to content

Conversation

@ItshMoh
Copy link

@ItshMoh ItshMoh commented Jan 19, 2026

summary

fixes #1142

Implements interoperability tests between py-libp2p and rust-libp2p using the /ipfs/ping/1.0.0 protocol over TCP transport.

What's Included

New Files

  • tests/interop/rust_libp2p/test_ping_interop.py- Python test that connects to a Rust ping server and validates RTT responses
  • tests/interop/rust_libp2p/conftest.py- Pytest fixtures for building and managing the Rust server lifecycle
  • tests/interop/rust_libp2p/rust_node/ - Rust ping server implementation using rust-libp2p
  • tests/interop/rust_libp2p/README.md - Documentation with prerequisites and instructions

Test Coverage

The test verifies:

  • TCP Transport Compatibility: Connection establishment between py-libp2p and rust-libp2p
  • Multistream Protocol Negotiation: /ipfs/ping/1.0.0 selected via multistream-select
  • Pings: Sends 5 pings and validates positive RTT values are returned

How to Run

cd tests/interop/rust_libp2p
pytest -v -s --log-cli-level=INFO
Screenshot from 2026-01-19 19-51-20

Cute Animal Picture

image

@seetadev
Copy link
Contributor

@ItshMoh : Hi Mohan. Thanks for taking this on — this is a much-needed gap to fill, and the proposal looks solid 👍
Rust ↔ Python interop using Ping is a good starting point, and following the nim-libp2p interop structure is the right reference.

A few important pointers to help you align this correctly, especially since you’re new to the libp2p codebase:

📍 Where interop tests should live

Even though there’s a placeholder under py-libp2p/tests/interop/rust_libp2p, new interoperability tests should be implemented in:
👉 https://github.com/libp2p/test-plans

That repo is the canonical home for:

  • Cross-implementation interop tests (rust ↔ python, js ↔ python, etc.)
  • Shared orchestration logic
  • Long-term interop coverage tracked across stacks

Please follow the structure and conventions documented here:
https://github.com/libp2p/test-plans/tree/master/docs

📦 py-libp2p PR scope

PRs to py-libp2p → main should only be opened if:

  • You’re modifying core library behavior, or
  • You’re changing/adding shared utilities used by py-libp2p itself

Test plans and cross-stack validation logic should stay out of the core repo and live in test-plans.

🧭 On the approach

  • Using Ping for Rust ↔ Python interop is reasonable.
  • If, while implementing this, you discover a missing primitive or a bug in py-libp2p, then a focused PR to py-libp2p is totally appropriate.

🤝 Maintainers sync (important for new contributors)

Since you’re a new contributor, please try to join the libp2p maintainers meeting every Thursday.
It’s the fastest way to:

  • Validate interop test scope
  • Align with ongoing Rust / Go / JS interop work
  • Avoid duplicating effort and get quick feedback

Overall, this is a strong and well-motivated contribution. Once this is set up in test-plans following the docs, happy to review and help iterate. Keep going 🚀

CCing @sumanjeet0012 , @acul71 and @dhuseby

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.

Implement the rust-libp2p interop test

2 participants