-
Notifications
You must be signed in to change notification settings - Fork 23
feat: support custom compat protocol name #42
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
base: master
Are you sure you want to change the base?
Conversation
7e0bdf4 to
adef753
Compare
rkuhn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I had to mute github notifications for a while.
This change looks good to me, just two points to discuss.
src/behaviour.rs
Outdated
| use libp2p::core::{connection::ConnectionId, Multiaddr, PeerId}; | ||
| use libp2p::swarm::derive_prelude::{ConnectionClosed, DialFailure, FromSwarm, ListenFailure}; | ||
| #[cfg(feature = "compat")] | ||
| use libp2p::swarm::SubstreamProtocol; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fold this into the following import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
|
||
| fn protocol_info(&self) -> Self::InfoIter { | ||
| iter::once(b"/ipfs/bitswap/1.2.0") | ||
| unimplemented!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This smells bad: why not instead remove this impl?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires more refactoring to remove UpgradeInfo impl for CompatMessage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That refactoring is the required proof that this unimplemented!() won’t panic at runtime, though. In other words, I find it reasonable to demand that a production ready library does not contain unimplemented!().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense! However, it's been too long since I made the PR, and I do need some extra time to pick up the context and made the change.
Changes:
go-bitswapcompatible nodelibipldto make life easier when there're version conflicts in downstream crates. (e.g.[email protected]depends on a differentcidversion fromfvm_ipld_blockstore) and it's not yet possible to upgradefvm_ipld_blockstore, see chore: upgradecid,multihash,libipld-corecrates filecoin-project/ref-fvm#1380 (comment)Background:
go-bitswapallows customizing the protocol name with itsSettings.PrefixAPI, e.g. lotus uses"/chain"prefix,rust-bitswapshould be capable of matching the protocol name incompatmode. Please let me know your feedback, thanks!