Temporary canonical multihash in peer ID. #1449
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Together with #1444 this is a proposal for a possible resolution of the remaining issues relating to #555, including #1437.
The idea would be to publish #1444 with
0.16
and the changes of this PR with0.17
. #1444 should resolve #1437 and this PR should ensure that it stays resolved once we start using the "identity hash". Then, eventually, thecanonical
field introduced here could be removed in0.18
or later.In the context of this PR, the general lack of guarantees w.r.t.
AsRef<[u8]>
,PeerId::as_bytes()
andPeerId::into_bytes()
is now documented, and implementations ofstd::borrow::Borrow
added which do provide the necessary guarantees. Similarly, construction ofKey
s inlibp2p-kad
is changed from requiringAsRef<[u8]>
toBorrow<[u8]>
to more clearly state the requirements.I hope this makes sense and is sound, please let me know if it doesn't.