Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(l1): fetch random peer + filter by supported capability #1536

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

fmoletta
Copy link
Contributor

Motivation
When choosing a peer for backend uses (such as syncing) we need to fetch a random peer and guarantee that its has an active connection and that it supports the capability needed

Description

  • Store supported capabilities in PeerData
  • Add a way to get a random filtered peer
  • Update get_peer function so that it fetches a random peer and also receives a capability that the selected peer must support

Follow-Up Work & Ideas
We could implement a PeerManager that holds a reference to the kademlia table and is in charge of selecting a suitable peer and performing the requests (instead of selecting a peer and calling a request_ method from the backend). This will allow us to further abstract p2p logic from other backend processes & also implement penalizations for peers returning invalid responses

Closes #1317 #1318

@fmoletta fmoletta marked this pull request as ready for review December 19, 2024 16:36
@fmoletta fmoletta requested a review from a team as a code owner December 19, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

L1: get a random peer from the kademlia table
1 participant