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

fullrt should maintain its own address book #1061

Closed
guillaumemichel opened this issue Mar 6, 2025 · 3 comments
Closed

fullrt should maintain its own address book #1061

guillaumemichel opened this issue Mar 6, 2025 · 3 comments

Comments

@guillaumemichel
Copy link
Contributor

Problem

fullrt currently depends on the go-libp2p peerstore to open connection and make requests through the ProtocolMessenger. The fullrt used to pollute the go-libp2p host peerstore with many stale addresses (fixed in #1053).

fullrt periodically runs a crawl, and tries to remember addresses between 2 crawls, to be able to dial all nodes directly. However, it fails at doing so, because addresses are flushed from the peerstore shortly after the connection to the remote peers closes. Which means that the peerstore doesn't remember the addresses during the full crawl interval. It cannot be addresses easily because of the peerstore current interface libp2p/go-libp2p#3218.

Potential solution

The best solution seems to be that fullrt maintains its own Address Book, and uses these addresses to dial remote peers when required. To achieve this, it is required to refactor the ProtocolMessenger logic, to depend on the fullrt address book (or provided addresses), rather than on the host peerstore to open a new stream.

nstr, err := ms.m.host.NewStream(ctx, ms.p, ms.m.protocols...)

see also #1053 (comment) for context.

@aschmahmann
Copy link
Contributor

@guillaumemichel are you sure things are currently bugged? Looking at the code briefly:

That being said if we want to formalize the addressbook and integrate it with a simpler / easier to use go-libp2p API is indicated in libp2p/go-libp2p#3218 that makes a lot of sense

@guillaumemichel
Copy link
Contributor Author

guillaumemichel commented Mar 6, 2025

Thanks for the quick feedback @aschmahmann !

I missed that the protoMessenger is only used after GetClosestPeers is called (or in bulk message send), so it should be good to leave it as is.

I think we can even remove the following, since it is a no-op (ttl of connected peer is higher than this one)

// Extend peerstore address ttl for addresses whose ttl is below
// c.dialAddressExtendDur. By now identify has already cleaned up addresses
// provided to Connect above and only kept the listen addresses advertised by
// the remote peer
c.host.Peerstore().AddAddrs(nextPeer.ID, c.host.Peerstore().Addrs(nextPeer.ID), c.dialAddressExtendDur)

@guillaumemichel
Copy link
Contributor Author

Closing since fullrt already has a simple address book that works for its usage.

I think we can even remove the following, since it is a no-op (ttl of connected peer is higher than this one)

This partially related discussion can continue in #1063

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

No branches or pull requests

2 participants