-
Notifications
You must be signed in to change notification settings - Fork 6
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
Compatibility with services in libp2p v0.45.0 #98
Comments
(@TimDaub fyi this will affect you if you try to upgrade) |
This module still works for me if I declare a I think what's missing is a way for services and other libp2p components to express their dependencies in a way that the user can discover a compile time - I've opened a PR which I think will fix this here: libp2p/js-libp2p#1762 - I'd love some input on it if you've got the time. The change to this module after that PR is merged would be to change these lines to add import type { PubSub } from '@libp2p/interface-pubsub'
//... whole file here
export function pubsubPeerDiscovery (init: PubsubPeerDiscoveryInit = {}): (components: PubSubPeerDiscoveryComponents & { pubsub: PubSub }) => PeerDiscovery {
return (components: PubSubPeerDiscoveryComponents) => new PubSubPeerDiscovery(components, init)
} |
Yeah, I was trying to develop a service similar to this one that depends on pubsub and I resorted to just casting Maybe I'm forgetting something (crazy how fast context gets garbage collected in my head) but why say |
No, you're right - I was thinking of the circuit relay server updates in libp2p/js-libp2p#1762 where the component has an implicit dependency on another component but doesn't actually interact with it in the code. |
I have a dirty patch that makes peer discovery work via gossipsub for 0.46.2 here: https://github.com/Hmac512/fix-libp2p-peer-discover-046/blob/9aadfdc80332e2bbde0ce78b91f9183799fba32d/src/gossipNode.ts#L169 Need to clean up the code. It tests forming a mesh with 10 nodes, and it runs successfully. I left some extra stuff in the patches I added while debugging. Will simplify it later. The fix is too dirty to be merged into the official packages, but posting here if anyone needs it. What’s the status on exposing the services in the main js-libp2p? |
We should probably update the |
Would be helpful |
Update to the consolidated libp2p interface deps. Adds a note to the readme about configuring a pubsub service. Closes #98
Update to the consolidated libp2p interface deps. Adds a note to the readme about configuring a pubsub service. Closes #98
## [9.0.0](v8.0.6...v9.0.0) (2023-09-18) ### ⚠ BREAKING CHANGES * update to latest [email protected] deps (#111) ### Dependencies * update to latest [email protected] deps ([#111](#111)) ([d54009b](d54009b)), closes [#98](#98)
libp2p v0.45.0 moved pubsub/DHT/fetch/identify/ping etc. into a separate "services" object, and as far as I can tell they are no longer available in the initial
Components
object, making it impossible (???) to make composable services that depend on e.g. pubsub to provide peer discovery. Can anyone confirm if this is true? What's the best approach to something like pubsub-peer-discovery in a post-v0.45.0 world? cc @achingbrainThe text was updated successfully, but these errors were encountered: