mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Keystore overhaul (iter 2) (#13634)
* Remove bloat about remote keystore * Update docs and remove unused 'KeystoreRef' trait * Use wherever possible, MemoryKeystore for testing * Remove unrequired fully qualified method syntax for Keystore
This commit is contained in:
@@ -595,7 +595,7 @@ mod tests {
|
||||
use sp_core::{crypto::Pair as CryptoPair, Public};
|
||||
use sp_inherents::InherentDataProvider;
|
||||
use sp_keyring::AccountKeyring;
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
use sp_keystore::KeystorePtr;
|
||||
use sp_runtime::{
|
||||
generic::{Digest, Era, SignedPayload},
|
||||
key_types::BABE,
|
||||
@@ -615,12 +615,13 @@ mod tests {
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
let keystore_path = tempfile::tempdir().expect("Creates keystore path");
|
||||
let keystore: KeystorePtr =
|
||||
Arc::new(LocalKeystore::open(keystore_path.path(), None).expect("Creates keystore"));
|
||||
let alice: sp_consensus_babe::AuthorityId =
|
||||
Keystore::sr25519_generate_new(&*keystore, BABE, Some("//Alice"))
|
||||
.expect("Creates authority pair")
|
||||
.into();
|
||||
let keystore: KeystorePtr = LocalKeystore::open(keystore_path.path(), None)
|
||||
.expect("Creates keystore")
|
||||
.into();
|
||||
let alice: sp_consensus_babe::AuthorityId = keystore
|
||||
.sr25519_generate_new(BABE, Some("//Alice"))
|
||||
.expect("Creates authority pair")
|
||||
.into();
|
||||
|
||||
let chain_spec = crate::chain_spec::tests::integration_test_config_with_single_authority();
|
||||
|
||||
@@ -735,16 +736,16 @@ mod tests {
|
||||
// sign the pre-sealed hash of the block and then
|
||||
// add it to a digest item.
|
||||
let to_sign = pre_hash.encode();
|
||||
let signature = Keystore::sign_with(
|
||||
&*keystore,
|
||||
sp_consensus_babe::AuthorityId::ID,
|
||||
&alice.to_public_crypto_pair(),
|
||||
&to_sign,
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let signature = keystore
|
||||
.sign_with(
|
||||
sp_consensus_babe::AuthorityId::ID,
|
||||
&alice.to_public_crypto_pair(),
|
||||
&to_sign,
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let item = <DigestItem as CompatibleDigestItem>::babe_seal(signature);
|
||||
slot += 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user