Skip to content
Snippets Groups Projects
Unverified Commit e3e3f481 authored by Alexandru Vasile's avatar Alexandru Vasile Committed by GitHub
Browse files

notifications/tests: Check compatiblity between litep2p and libp2p (#7484)


This PR ensures compatibility in terms of expectations between the
libp2p and litep2p network backends at the notification protocol level.

The libp2p node is tested with the `Notification` behavior that contains
the protocol controller, while litep2p is tested at the lowest level API
(without substrate shim layers).

## Notification Behavior

(I) Libp2p protocol controller will eagerly reopen a closed substream,
even if it is the one that closed it:
- When a node (libp2p or litep2p) closes the substream with **libp2p**,
the **libp2p** controller will reopen the substream
- When **libp2p** closes the substream with a node (either litep2p with
no controller or libp2p), the **libp2p** controller will reopen the
substream
- However in this case, libp2p was the one closing the substream
signaling it is no longer interested in communicating with the other
side

(II) Notifications are lost and not reported to the higher level in the
following scenario:
- T0: Node A opens a substream with Node B
- T1: Node A closes the substream or the connection with Node B
- T2: Node B sends a notification to Node A => *notification is lost*
and never reported
- T3: Node B detects the closed substream or connection


## Testing

This PR effectively checks:
- connectivity at the notification level
- litep2p rejecting libp2p substream and keep-alive mechanism
functionality
- libp2p disconnecting libp2p and connection re-establishment (and all
the other permutations)
- idling of connections with active substreams and keep-alive mechanism
is not enforced


Prior work:
- https://github.com/paritytech/polkadot-sdk/pull/7361

cc @paritytech/networking

---------

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: default avatarDmitry Markin <dmitry@markin.tech>
parent e64b53c2
No related merge requests found
Pipeline #517238 waiting for manual action with stages
in 1 hour, 20 minutes, and 37 seconds
This diff is collapsed.
......@@ -49,6 +49,9 @@ use std::{
time::Duration,
};
#[cfg(test)]
mod conformance;
/// Builds two nodes that have each other as bootstrap nodes.
/// This is to be used only for testing, and a panic will happen if something goes wrong.
fn build_nodes() -> (Swarm<CustomProtoWithAddr>, Swarm<CustomProtoWithAddr>) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment