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: Persist peers to disk such that nodes can bootstrap from previously seen peers #1851

Closed
Wondertan opened this issue Mar 1, 2023 · 1 comment · Fixed by #2507
Closed
Assignees
Labels
area:p2p priority:high High priority issue to be prioritized for the current/following sprint

Comments

@Wondertan
Copy link
Member

Wondertan commented Mar 1, 2023

All our infrastructure is based around bootstrappers, and each time a node starts; it connects to them and only to them. We do not save any information about other discovered peers during runtime on disk.

This is a choke point for our networks. In case network bootstrappers go offline, a node connected to the network won't be able to rejoin it after the restart.

Saving known peers on disk and using them for bootstrapping will solve the problem, decrease the load on bootstrappers, and enhance network decentralization.

To ultimately achieve the goal, we should:

  • Use persistent PeerStore instead of in memory
  • Periodically saving some fraction of connected peers and using them for bootstrapping instead of hardcoded bootstrappers
    • For this, we should introduce a Bootstrapper p2p component that handles/contains the saving and reconnecting logic
    • We must implement this first and then migrate to libp2p native solutions once Persist routing table libp2p/go-libp2p-kad-dht#254 is implemented.
  • The storing of discovered full nodes and the reconnection to them on start should be in the Discovery component. We should additionally make periodic rotations of discovered full nodes.
    • This point needs more thinking, though, and saving might be unnecessary if we do rotations anyway
@Wondertan Wondertan self-assigned this Mar 1, 2023
@renaynay renaynay added the priority:high High priority issue to be prioritized for the current/following sprint label Mar 3, 2023
@renaynay renaynay assigned derrandz and unassigned Wondertan Mar 3, 2023
@renaynay
Copy link
Member

renaynay commented Mar 3, 2023

@derrandz is taking over this issue.

TODO (in order):

@renaynay renaynay changed the title Bootstrapping from previously seen peers feat: Persist peers to disk such that nodes can bootstrap from previously seen peers Mar 20, 2023
renaynay added a commit that referenced this issue Jun 16, 2023
This PR implements a `PeerIDStore` that will be useful for both dumping
useful peers inside of celestia-node's use of p2p.Exchange as well as
inside of discovery.

Related to #1851

---------

Co-authored-by: Hlib Kanunnikov <hlibwondertan@gmail.com>
renaynay added a commit that referenced this issue Sep 5, 2023
Provides `PIDStore` to header module so that it can be used in
`peerTracker` and replaces mem `peerstore.Peerstore` with on-disk
`peerstore.Peerstore` so that `peerTracker` can quickly bootstrap itself
with previously-seen peers and allow syncer to initialise its sync
target from tracked peers rather than trusted so long as it has a
subjective head within the trusting period.

Overrides #2133 

Closes #1851, mitigates issues resulting from #1623

Swamp integration tests to follow (tracked in #2506)

### Future note: 

This PR introduces a soon-to-be deprecated feature from libp2p (on-disk
peerstore). Once libp2p deprecates and removes this feature, the
PIDStore will have to become a PeerAddrStore such that it can save addr
info of good peers to disk instead of just their IDs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:p2p priority:high High priority issue to be prioritized for the current/following sprint
Projects
No open projects
Archived in project
3 participants