[Refactor] Tighten up high-level connection/peer handling#3713
[Refactor] Tighten up high-level connection/peer handling#3713vicsn merged 3 commits intoProvableHQ:stagingfrom
Conversation
|
EDIT: Nevermind, still adding more clients to prerelease tests so it more accurately reflects the load. |
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
d61b6ad to
0758688
Compare
|
Connections on a 40 validator 80 client network look healthy. The visible drops to 0 connections are due to expected restarts. Can you evaluate if the logs look good to you too @ljedrz ? |
kaimast
left a comment
There was a problem hiding this comment.
These changes are exciting as they improve the code quality and maintainability a lot.
I left a few comments, and we can hopefully get this merged soon :)
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
|
@vicsn The logs look ok to me 👍. |
|
The CI failure is unrelated: |
|
I had the audit issue too. |
kaimast
left a comment
There was a problem hiding this comment.
This should be good to merge now 🥳

We currently have several high-level connection/peer-related collections, which provides us with a good overview when reading the objects, but isn't without potential issues: it involves multiple lock operations whenever a peer is added or removed, which can easily lead to race conditions.
This PR is an attempt to get rid of these issues altogether by collapsing several collections of simple items in favor of a single collection of more complex ones. The basic summary of the changes is this:
A short summary of the other changes involved:
Peerbecomes anenumwith 3 possible variants:Candidate,Connecting, andConnectedPeeris no longerClone(to avoid any possibility of unintentional duplication)CandidatePeerandConnectedPeer, are isolated for added type safetyResolveris only ever modified indirectly, through thePeerResolverno longer needs to map from the listener address to the connected address (thepeer_poolcan do it)I tried to limit the scope of the logic changes to minimum, and confirmed that they are working by running all the tests locally, plus the devnet script.
Fixes #3705.