-
Notifications
You must be signed in to change notification settings - Fork 60
randomWalk should be tested through interface-peer-discovery tests #44
Comments
So, is this library not actually compatible with peer discovery? I'm just getting started with libp2p, and using KadDHT as a Thanks! |
Hello @hstove Thanks for showing interest in However, it is not compatible with Thanks |
@vasco-santos still not compatible with |
Copying this over from libp2p/go-libp2p-kad-dht#295 (comment):
Ideally we'd like to be able to have RandomWalk added to the discovery services that libp2p manages itself. The highest priority thing for us though is https://github.com/libp2p/interface-peer-discovery/issues/6, so we can ensure all Peer Discovery services are working as intended. |
@jacobheun so peer discovery is there, just not in a way we would expect from something that implements |
Correct, you can see the main difference in an upcoming js-ipfs update. Instead of the normal peerDiscovery registration https://github.com/ipfs/js-ipfs/blob/eb29e666ecc94bfa621023954d6bfc3e2c5357b3/src/core/runtime/libp2p-nodejs.js#L43-L47 and configuration https://github.com/ipfs/js-ipfs/blob/eb29e666ecc94bfa621023954d6bfc3e2c5357b3/src/core/runtime/libp2p-nodejs.js#L51-L62, Random Walk is currently internal to the DHT, instead of being an explicitly registered discovery service. |
@jacobheun I think this wasn't available when I made original comment, 'cause it was giving me config validation error until I updated |
@jayarjo ah, yeah that would have been an issue, depending on the version and the config. The config has changed a bit over the past few versions of the DHT. I just released a patch release of libp2p, 0.25.2, that should be less restrictive for this reason, and allow the DHT to do the config validation for itself. |
@jacobheun it keeps rediscovering the same nodes, although node seemingly already has them in its |
Ideally it shouldn't be happening, but we have to do some cleanup to resolve this. One problem is the The There are some useful side effects we get with continuously discovering peers, but overall it's not good. Once we add the ability to tag peers, such as Bootstrap nodes, and fix these issues, we should be able to remove the redundant discovery. |
I was thinking to have a simple Map locally to distinguish between already found and new. Doesn't each peer have it's own "unqiue" id? This for example:
Perhaps I'm missing a bigger picture here? |
Oh... I see now |
You could easily use a let seen = new Set()
libp2p.on('peer:discovery', (peerInfo) => {
// If its in the set, exit early
if (seen.has(peerInfo.id.toB58String()) return
// Otherwise, add it and do something neat
seen.add(peerInfo.id.toB58String())
doSomething(peerInfo)
}) The caveat of this is for something like Bootstrap peers. Right now, we have a side effect with auto Dial, that if your peer count drops below the minimum peer threshold set for the Connection Manager, already discovered peers will be dialed when they're emitted again as discovered. Ideally, if we drop below that threshold we should dial good, well known peers. But, since we don't have tagging for peers yet, we don't really have a concept of who we should actually dial. We know the Bootstrap peers will get emitted consistently, on an interval, so at the very least we'll connect to them when we get low on peers. |
The readme of Edit: tests have been added 🎉 |
|
After the latest changes of the go-libp2p-kad-dht, we intend to rewrite most of the this codebase once we have a spec from the go implementation. Once that is done, we will guarantee that the random walk is full compliant with the |
Randomwalk has been removed in favour of routing table refresh so this is no longer necessary. |
The current
randomWalk
implementation is not being tested with the libp2p/interface-peer-discovery.This should have a similar implementation suite of tests like the other
peer-discovery
modules.The text was updated successfully, but these errors were encountered: