helia icon indicating copy to clipboard operation
helia copied to clipboard

feat: ipns libp2p fetch

Open tabcat opened this issue 3 weeks ago • 2 comments

Title

feat: ipns libp2p fetch

Description

Adds @libp2p/fetch functionality to the pubsub router of helia/ipns. The pubsub router will libp2p/fetch the latest local record from new pubsub peers if libp2p.services.fetch is found.

Closes #893

Notes & open questions

Should get method of the pubsub router wait for a few peers to be queries with fetch, or should the router emit an event when it finds a newer record?

Change checklist

  • [ ] I have performed a self-review of my own code
  • [ ] I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • [ ] I have added tests that prove my fix is effective or that my feature works

tabcat avatar Nov 19 '25 23:11 tabcat

Does a lookup function need to be registered with @libp2p/fetch? It seems like it would be needed, but the resources I'm looking at don't use it.

tabcat avatar Nov 19 '25 23:11 tabcat

I'm considering checking the current subscribers for the topic directly before the fetch call. The check would see if we are still pubsub peered with the peerId that is being queried with the fetch call. If not then cancel the fetch and return. This would reduce the possibility of opening a new connection instead of just a new stream.

tabcat avatar Nov 21 '25 19:11 tabcat

Triage:

  • @achingbrain will follow up

hsanjuan avatar Nov 25 '25 15:11 hsanjuan