Skip to content

Conversation

@algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Jul 2, 2025

Summary

This PR refactors meshing code by generalizing and moving meshThread code into a new mesh.go source file and introducing a new mesher abstraction.

By using this abstraction it is now possible to play with mesh creation logic for hybrid network. For example, this PR adds a new hybridRelayMesh that does not run p2p part meshing and just uses ws net meshing.

Additionally this PR changes NewWebsocketNetwork / NewP2PNetwork constructors by introducing GenesisInfo in order to keep a number of parameters manageable.

Test Plan

  1. Existing unit tests to confirm the refactoring is OK
  2. Added a new unit test to make sure the hybridRelayMesh works as designed

@codecov
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

Attention: Patch coverage is 75.94502% with 70 lines in your changes missing coverage. Please review.

Project coverage is 47.81%. Comparing base (c0c0235) to head (5fefef4).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
network/mesh.go 77.93% 23 Missing and 9 partials ⚠️
network/p2pNetwork.go 59.09% 16 Missing and 2 partials ⚠️
network/wsNetwork.go 77.19% 8 Missing and 5 partials ⚠️
network/hybridNetwork.go 78.12% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6374      +/-   ##
==========================================
- Coverage   50.63%   47.81%   -2.82%     
==========================================
  Files         660      654       -6     
  Lines      110513   110584      +71     
==========================================
- Hits        55953    52875    -3078     
- Misses      51704    54689    +2985     
- Partials     2856     3020     +164     

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

@algorandskiy algorandskiy changed the title WIP: network: refactor networking mesh maintaining code network: refactor networking mesh maintaining code Jul 7, 2025
@algorandskiy algorandskiy marked this pull request as ready for review July 7, 2025 14:45

This comment was marked as outdated.

Copy link
Contributor

@gmalouf gmalouf left a comment

Choose a reason for hiding this comment

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

Looks good so far, left a few comments/questions.

@algorandskiy
Copy link
Contributor Author

I rewrote the hybrid strategy initialization as suggested, no ugly dummyCreator anymore so it looks cleaner.

@algorandskiy algorandskiy requested review from gmalouf and jannotti July 16, 2025 20:46
gmalouf
gmalouf previously approved these changes Jul 17, 2025
gmalouf
gmalouf previously approved these changes Jul 18, 2025
@algorandskiy
Copy link
Contributor Author

Pushed more CR fixes

@algorandskiy algorandskiy merged commit 36a83dd into algorand:master Jul 18, 2025
32 checks passed
@algorandskiy algorandskiy added the p2p Work related to the p2p project label Jul 25, 2025
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