-
Notifications
You must be signed in to change notification settings - Fork 961
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
Remove temporary peer ID compatibility mode. #1608
Conversation
This removes the temporary compatibility mode between peer IDs using identity hashing and sha256, thus being the last step in the context of libp2p#555.
I think we can go ahead with this now. |
core/src/peer_id.rs
Outdated
Err(data) | ||
pub fn from_multihash(data: Multihash) -> Result<PeerId, Multihash> { | ||
match data.algorithm() { | ||
Code::Sha2_256 | Code::Identity => Ok(PeerId { multihash: data }), |
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 isn't the case right now, but maybe we should check that data.len() <= MAX_INLINE_KEY_LENGTH
when the algorithm is identity
?
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.
Sounds good to me.
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.
See c251d8f.
Co-authored-by: Toralf Wittner <tw@dtex.org>
// Note: before 0.12, this was incorrectly implemented and `SHA2256` was always used. | ||
// Starting from version 0.13, rust-libp2p accepts both hashed and non-hashed keys as | ||
// input (see `from_bytes`). Starting from version 0.16 rust-libp2p will compare | ||
// `PeerId`s of different hashes equal, which makes it possible to connect through | ||
// secio or noise to nodes with an identity hash. Starting from version 0.17, rust-libp2p | ||
// will switch to not hashing the key (i.e. the correct behaviour). | ||
// In other words, rust-libp2p 0.16 is compatible with all versions of rust-libp2p. | ||
// Rust-libp2p 0.12 and below is **NOT** compatible with rust-libp2p 0.17 and above. |
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.
Maybe we could leave that comment, but I don't have a strong opinion.
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.
I incorporated it into the changelog (see 7504764).
This removes the temporary compatibility mode between peer IDs using identity hashing and sha256, thus being
the last step in the context of #555. This has low priority, I just wanted to get this out as a PR as a reminder to do this.