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:
Davide Galassi
2023-03-17 12:24:14 +01:00
committed by GitHub
parent 91bb2d29ca
commit f110941b7f
49 changed files with 317 additions and 820 deletions
@@ -40,7 +40,7 @@ use sp_consensus_grandpa::{
};
use sp_core::H256;
use sp_keyring::Ed25519Keyring;
use sp_keystore::{testing::KeyStore as TestKeyStore, SyncCryptoStore, SyncCryptoStorePtr};
use sp_keystore::{testing::MemoryKeystore, Keystore, KeystorePtr};
use sp_runtime::{
codec::Encode,
generic::{BlockId, DigestItem},
@@ -280,9 +280,9 @@ fn make_ids(keys: &[Ed25519Keyring]) -> AuthorityList {
keys.iter().map(|&key| key.public().into()).map(|id| (id, 1)).collect()
}
fn create_keystore(authority: Ed25519Keyring) -> SyncCryptoStorePtr {
let keystore = Arc::new(TestKeyStore::new());
SyncCryptoStore::ed25519_generate_new(&*keystore, GRANDPA, Some(&authority.to_seed()))
fn create_keystore(authority: Ed25519Keyring) -> KeystorePtr {
let keystore = Arc::new(MemoryKeystore::new());
Keystore::ed25519_generate_new(&*keystore, GRANDPA, Some(&authority.to_seed()))
.expect("Creates authority key");
keystore
}
@@ -1376,7 +1376,7 @@ type TestEnvironment<N, S, SC, VR> =
fn test_environment_with_select_chain<N, S, VR, SC>(
link: &TestLinkHalf,
keystore: Option<SyncCryptoStorePtr>,
keystore: Option<KeystorePtr>,
network_service: N,
sync_service: S,
select_chain: SC,
@@ -1428,7 +1428,7 @@ where
fn test_environment<N, S, VR>(
link: &TestLinkHalf,
keystore: Option<SyncCryptoStorePtr>,
keystore: Option<KeystorePtr>,
network_service: N,
sync_service: S,
voting_rule: VR,