-
Notifications
You must be signed in to change notification settings - Fork 147
WIP: Ping interop in py-libp2p and rust-libp2p #620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@lla-dane : Hi Abhinav. Great progress. Wish to share that yamux has been merged today. Looking forward to an early resolution to CI/CD fixes. |
@lla-dane : Great progress. Please use yamux for interop tests now. This would resolve most of the CI/CD issues. Rust-libp2p has deprecated mplex and are using yamux. Yamux PR got merged yesterday by @pacrob. Please keep @acul71 and me in the loop as you share code commits using yamux as the multiplexer. |
Yes, sure. Stuck with a few errors right now, but will post an update soon!! |
What is happening currently is, after the security and muxer negotiation happens, the protocol negotiation fails. I will explain the case for py-dialer and rust-listener. Starting up py-dialer and rust-listener with the following commands: # ./interop/exec: py-dialer
transport=tcp ip=127.0.0.1 is_dialer=true redis_addr=6379 port=8001 test_timeout_seconds=180 security=noise muxer=yamux python3 native_ping.py
# ./rust-libp2p: rust-listener
RUST_LOG=debug redis_addr=localhost:6379 ip="0.0.0.0" transport=tcp security=noise muxer=yamux is_dialer="false" cargo run --bin native_ping py-dialer logsLogs2025-05-24 22:59:05.534 | INFO | interop.lib:run_test:69 - Starting run_test
2025-05-24 22:59:05.736 | INFO | interop.lib:run_test:75 - Running ping test local_peer=QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf
2025-05-24 22:59:05.743 | INFO | interop.lib:run_test:126 - GETTING READY FOR CONNECTION
2025-05-24 22:59:05.743 | DEBUG | libp2p.network.swarm:dial_peer:139 - attempting to dial peer %s
2025-05-24 22:59:05.743 | INFO | libp2p.network.swarm:dial_peer:155 - HANDSHAKE GOING TO HAPPEN
2025-05-24 22:59:05.744 | DEBUG | libp2p.network.swarm:dial_addr:191 - dialed peer %s over base transport
2025-05-24 22:59:05.744 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:70 - TRYING TO GET THE HANDSHAKE HAPPENED
2025-05-24 22:59:05.744 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:46 - WROTE SUC, /multistream/1.0.0
2025-05-24 22:59:05.747 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:49 - READ SUC, /multistream/1.0.0
2025-05-24 22:59:05.748 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:72 - HANDSHAKE HAPPENED
2025-05-24 22:59:05.748 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:75 - /noise
2025-05-24 22:59:05.748 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:101 - /noise
2025-05-24 22:59:05.748 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:107 - Response:
2025-05-24 22:59:05.757 | DEBUG | libp2p.network.swarm:dial_addr:204 - upgraded security for peer %s
2025-05-24 22:59:05.757 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:70 - TRYING TO GET THE HANDSHAKE HAPPENED
2025-05-24 22:59:05.757 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:46 - WROTE SUC, /multistream/1.0.0
2025-05-24 22:59:05.759 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:49 - READ SUC, /multistream/1.0.0
2025-05-24 22:59:05.759 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:72 - HANDSHAKE HAPPENED
2025-05-24 22:59:05.759 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:75 - /yamux/1.0.0
2025-05-24 22:59:05.759 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:101 - /yamux/1.0.0
2025-05-24 22:59:05.759 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:107 - Response:
2025-05-24 22:59:05.759 | DEBUG | libp2p.network.swarm:dial_addr:213 - upgraded mux for peer %s
2025-05-24 22:59:05.760 | DEBUG | libp2p.network.swarm:dial_addr:217 - successfully dialed peer %s
2025-05-24 22:59:05.760 | INFO | interop.lib:run_test:128 - HOST CONNECTED
2025-05-24 22:59:05.760 | DEBUG | libp2p.network.swarm:new_stream:227 - attempting to open a stream to peer %s
2025-05-24 22:59:05.760 | INFO | libp2p.network.swarm:dial_peer:134 - WE ARE RETURNING, PEER ALREADAY EXISTS
2025-05-24 22:59:05.760 | INFO | libp2p.network.swarm:new_stream:230 - INETCONN CREATED
2025-05-24 22:59:05.760 | INFO | libp2p.network.swarm:new_stream:233 - INETSTREAM CREATED
2025-05-24 22:59:05.760 | DEBUG | libp2p.network.swarm:new_stream:235 - successfully opened a stream to peer %s
2025-05-24 22:59:05.760 | INFO | libp2p.host.basic_host:new_stream:186 - INETSTREAM CHECKING IN
2025-05-24 22:59:05.760 | INFO | libp2p.host.basic_host:new_stream:187 - ['/ipfs/ping/1.0.0']
2025-05-24 22:59:05.760 | DEBUG | libp2p.host.basic_host:new_stream:190 - PROTOCOLS TRYING TO GET SENT
2025-05-24 22:59:05.760 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:70 - TRYING TO GET THE HANDSHAKE HAPPENED
2025-05-24 22:59:05.760 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:46 - WROTE SUC, /multistream/1.0.0
2025-05-24 22:59:05.762 | DEBUG | libp2p.host.basic_host:_swarm_stream_handler:237 - failed to accept a stream from peer %s, error=%s
2025-05-24 22:59:05.762 | ERROR | libp2p.protocol_muxer.multiselect_client:handshake:51 - READ FAIL, fail to read from multiselect communicator
2025-05-24 22:59:05.762 | DEBUG | libp2p.host.basic_host:new_stream:196 - fail to open a stream to peer %s, error=%s rust-listener logsLogs2025-05-24T17:29:03.063081Z INFO libp2p_swarm: local_peer_id=12D3KooWBjkD7G113HB1RgaU36kRYWsfqQKXKuKT23cBas1W3DYZ
2025-05-24T17:29:03.063232Z INFO interop_tests: Running ping test local_peer=12D3KooWBjkD7G113HB1RgaU36kRYWsfqQKXKuKT23cBas1W3DYZ
2025-05-24T17:29:03.063387Z DEBUG libp2p_tcp: listening on 0.0.0.0:0
2025-05-24T17:29:03.065175Z INFO interop_tests: Test instance, listening for incoming connections on address address=/ip4/0.0.0.0/tcp/0
2025-05-24T17:29:03.076315Z DEBUG Swarm::poll: libp2p_tcp: New listen address address=/ip4/127.0.0.1/tcp/40449
2025-05-24T17:29:03.076491Z DEBUG Swarm::poll: libp2p_swarm: New listener address listener=ListenerId(1) address=/ip4/127.0.0.1/tcp/40449
2025-05-24T17:29:03.076796Z DEBUG Swarm::poll: libp2p_tcp: New listen address address=/ip4/192.168.31.130/tcp/40449
2025-05-24T17:29:03.076880Z DEBUG Swarm::poll: libp2p_swarm: New listener address listener=ListenerId(1) address=/ip4/192.168.31.130/tcp/40449
2025-05-24T17:29:03.111888Z DEBUG Swarm::poll: libp2p_tcp: New listen address address=/ip4/172.19.0.1/tcp/40449
2025-05-24T17:29:03.111976Z DEBUG Swarm::poll: libp2p_swarm: New listener address listener=ListenerId(1) address=/ip4/172.19.0.1/tcp/40449
2025-05-24T17:29:03.112045Z DEBUG interop_tests: NewListenAddr { listener_id: ListenerId(1), address: /ip4/172.19.0.1/tcp/40449 }
2025-05-24T17:29:03.112124Z DEBUG Swarm::poll: libp2p_tcp: New listen address address=/ip4/172.17.0.1/tcp/40449
2025-05-24T17:29:03.112171Z DEBUG Swarm::poll: libp2p_swarm: New listener address listener=ListenerId(1) address=/ip4/172.17.0.1/tcp/40449
2025-05-24T17:29:03.112218Z DEBUG interop_tests: NewListenAddr { listener_id: ListenerId(1), address: /ip4/172.17.0.1/tcp/40449 }
2025-05-24T17:29:03.112303Z DEBUG Swarm::poll: libp2p_tcp: New listen address address=/ip4/172.18.0.1/tcp/40449
2025-05-24T17:29:03.112351Z DEBUG Swarm::poll: libp2p_swarm: New listener address listener=ListenerId(1) address=/ip4/172.18.0.1/tcp/40449
2025-05-24T17:29:03.112401Z DEBUG interop_tests: NewListenAddr { listener_id: ListenerId(1), address: /ip4/172.18.0.1/tcp/40449 }
2025-05-24T17:29:05.744517Z DEBUG Swarm::poll: libp2p_tcp: Incoming connection from remote at local remote_address=/ip4/192.168.31.130/tcp/33746 local_address=/ip4/192.168.31.130/tcp/40449
2025-05-24T17:29:05.745833Z DEBUG interop_tests: IncomingConnection { connection_id: ConnectionId(1), local_addr: /ip4/192.168.31.130/tcp/40449, send_back_addr: /ip4/192.168.31.130/tcp/33746 }
2025-05-24T17:29:05.748791Z DEBUG new_incoming_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1}: multistream_select::listener_select: Listener: confirming protocol protocol=/noise
2025-05-24T17:29:05.748877Z DEBUG new_incoming_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1}: multistream_select::listener_select: Listener: sent confirmed protocol protocol=/noise
2025-05-24T17:29:05.759486Z DEBUG new_incoming_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1}: multistream_select::listener_select: Listener: confirming protocol protocol=/yamux/1.0.0
2025-05-24T17:29:05.759564Z DEBUG new_incoming_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1}: multistream_select::listener_select: Listener: sent confirmed protocol protocol=/yamux/1.0.0
2025-05-24T17:29:05.759922Z DEBUG new_incoming_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1}: yamux::connection: new connection: bdb5a808 (Server)
2025-05-24T17:29:05.760482Z DEBUG Swarm::poll: libp2p_swarm: Connection established peer=QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf endpoint=Listener { local_addr: /ip4/192.168.31.130/tcp/40449, send_back_addr: /ip4/192.168.31.130/tcp/33746 } total_peers=1
2025-05-24T17:29:05.760548Z DEBUG interop_tests: ConnectionEstablished { peer_id: PeerId("QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf"), connection_id: ConnectionId(1), endpoint: Listener { local_addr: /ip4/192.168.31.130/tcp/40449, send_back_addr: /ip4/192.168.31.130/tcp/33746 }, num_established: 1, concurrent_dial_errors: None, established_in: 14.499266ms }
2025-05-24T17:29:05.760591Z DEBUG new_established_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1 peer=QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf}:Connection::poll: yamux::connection::rtt: sending ping 3065193300
2025-05-24T17:29:05.761599Z DEBUG new_established_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1 peer=QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf}:Connection::poll: yamux::connection: bdb5a808: new outbound (Stream bdb5a808/2) of (Connection bdb5a808 Server (streams 1))
2025-05-24T17:29:05.761880Z DEBUG new_established_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1 peer=QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf}:Connection::poll: multistream_select::dialer_select: Dialer: Proposed protocol protocol=/ipfs/ping/1.0.0
2025-05-24T17:29:05.762018Z DEBUG new_established_connection{remote_addr=/ip4/192.168.31.130/tcp/33746 id=1 peer=QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf}:Connection::poll: yamux::connection::rtt: received pong 3065193300, estimated round-trip-time 1.428048ms
2025-05-24T17:29:05.762630Z DEBUG Swarm::poll: libp2p_swarm: Connection closed with error IO(Custom { kind: Other, error: Error(Right(Decode(Io(Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" })))) }): Connected { endpoint: Listener { local_addr: /ip4/192.168.31.130/tcp/40449, send_back_addr: /ip4/192.168.31.130/tcp/33746 }, peer_id: PeerId("QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf") } total_peers=0
2025-05-24T17:29:05.762710Z DEBUG interop_tests: ConnectionClosed { peer_id: PeerId("QmYG1F2byD3M4eRs2E46k32NseJffaQxj85GAnFkHRAvrf"), connection_id: ConnectionId(1), endpoint: Listener { local_addr: /ip4/192.168.31.130/tcp/40449, send_back_addr: /ip4/192.168.31.130/tcp/33746 }, num_established: 0, cause: Some(IO(Custom { kind: Other, error: Error(Right(Decode(Io(Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" })))) })) } So what's happening is:
So I can't figure out why this is happening, what I am missing. @acul71 @paschal533 . |
Hey @lla-dane, thanks for the detailed breakdown and logs. It looks like the Noise and Yamux negotiations are working fine, but the protocol negotiation for Debug Multistream-Select:
This should show if the Rust side is responding correctly or resetting the stream. Also, can you check the libp2p.protocol_muxer.multiselect_client.handshake function in Python to see if it’s reading the response correctly? Maybe add some debug prints like:
Could you share the updated Rust and Python logs after trying these? Also, let’s keep @acul71 and @seetadev in the loop for any new commits. If you’re still stuck, I can help test this locally with the same setup. Thanks for driving this forward |
Hi @lla-dane , @acul71, @seetadev , Just a quick update on the ping example in I’m actively working on updating Next Steps:
I’ll post another update with logs once I get Noise working. Please let me know if you have any tips on the |
@paschal533: This error is coming on this branch: https://github.com/lla-dane/py-libp2p/tree/interop/py-rust. And I am running the py-dialer using the below command in transport=tcp ip=127.0.0.1 is_dialer=true redis_addr=6379 port=8001 test_timeout_seconds=180 security=noise muxer=yamux python3 native_ping.py |
interop/arch.py
Outdated
key_pair, noise_privkey=noise_key_pair.private_key | ||
) | ||
}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve confirmed that the current version uses Plaintext as the security protocol since it calls new_host() without a custom sec_opt configuration. This means it’s not yet aligned with rust-libp2p’s default Noise protocol for our interop tests.
@paschal533: As you can see here, in the ./interop/arch.py
the new_host
function builds the hosts as per the specs specified in the initiation command, and its not running on plaintext as sec-protocol as default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I wasn't refering to this PR. I was refering to py-libp2p/examples/ping/ping.py
. py-libp2p/examples/ping/ping.py
is running on plaintext as sec-protocol.
These are the logs of a successful handshake between two py-nodes. Logs(venv) shelby@soiarch ~/Desktop/libp2p/py-libp2p/interop/exec ❯ transport=tcp ip=127.0.0.1 is_dialer=true redis_addr=6379 port=8001 test_timeout_seconds=180 security=noise muxer=yamux python3 native_ping.py
2025-05-25 17:42:49.665 | INFO | interop.lib:run_test:69 - Starting run_test
2025-05-25 17:42:50.712 | INFO | interop.lib:run_test:75 - Running ping test local_peer=QmbzWn9Xp4Xzwa4kpQWghc1SMJfUoYRfc7dB2v79anX8Ta
2025-05-25 17:42:50.725 | INFO | interop.lib:run_test:126 - GETTING READY FOR CONNECTION
2025-05-25 17:42:50.725 | DEBUG | libp2p.network.swarm:dial_peer:139 - attempting to dial peer %s
2025-05-25 17:42:50.725 | INFO | libp2p.network.swarm:dial_peer:155 - HANDSHAKE GOING TO HAPPEN
2025-05-25 17:42:50.726 | DEBUG | libp2p.network.swarm:dial_addr:191 - dialed peer %s over base transport
2025-05-25 17:42:50.726 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:70 - TRYING TO GET THE HANDSHAKE HAPPENED
2025-05-25 17:42:50.726 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:46 - WROTE SUC, /multistream/1.0.0
2025-05-25 17:42:50.726 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:49 - READ SUC, /multistream/1.0.0
2025-05-25 17:42:50.726 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:72 - HANDSHAKE HAPPENED
2025-05-25 17:42:50.726 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:75 - /noise
2025-05-25 17:42:50.726 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:101 - /noise
2025-05-25 17:42:50.727 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:107 - Response:
2025-05-25 17:42:50.771 | DEBUG | libp2p.network.swarm:dial_addr:204 - upgraded security for peer %s
2025-05-25 17:42:50.771 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:70 - TRYING TO GET THE HANDSHAKE HAPPENED
2025-05-25 17:42:50.771 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:46 - WROTE SUC, /multistream/1.0.0
2025-05-25 17:42:50.797 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:49 - READ SUC, /multistream/1.0.0
2025-05-25 17:42:50.797 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:72 - HANDSHAKE HAPPENED
2025-05-25 17:42:50.797 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:75 - /yamux/1.0.0
2025-05-25 17:42:50.798 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:101 - /yamux/1.0.0
2025-05-25 17:42:50.798 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:107 - Response:
2025-05-25 17:42:50.799 | DEBUG | libp2p.network.swarm:dial_addr:213 - upgraded mux for peer %s
2025-05-25 17:42:50.799 | DEBUG | libp2p.network.swarm:dial_addr:217 - successfully dialed peer %s
2025-05-25 17:42:50.800 | INFO | interop.lib:run_test:128 - HOST CONNECTED
2025-05-25 17:42:50.800 | DEBUG | libp2p.network.swarm:new_stream:227 - attempting to open a stream to peer %s
2025-05-25 17:42:50.800 | INFO | libp2p.network.swarm:dial_peer:134 - WE ARE RETURNING, PEER ALREADAY EXISTS
2025-05-25 17:42:50.800 | INFO | libp2p.network.swarm:new_stream:230 - INETCONN CREATED
2025-05-25 17:42:50.800 | INFO | libp2p.network.swarm:new_stream:233 - INETSTREAM CREATED
2025-05-25 17:42:50.800 | DEBUG | libp2p.network.swarm:new_stream:235 - successfully opened a stream to peer %s
2025-05-25 17:42:50.800 | INFO | libp2p.host.basic_host:new_stream:186 - INETSTREAM CHECKING IN
2025-05-25 17:42:50.800 | INFO | libp2p.host.basic_host:new_stream:187 - ['/ipfs/ping/1.0.0']
2025-05-25 17:42:50.801 | DEBUG | libp2p.host.basic_host:new_stream:190 - PROTOCOLS TRYING TO GET SENT
2025-05-25 17:42:50.801 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:70 - TRYING TO GET THE HANDSHAKE HAPPENED
2025-05-25 17:42:50.801 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:46 - WROTE SUC, /multistream/1.0.0
2025-05-25 17:42:50.802 | INFO | libp2p.protocol_muxer.multiselect_client:handshake:49 - READ SUC, /multistream/1.0.0
2025-05-25 17:42:50.802 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:72 - HANDSHAKE HAPPENED
2025-05-25 17:42:50.802 | INFO | libp2p.protocol_muxer.multiselect_client:select_one_of:75 - /ipfs/ping/1.0.0
2025-05-25 17:42:50.802 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:101 - /ipfs/ping/1.0.0
2025-05-25 17:42:50.804 | INFO | libp2p.protocol_muxer.multiselect_client:try_select:107 - Response:
2025-05-25 17:42:50.804 | INFO | libp2p.host.basic_host:new_stream:194 - PROTOCOLS GOT SENT
2025-05-25 17:42:50.804 | INFO | interop.lib:run_test:133 - CREATED NEW STREAM
2025-05-25 17:42:50.804 | INFO | interop.lib:run_test:136 - Remote conection established
2025-05-25 17:42:50.804 | INFO | interop.lib:run_test:142 - handshake time: 79.69ms
sending ping to QmUVzokJA5siraZSfFD8YXHUaR8GjzSitGcT1eP3snkshb
received pong from QmUVzokJA5siraZSfFD8YXHUaR8GjzSitGcT1eP3snkshb Between rust and py, its failing around this part: |
@lla-dane and @paschal533 : Appreciate your contribution. Do we need help from rust-maintainers here (Elena and Joao). We have a community call tomorrow and can discuss on this specific pull request. Also, touch base with @acul71 on this effort. He is about to start the js-libp2p inteop effort in the coming days. |
Hi @lla-dane I've been digging into the py-libp2p and rust-libp2p interoperability issues, and I think I've found the root cause. The problem seems to be with py-libp2p's incomplete Noise implementation. It's preventing successful connections between the two implementations. I discovered that py-libp2p's Noise is currently using X25519 keys, while rust-libp2p expects Ed25519 keys for the identity verification part of the handshake. When I tried to modify py-libp2p to use Ed25519 keys, it gets further in the process but then fails because of the incomplete implementation. What's happening:
This suggests there's a mismatch in how the keys are being encoded/serialized during the Noise handshake. I want to discuss this with @seetadev and @acul71... thinking of taking on the task of completing the Noise implementation in py-libp2p. |
@paschal533 : Great, this is great. Thanks for finding this out. |
Hi @acul71, After further investigation, I discovered that both implementations should be using X25519 for the Noise Diffie-Hellman key exchange. That part is actually correct. The issue appears to be with key encoding/serialization compatibility during the handshake process. py-libp2p generates keys that should be compatible, but there's an encoding mismatch The real issue is a mismatch in how the keys (possibly identity keys used alongside the Noise handshake) are being encoded/serialized between the two implementations. The py-libp2p Noise implementation may be incomplete in how it handles key formatting or the integration between Noise protocol keys and libp2p identity verification. |
Hi @lla-dane, @seetadev, @acul71 So I made some modifications to The real issue isn't about X25519 vs Ed25519 keys - both implementations are actually using X25519 correctly for the Noise protocol. The problem is much more specific, py-libp2p's Noise code is trying to call What this means:
On the rust side:
This is actually encouraging because it means py-libp2p's Noise implementation is mostly there. It just needs the proper API methods implemented. It's more of a "finish the implementation" problem rather than a "rewrite everything" problem. I think this should be pretty straightforward to fix. currently working on fixing it. |
@paschal533 |
setup.py
Outdated
@@ -37,10 +37,14 @@ | |||
"pytest-trio>=0.5.2", | |||
"factory-boy>=2.12.0,<3.0.0", | |||
], | |||
"interop": ["redis==6.1.0", "logging==0.4.9.6" "loguru==0.7.3"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed comma here is causing it to fail building
varun-r-mallya#2 |
Hey @varun-r-mallya , thanks for taking an interest in this PR. Actually there was a noise encryption incompatibility with the rust-libp2p ping interop example. As you can see from the above conversations, there was a stream rejection issue withthe rust node, so @paschal533 worked on this and created a test plan in #532 for ping example with appropriate adoption of noise and yamux upgrades. He has been working on creating an appropriate test plan for the ping-interop, for new contributors to work on. |
Can I please have the test plan and know exactly what to continue work on so I can contribute to this effort ? |
So firstly, we have to test out the ping example in #532 appropriately with rust node locally. It was throwing an error at my end, so @paschal533 said he would be documenting on how he ran the py and rust nodes appropriately, as we have to do some tweaks on the rust side also. So after that's done locally, then we just have to integrate the noise and yamux updates in this PR's |
@varun-r-mallya and @lla-dane : Great progress. Please study in details: https://github.com/libp2p/test-plans Ping is a part of the interop suite. We will follow it up wth interop focused on hole punching, transport interop (webrtc, quic, websockets) followed by gossipsub interop :) @mystical-prog and @paschal533 will help you in this specific project related to interop with rust-libp2p with focus on ping protocol. |
@paschal533 : Wish to share that we discussed internally with the rust-libp2p team. Kindly don't close interop pull requests before the interop scripts land up in the test plans repository. |
@lla-dane and @varun-r-mallya : CI/CD tests are failing. Kindly resolve the issues. Please keep in touch with Elena from rust-libp2p team for helping this land up in the test plans repository. @paschal533 : Please add your notes/feedback here in this pull request. This has been shared with the rust-libp2p team. |
@paschal533 : Ran the ping examples from #664. The py-listener logs look like this: Is this the farthest that is possible at present ? |
@seetadev : Sir actually @paschal533 mentioned in #664 that the Ping protocol has been blocked by Yamux frame parsing issues, which is under investigation. Till then the ping test in #664 is the farthest that we have arrived, and will do the same thing here in the interop tests. |
Yes, this is the farthest that is possible at the present. |
Okay then I will reflect these changes in this PR |
I did see why the CI CD errors were happening and I have fixed them on my branch. They are very trivial and can be fixed when we have local tests passing. It would not be nice to add an extra logging library to the actual dependencies (loguru is used here I think), so the tests will pass once we remove these unnecessary dependencies. @seetadev |
Alright manu, I will the notes/feedback here as soon as possible. |
fda82ff
to
f2dbd4a
Compare
Description
This is a work-progress pull request for establishing interoperability between
py-libp2p
andrust-libp2p
.Changes
The directory structure is similar to
./interop-tests
inrust-libp2p
.interop/exec/native_ping.py
interop/exec/config
: env variables for ping testinterop/arch.py
:RedisClient
andSwarmBuilder
utilitiesinterop/lib.py
:handle_ping
,send_ping
andrun_test
(SwarmRunner) utilitiesCurrent Status
Ping test is successful for 2
py-libp2p
nodes withinsecure, secio
andmplex
.Logs
Listener
Dialer
Next Steps
Extend the support for
Noise
andYamux
, to test interoperability withrust-libp2p
.@seetadev