Skip to content
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

Merged
merged 7 commits into from
Aug 26, 2020

Conversation

romanb
Copy link
Contributor

@romanb romanb commented Jun 15, 2020

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.

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.
@tomaka
Copy link
Member

tomaka commented Aug 20, 2020

I think we can go ahead with this now.

@romanb romanb requested review from twittner and tomaka August 25, 2020 12:43
Err(data)
pub fn from_multihash(data: Multihash) -> Result<PeerId, Multihash> {
match data.algorithm() {
Code::Sha2_256 | Code::Identity => Ok(PeerId { multihash: data }),
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See c251d8f.

core/src/peer_id.rs Outdated Show resolved Hide resolved
Co-authored-by: Toralf Wittner <tw@dtex.org>
Comment on lines -80 to -87
// 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.
Copy link
Member

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.

Copy link
Contributor Author

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).

@romanb romanb merged commit 7b415d5 into libp2p:master Aug 26, 2020
@romanb romanb deleted the finish-peer-id-migration branch August 26, 2020 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants