mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Keystore overhaul (final) (#13683)
* Introduce keystore specialized sign methods * Get rid of 'AppKey::UntypedGeneric' associated type. Untyped generics are accessible using associated types 'Generic' associated type. I.e. <T as AppKey>::Public::Generic * Get rid of 'CryptoTypePublicPair' * Trivial fix * Small refactory of local keystore implementations * Remove 'crypto_id' method from 'Public' * Trivial rename of 'AppKey' to 'AppCrypto' * Remove unused import * Improve docs * Better signature related errors for authority-discovery * Apply review suggestion * Apply review suggestions Co-authored-by: Koute <koute@users.noreply.github.com> * Authority discoverty signing error revisited * Signing error revisited for babe and aura as well * Further cleanup --------- Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
@@ -30,7 +30,7 @@ use crate::{
|
||||
use impl_trait_for_tuples::impl_for_tuples;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
pub use sp_arithmetic::traits::{
|
||||
checked_pow, ensure_pow, AtLeast32Bit, AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedDiv,
|
||||
CheckedMul, CheckedShl, CheckedShr, CheckedSub, Ensure, EnsureAdd, EnsureAddAssign, EnsureDiv,
|
||||
@@ -148,10 +148,10 @@ pub trait AppVerify {
|
||||
}
|
||||
|
||||
impl<
|
||||
S: Verify<Signer = <<T as AppKey>::Public as sp_application_crypto::AppPublic>::Generic>
|
||||
S: Verify<Signer = <<T as AppCrypto>::Public as sp_application_crypto::AppPublic>::Generic>
|
||||
+ From<T>,
|
||||
T: sp_application_crypto::Wraps<Inner = S>
|
||||
+ sp_application_crypto::AppKey
|
||||
+ sp_application_crypto::AppCrypto
|
||||
+ sp_application_crypto::AppSignature
|
||||
+ AsRef<S>
|
||||
+ AsMut<S>
|
||||
@@ -159,16 +159,18 @@ impl<
|
||||
> AppVerify for T
|
||||
where
|
||||
<S as Verify>::Signer: IdentifyAccount<AccountId = <S as Verify>::Signer>,
|
||||
<<T as AppKey>::Public as sp_application_crypto::AppPublic>::Generic: IdentifyAccount<
|
||||
AccountId = <<T as AppKey>::Public as sp_application_crypto::AppPublic>::Generic,
|
||||
<<T as AppCrypto>::Public as sp_application_crypto::AppPublic>::Generic: IdentifyAccount<
|
||||
AccountId = <<T as AppCrypto>::Public as sp_application_crypto::AppPublic>::Generic,
|
||||
>,
|
||||
{
|
||||
type AccountId = <T as AppKey>::Public;
|
||||
fn verify<L: Lazy<[u8]>>(&self, msg: L, signer: &<T as AppKey>::Public) -> bool {
|
||||
type AccountId = <T as AppCrypto>::Public;
|
||||
fn verify<L: Lazy<[u8]>>(&self, msg: L, signer: &<T as AppCrypto>::Public) -> bool {
|
||||
use sp_application_crypto::IsWrappedBy;
|
||||
let inner: &S = self.as_ref();
|
||||
let inner_pubkey =
|
||||
<<T as AppKey>::Public as sp_application_crypto::AppPublic>::Generic::from_ref(signer);
|
||||
<<T as AppCrypto>::Public as sp_application_crypto::AppPublic>::Generic::from_ref(
|
||||
signer,
|
||||
);
|
||||
Verify::verify(inner, msg, inner_pubkey)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user