Skip to content

Commit

Permalink
fix(crypto): properly deserialize sp-core sr25519
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA committed Jan 3, 2025
1 parent 9ddf4d2 commit 4652366
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/crypto/sp-core/src/sp_core_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ macro_rules! impl_sp_core_pair_public {
where
D: serde::Deserializer<'de>,
{
let bytes = <Vec<u8>>::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 = <Vec<u8>>::deserialize(deserializer)?;
let pair = <$pair_type>::from_seed_slice(&seed).map_err(|_| serde::de::Error::custom("Invalid seed length"))?;
Ok([<$key_type Pair>](pair))
}
}
Expand Down

0 comments on commit 4652366

Please sign in to comment.