Skip to content
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

network/tests: Add conformance testing for litep2p and libp2p #7361

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Jan 28, 2025

This PR implements conformance tests between our network backends (litep2p and libp2p).

The PR creates a setup for extending testing in the future, while implementing the following tests:

  • connectivity check: Connect litep2p -> libp2p and libp2p -> litep2p
  • request response check: Send 32 requests from one backend to the other
  • notification check: Send 128 ping pong notifications and 128 from one backend to the other

cc @paritytech/networking

lexnv added 7 commits January 28, 2025 14:34
connectivity

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv added R0-silent Changes should not be mentioned in any release notes T10-tests This PR/Issue is related to tests. labels Jan 28, 2025
@lexnv lexnv self-assigned this Jan 28, 2025
Comment on lines 210 to 217
NotificationEvent::NotificationReceived { .. } => {
received += 1;
if received >= ping_pong_num {
break;
}

notifications_left.send_async_notification(&right_peer_id, vec![1, 2, 3]).await.unwrap();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dq: Why is this part of connect_notifications and not of a higher level test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I'll revert this and await 1 notification before handing this to the tests 🙏

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to await any notifications here at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to not repeat the awaiting on listen addresses, add_reserved_peer and accepting substreams via: NotificationEvent::NotificationStreamOpened and NotificationEvent::ValidateInboundSubstream in other tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, understand — I mean why we need to send notification / handle NotificationEvent::NotificationReceived in the setup code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T10-tests This PR/Issue is related to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants