mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Keystore overhaul (#13615)
* Remove 'supported_keys' 'sign_with_any' and 'sign_with_all' from keystore trait * Remove the aync keystore * Renaming: - SyncCryptoStore -> Keystore - SyncCryptoStorePtr -> KeystorePtr - KeyStore -> MemoryKeystore * Fix authority discovery worker and tests * Rename 'insert_unknown' to 'insert' * Remove leftover
This commit is contained in:
@@ -51,7 +51,7 @@ use sp_consensus::{BlockOrigin, Environment, Error as ConsensusError, Proposer,
|
||||
use sp_consensus_slots::Slot;
|
||||
use sp_core::crypto::{ByteArray, Pair, Public};
|
||||
use sp_inherents::CreateInherentDataProviders;
|
||||
use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
use sp_runtime::{
|
||||
traits::{Block as BlockT, Header, Member, NumberFor, Zero},
|
||||
DigestItem,
|
||||
@@ -168,7 +168,7 @@ pub struct StartAuraParams<C, SC, I, PF, SO, L, CIDP, BS, N> {
|
||||
/// The backoff strategy when we miss slots.
|
||||
pub backoff_authoring_blocks: Option<BS>,
|
||||
/// The keystore used by the node.
|
||||
pub keystore: SyncCryptoStorePtr,
|
||||
pub keystore: KeystorePtr,
|
||||
/// The proportion of the slot dedicated to proposing.
|
||||
///
|
||||
/// The block proposing will be limited to this proportion of the slot from the starting of the
|
||||
@@ -265,7 +265,7 @@ pub struct BuildAuraWorkerParams<C, I, PF, SO, L, BS, N> {
|
||||
/// The backoff strategy when we miss slots.
|
||||
pub backoff_authoring_blocks: Option<BS>,
|
||||
/// The keystore used by the node.
|
||||
pub keystore: SyncCryptoStorePtr,
|
||||
pub keystore: KeystorePtr,
|
||||
/// The proportion of the slot dedicated to proposing.
|
||||
///
|
||||
/// The block proposing will be limited to this proportion of the slot from the starting of the
|
||||
@@ -346,7 +346,7 @@ struct AuraWorker<C, E, I, P, SO, L, BS, N> {
|
||||
client: Arc<C>,
|
||||
block_import: I,
|
||||
env: E,
|
||||
keystore: SyncCryptoStorePtr,
|
||||
keystore: KeystorePtr,
|
||||
sync_oracle: SO,
|
||||
justification_sync_link: L,
|
||||
force_authoring: bool,
|
||||
@@ -418,7 +418,7 @@ where
|
||||
) -> Option<Self::Claim> {
|
||||
let expected_author = slot_author::<P>(slot, epoch_data);
|
||||
expected_author.and_then(|p| {
|
||||
if SyncCryptoStore::has_keys(
|
||||
if Keystore::has_keys(
|
||||
&*self.keystore,
|
||||
&[(p.to_raw_vec(), sp_application_crypto::key_types::AURA)],
|
||||
) {
|
||||
@@ -449,7 +449,7 @@ where
|
||||
// add it to a digest item.
|
||||
let public_type_pair = public.to_public_crypto_pair();
|
||||
let public = public.to_raw_vec();
|
||||
let signature = SyncCryptoStore::sign_with(
|
||||
let signature = Keystore::sign_with(
|
||||
&*self.keystore,
|
||||
<AuthorityId<P> as AppKey>::ID,
|
||||
&public_type_pair,
|
||||
@@ -798,7 +798,7 @@ mod tests {
|
||||
LocalKeystore::open(keystore_path.path(), None).expect("Creates keystore."),
|
||||
);
|
||||
|
||||
SyncCryptoStore::sr25519_generate_new(&*keystore, AURA, Some(&key.to_seed()))
|
||||
Keystore::sr25519_generate_new(&*keystore, AURA, Some(&key.to_seed()))
|
||||
.expect("Creates authority key");
|
||||
keystore_paths.push(keystore_path);
|
||||
|
||||
@@ -883,7 +883,7 @@ mod tests {
|
||||
|
||||
let keystore_path = tempfile::tempdir().expect("Creates keystore path");
|
||||
let keystore = LocalKeystore::open(keystore_path.path(), None).expect("Creates keystore.");
|
||||
let public = SyncCryptoStore::sr25519_generate_new(&keystore, AuthorityPair::ID, None)
|
||||
let public = Keystore::sr25519_generate_new(&keystore, AuthorityPair::ID, None)
|
||||
.expect("Key should be created");
|
||||
authorities.push(public.into());
|
||||
|
||||
@@ -933,7 +933,7 @@ mod tests {
|
||||
|
||||
let keystore_path = tempfile::tempdir().expect("Creates keystore path");
|
||||
let keystore = LocalKeystore::open(keystore_path.path(), None).expect("Creates keystore.");
|
||||
SyncCryptoStore::sr25519_generate_new(
|
||||
Keystore::sr25519_generate_new(
|
||||
&keystore,
|
||||
AuthorityPair::ID,
|
||||
Some(&Keyring::Alice.to_seed()),
|
||||
|
||||
Reference in New Issue
Block a user