-
Notifications
You must be signed in to change notification settings - Fork 1.2k
IPFS ignores PeerID passed by libp2p instance - too many ways of passing peer-id #3590
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
Thank you for the report!
|
@momack2 the configuration issue here is a conflict between a user configuring libp2p via
So what happens in this case is that IPFS repo already has a PeerId defined, but IPFS allows libp2p to be configured with another PeerId, which will be overwritten by IPFS when setting the repo's PeerId. With the above considerations, this is a
As a side note, there is a lot of room for configuration improvements on EDIT: We are only talking about the peerId here, but I suspect this problem might exist on other configuration properties like the swarm addresses configured in IPFS config file, which are forwarded to the libp2p config (and probably overwrite user provided configs within libp2p scope) |
@vasco-santos: who owns the next steps here? |
This needs an analysis of the scope of this issue first, as this is not only a This can be included in protocol/web3-dev-team#82 or as a maintenance task (probably for the onboarding team?) |
Seems like a simple v0 is just to define what does and doesn't work in the docs, and the work around that EmiM suggested (aka if you're using IPFS, your libp2p configurations will be overwritten and need to be passed directly to the IPFS constructor). Seems like something that @johnnymatthews @johndmulhausen can document! |
js-ipfs is being deprecated in favor of Helia. You can follow the migration plan here #4336 and read the migration guide. This issue has been resolved in Helia! if this does not address your concern please let us know by reopening this issue before 2023-06-05! |
Version:
"ipfs": "0.52"
Platform:
Linux rf-Lenovo-ideapad-320-15IKB 5.8.0-44-generic #50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
nodejs
libp2p
Severity:
Low/Medium
Description:
IPFS ignores PeerID passed by libp2p instance.
This is the draft of my code:
The result of running the code above: Identity.PeerID saved in config file created by IPFS differs from peerID passed to libp2p. It causes further syncing problems with library that uses ipfs - orbitdb.
What I expect: IPFS uses peerID that I passed to libp2p.
What happened: IPFS completely ignores the peerID I passed and creates its own peerID. It uses
privateKey
fromoptions
or private key from Repo.I managed to fix the problem by passing
privateKey: peerID.toJSON().privKey
to IPFS.create.It's very confusing, especially that there are multiple ways of passing peer-id to IPFS and one of them that I would expect to work, doesn't work.
I've created a topic on your forum: https://discuss.ipfs.io/t/ipfs-ignores-peerid-passed-to-custom-libp2p-instance/10452, @vasco-santos suggested that IPFS could:
or
Besides that, I think that IPFS should not ignore PeerID from libp2p.
The text was updated successfully, but these errors were encountered: