Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[WIP] Companion PR for sr25519 fallible constructor #4861

Merged
merged 6 commits into from
Feb 26, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
fn verify_signature(who: &T::AccountId, signature: &[u8]) -> Result<(), DispatchError> {
// sr25519 always expects a 64 byte signature.
ensure!(signature.len() == 64, Error::<T>::InvalidSignature);
let signature: AnySignature = sr25519::Signature::from_slice(signature).into();
let signature: AnySignature = sr25519::Signature::from_slice(signature)
.ok_or(Error::<T>::InvalidSignature)?
.into();

// In Polkadot, the AccountId is always the same as the 32 byte public key.
let account_bytes: [u8; 32] = account_to_bytes(who)?;
Expand Down