mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 00:17:56 +00:00
[WIP] Companion PR for sr25519 fallible constructor (#4861)
* Manage new `sr25519::Signature::from_slice` fallible constructor
Constructor now returns an `Option`
* update lockfile for {"substrate"}
Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+182
-163
File diff suppressed because it is too large
Load Diff
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user