mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 11:41:04 +00:00
Make BEEFY client keystore generic over BEEFY AuthorityId type (#2258)
This is the significant step to make BEEFY client able to handle both ECDSA and (ECDSA, BLS) type signature. The idea is having BEEFY Client generic on crypto types makes migration to new types smoother. This makes the BEEFY Keystore generic over AuthorityId and extends its tests to cover the case when the AuthorityId is of type (ECDSA, BLS12-377) --------- Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
This commit is contained in:
@@ -37,7 +37,7 @@ use sp_core::bandersnatch;
|
||||
}
|
||||
|
||||
sp_keystore::bls_experimental_enabled! {
|
||||
use sp_core::{bls377, bls381, ecdsa_bls377};
|
||||
use sp_core::{bls377, bls381, ecdsa_bls377, KeccakHasher};
|
||||
}
|
||||
|
||||
use crate::{Error, Result};
|
||||
@@ -391,6 +391,20 @@ impl Keystore for LocalKeystore {
|
||||
self.sign::<ecdsa_bls377::Pair>(key_type, public, msg)
|
||||
}
|
||||
|
||||
fn ecdsa_bls377_sign_with_keccak256(
|
||||
&self,
|
||||
key_type: KeyTypeId,
|
||||
public: &ecdsa_bls377::Public,
|
||||
msg: &[u8],
|
||||
) -> std::result::Result<Option<ecdsa_bls377::Signature>, TraitError> {
|
||||
let sig = self.0
|
||||
.read()
|
||||
.key_pair_by_type::<ecdsa_bls377::Pair>(public, key_type)?
|
||||
.map(|pair| pair.sign_with_hasher::<KeccakHasher>(msg));
|
||||
Ok(sig)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user