forest icon indicating copy to clipboard operation
forest copied to clipboard

fix(p2p): periodically re-dial to disconnected bootstrap nodes

Open hanabi1224 opened this issue 1 year ago • 3 comments

Summary of changes

This PR allows a forest node to re-dial to disconnected bootstrap nodes when discovery is disabled or not functioning in some rare conditions. (And if a forest node does not publicly expose its p2p port, other peers cannot initialize the connection either)

Changes introduced in this pull request:

  • periodically re-dial to disconnected bootstrap nodes
  • do not ban bootstrap nodes

Manually tested on calibnet

  • run forest on calibnet
  • run FULLNODE_API_INFO="$(cat /tmp/forest_token):/ip4/127.0.0.1/tcp/2345/http" forest-cli net disconnec t 12D3KooWEiBN8jBX8EBoM3M47pVRLRWV812gDRUJhMxgyVkUoR48
  • see log 2024-02-27T13:40:09.741739Z INFO forest_filecoin::libp2p::service: Re-dialing to bootstrap peer at /dns4/bootstrap-calibnet-2.chainsafe-fil.io/tcp/34000/p2p/12D3KooWEiBN8jBX8EBoM3M47pVRLRWV812gDRUJhMxgyVkUoR48

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • [x] I have performed a self-review of my own code,
  • [x] I have made corresponding changes to the documentation,
  • [x] I have added tests that prove my fix is effective or that my feature works (if possible),
  • [x] I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

hanabi1224 avatar Feb 27 '24 13:02 hanabi1224

How about dialing the bootstrap nodes only if the node is not connected to any peers at all?

@LesnyRumcajs There's an edge case that, when all the connected nodes are stateless(e.g. crawler) or out of sync by thousands of epochs, a stateful node still cannot sync

hanabi1224 avatar Feb 28 '24 10:02 hanabi1224

How about dialing the bootstrap nodes only if the node is not connected to any peers at all?

@LesnyRumcajs There's an edge case that, when all the connected nodes are stateless(e.g. crawler) or out of sync by thousands of epochs, a stateful node still cannot sync

Aren't stateless nodes able to point to relevant peers? To my understanding, please correct me if I'm wrong, the bootstrap nodes (Forest ones) are stateless anyway.

LesnyRumcajs avatar Feb 28 '24 11:02 LesnyRumcajs

Aren't stateless nodes able to point to relevant peers?

@LesnyRumcajs They are, but if discovery is disabled(or not functioning properly) and p2p port is not publicly exposed, connections from/to other nodes still cannot be established

hanabi1224 avatar Feb 28 '24 11:02 hanabi1224