feat: add dynamic direct peer management#541
Open
lodekeeper wants to merge 3 commits intoChainSafe:masterfrom
Open
feat: add dynamic direct peer management#541lodekeeper wants to merge 3 commits intoChainSafe:masterfrom
lodekeeper wants to merge 3 commits intoChainSafe:masterfrom
Conversation
Add methods to add/remove direct peers at runtime without requiring restart: - addDirectPeer(peerId, addrs?): Add a peer to the direct peers set - removeDirectPeer(peerId): Remove a peer from the direct peers set - getDirectPeers(): Get list of current direct peer IDs Direct peers maintain permanent mesh connections without GRAFT/PRUNE negotiation. Previously they could only be configured at initialization via the directPeers option. This enables runtime management for: - Adding trusted peers discovered during operation - Removing misbehaving peers from the direct list - Hot-adding bootstrap peers without downtime Closes ChainSafe/lodestar#7559
- Add self-check to prevent adding self as direct peer - Make addresses required (needed for connection) - Return PeerIdStr | null instead of void - Add try/catch around peerStore.merge - Add to direct set only after addresses are stored
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.
Description
Add methods to dynamically manage direct peers at runtime, enabling applications to add/remove trusted peers without restarting.
New Methods
addDirectPeer(peerId: PeerId, addrs: Multiaddr[]): Promise<PeerIdStr | null>- Add a peer to the direct peers setremoveDirectPeer(peerId: PeerId | string): boolean- Remove a peer from direct peersgetDirectPeers(): PeerIdStr[]- Get current direct peer IDsBehavior
nullon failureMotivation
This aligns with the Lodestar implementation in ChainSafe/lodestar#8853, allowing runtime management of direct peers for:
Authored with AI assistance (Lodekeeper 🌟)