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:Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by:
Dmitry Markin <dmitry@markin.tech>
parent
e64b53c2
Showing
- substrate/client/network/src/protocol/notifications/tests/conformance.rs 1070 additions, 0 deletions...t/network/src/protocol/notifications/tests/conformance.rs
- substrate/client/network/src/protocol/notifications/tests/mod.rs 3 additions, 0 deletions...te/client/network/src/protocol/notifications/tests/mod.rs
This diff is collapsed.
Please register or sign in to comment