[Fix] Prune old validator candidates#4317
Merged
Merged
Conversation
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves peer pool hygiene by tracking a candidate peer’s last known Aleo address and using it during handshake to prune outdated validator candidate entries, reducing repeated reconnect attempts to stale IPs (related to #4228).
Changes:
- Extend
CandidatePeerto includelast_known_aleo_addr(carried over when a peer is downgraded from Connected → Candidate). - Prune outdated candidate entries during
Gatewayhandshake when the same Aleo address is observed from a different listening address. - Small drive-bys: fix “Reconnnecting” log typo and move
peering.rstests to the end of the module.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| node/router/src/heartbeat.rs | Updates connection helper signature to use the now-generic CandidatePeer<N>. |
| node/network/src/peering.rs | Adjusts candidate-peer getters for CandidatePeer<N> and relocates the tests block. |
| node/network/src/peer.rs | Makes CandidatePeer network-generic and adds last_known_aleo_addr, populated on downgrade. |
| node/bft/src/gateway.rs | Fixes reconnect log typo and prunes outdated candidate entries during handshake using last_known_aleo_addr. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vicsn
approved these changes
Jun 16, 2026
Collaborator
|
FYI I didn't merge due to the open copilot comments |
Collaborator
Author
|
@vicsn I replied to the leftover comments, feel free to proceed with merging if you agree. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR extends the
CandidatePeerwith the last known Aleo address field, which is then used to prune the peer pool of outdated validator entries during the handshake, so that we don't attempt to reconnect to them again.Small drive-bys:
Reconnnectingspelling error in a log (which may be an annoyance in debugging)Supersedes #4229.
Fixes #4228.