Skip to content

Conversation

@algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Jul 23, 2025

Summary

This PR contains the following changes:

  1. Updated hybridRelayMeshCreator for relays: use WS as a primary source of peers and fallback to p2p nodes
  2. Vetting non-dialNode outgoing connects (such as made by pubsub to peers learned from PX).
  3. libp2p-pubsub default D values adjusted according to GossipFanout
  4. Fixes to flaky unit tests (set DNSBootstrapID = "") most likely caused to non-existing DNS records lookup timeout - if it takes longer than Eventually timeout for connectivity assertions tests fail.
  5. addressData -> psmdkAddressData variable rename to standardize with other keys by using psmdk prefix.

Related: #6045

Test Plan

Added unit tests
Performance cluster tests summary: 8k TPS (as expected for hybrid), 7+1 or 6+2 (ws+p2p) outgoing connections (as expected as well).

@codecov
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

❌ Patch coverage is 79.64602% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.00%. Comparing base (00063c8) to head (5c46204).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
network/p2p/p2p.go 0.00% 19 Missing ⚠️
network/p2pNetwork.go 75.55% 9 Missing and 2 partials ⚠️
network/connPerfMon.go 89.47% 3 Missing and 3 partials ⚠️
network/p2p/peerstore/peerstore.go 77.27% 5 Missing ⚠️
network/p2p/pubsub.go 75.00% 3 Missing ⚠️
network/p2p/streams.go 77.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6391      +/-   ##
==========================================
- Coverage   47.05%   47.00%   -0.05%     
==========================================
  Files         667      660       -7     
  Lines       88831    88852      +21     
==========================================
- Hits        41798    41766      -32     
- Misses      44290    44325      +35     
- Partials     2743     2761      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@algorandskiy algorandskiy added the p2p Work related to the p2p project label Jul 25, 2025
@algorandskiy algorandskiy force-pushed the pavel/ws-relays-p2p-backup branch from 127b66b to 4f7a7ca Compare August 15, 2025 19:48
@algorandskiy algorandskiy changed the title WIP: network: wsnet with p2p backup meshing strategy network: wsnet with p2p backup meshing strategy Aug 15, 2025
@algorandskiy algorandskiy requested review from cce and jannotti August 15, 2025 19:52
libp2p pubsub can connect to PX streams so that we could end up with
more than GossipFanout outgoing peers.
This PR marks explicitly dialed peers using peerstore metadata
so that each connection can be checked and vetted
@algorandskiy algorandskiy force-pushed the pavel/ws-relays-p2p-backup branch from 4f7a7ca to dd1293d Compare August 19, 2025 17:58
@algorandskiy algorandskiy marked this pull request as ready for review August 25, 2025 16:21
@algorandskiy algorandskiy requested a review from gmalouf August 25, 2025 16:21
@algorandskiy algorandskiy force-pushed the pavel/ws-relays-p2p-backup branch from c47fd05 to 7187dfe Compare August 25, 2025 22:29
@cce cce requested a review from Copilot September 11, 2025 13:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a WS-network-with-P2P-backup meshing strategy for hybrid topology networks, along with various network improvements and test fixes.

  • Updated hybrid relay mesh creator to prioritize WebSocket connections and use P2P as backup to reach target connection counts
  • Added validation for non-dialed outgoing P2P connections to prevent interference from sub-components like pubsub
  • Updated libp2p-pubsub parameters to align with GossipFanout configuration

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
network/mesh.go Implements hybrid WS-priority meshing strategy with P2P backup and updates mesh function signatures
network/wsNetwork.go Updates mesh functions to accept target connection count parameter and pass it through
network/p2pNetwork.go Updates P2P mesh functions and adds dialed peer tracking functionality
network/p2p/streams.go Adds validation to ignore non-dialed outgoing connections in stream manager
network/p2p/pubsub.go Derives GossipSub parameters based on GossipFanout configuration
network/p2p/peerstore/peerstore.go Renames addressData key constant to use standardized psmdk prefix
*_test.go files Adds test coverage and fixes flaky tests by setting DNSBootstrapID = ""

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@cce
Copy link
Contributor

cce commented Oct 16, 2025

for posterity, reading this PR #668 helps you understand the motivation behind the code that is being made more generic here

@algorandskiy algorandskiy requested a review from cce October 17, 2025 13:05
@gmalouf gmalouf requested review from cce and gmalouf October 24, 2025 14:33
Copy link
Contributor

@cce cce left a comment

Choose a reason for hiding this comment

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

LGTM! Curious how well the mesher can manage connections between ws / p2p when in hybrid mode over these coarse-grained check intervals

@algorandskiy algorandskiy merged commit 8e6354c into algorand:master Oct 28, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement p2p Work related to the p2p project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants