From 465236638077acfe64e6113302a59290ba46ac9c Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Fri, 3 Jan 2025 15:10:16 -0500 Subject: [PATCH] fix(crypto): properly deserialize sp-core sr25519 --- crates/crypto/sp-core/src/sp_core_util.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/crypto/sp-core/src/sp_core_util.rs b/crates/crypto/sp-core/src/sp_core_util.rs index 7d11017..f0bf33c 100644 --- a/crates/crypto/sp-core/src/sp_core_util.rs +++ b/crates/crypto/sp-core/src/sp_core_util.rs @@ -54,9 +54,8 @@ macro_rules! impl_sp_core_pair_public { where D: serde::Deserializer<'de>, { - let bytes = >::deserialize(deserializer)?; - let seed: [u8; 32] = bytes.try_into().map_err(|_| serde::de::Error::custom("Invalid seed length"))?; - let pair = <$pair_type>::from_seed(&seed); + let seed = >::deserialize(deserializer)?; + let pair = <$pair_type>::from_seed_slice(&seed).map_err(|_| serde::de::Error::custom("Invalid seed length"))?; Ok([<$key_type Pair>](pair)) } }