From 64ead877d5779f3ac22964f3ff16b413b489e5a1 Mon Sep 17 00:00:00 2001 From: Aaro Altonen Date: Tue, 15 Aug 2023 13:40:36 +0300 Subject: [PATCH 1/2] Use correct multihash algorithm code for WebRTC addresses --- light-base/src/platform/address_parse.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/light-base/src/platform/address_parse.rs b/light-base/src/platform/address_parse.rs index e866f09503..849ec72498 100644 --- a/light-base/src/platform/address_parse.rs +++ b/light-base/src/platform/address_parse.rs @@ -107,7 +107,7 @@ pub fn multiaddr_to_address(multiaddr: &Multiaddr) -> Result { // TODO: unwrapping is hacky because Multiaddr is supposed to guarantee that this is a valid multihash but doesn't due to typing issues let multihash = multihash::MultihashRef::from_bytes(&hash).unwrap(); - if multihash.hash_algorithm_code() != 12 { + if multihash.hash_algorithm_code() != 0x12 { return Err(Error::NonSha256Certhash); } let Ok(&remote_certificate_sha256) = <&[u8; 32]>::try_from(multihash.data()) @@ -129,7 +129,7 @@ pub fn multiaddr_to_address(multiaddr: &Multiaddr) -> Result { // TODO: unwrapping is hacky because Multiaddr is supposed to guarantee that this is a valid multihash but doesn't due to typing issues let multihash = multihash::MultihashRef::from_bytes(&hash).unwrap(); - if multihash.hash_algorithm_code() != 12 { + if multihash.hash_algorithm_code() != 0x12 { return Err(Error::NonSha256Certhash); } let Ok(&remote_certificate_sha256) = <&[u8; 32]>::try_from(multihash.data()) From e3301dfc4afd855d41f55bb42b7a357ebdd6e13c Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 15 Aug 2023 12:59:42 +0200 Subject: [PATCH 2/2] CHANGELOG --- wasm-node/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index f9b5fc0a26..7a34c940b6 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -6,6 +6,10 @@ - It is now possible for parachain chain specifications to include just a `genesis.stateRootHash` field (and no `genesis.raw` field). A warning in the logs is now printed for all chain specifications that include a `genesis.raw` field. ([#1034](https://github.com/smol-dot/smoldot/pull/1034)) +### Fixed + +- Fix WebRTC addresses failing to be be parsed. ([#1036](https://github.com/smol-dot/smoldot/pull/1036)) + ## 1.0.16 - 2023-08-14 ### Changed