mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Overhaul crypto (Schnorr/Ristretto, HDKD, BIP39) (#1795)
* Rijig to Ristretto * Rebuild wasm * adds compatibility test with the wasm module * Add Ed25519-BIP39 support * Bump subkey version * Update CLI output * New keys. * Standard phrase/password/path keys. * Subkey uses S-URI for secrets * Move everything to use new HDKD crypto. * Test fixes * Ignore old test vector. * fix the ^^ old test vector. * Fix tests * Test fixes * Cleanups * Fix broken key conversion logic in grandpa CC @rphmeier * Remove legacy Keyring usage * Traitify `Pair` * Replace Ed25519AuthorityId with ed25519::Public * Expunge Ed25519AuthorityId type! * Replace Sr25519AuthorityId with sr25519::Public * Remove dodgy crypto type-punning conversions * Fix some tests * Avoid trait * Deduplicate DeriveJunction string decode * Remove cruft code * Fix test * Minor removals * Build fix * Subkey supports sign and verify * Inspect works for public key URIs * Remove more crypto type-punning * Fix typo * Fix tests
This commit is contained in:
@@ -17,10 +17,10 @@
|
||||
use super::*;
|
||||
use self::error::{Error, ErrorKind};
|
||||
|
||||
use sr_io::twox_128;
|
||||
use assert_matches::assert_matches;
|
||||
use consensus::BlockOrigin;
|
||||
use rustc_hex::FromHex;
|
||||
use test_client::{self, runtime, keyring::Keyring, TestClient, BlockBuilderExt};
|
||||
use test_client::{self, runtime, AccountKeyring, TestClient, BlockBuilderExt};
|
||||
|
||||
#[test]
|
||||
fn should_return_storage() {
|
||||
@@ -64,8 +64,8 @@ fn should_notify_about_storage_changes() {
|
||||
|
||||
let mut builder = api.client.new_block().unwrap();
|
||||
builder.push_transfer(runtime::Transfer {
|
||||
from: Keyring::Alice.to_raw_public().into(),
|
||||
to: Keyring::Ferdie.to_raw_public().into(),
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 42,
|
||||
nonce: 0,
|
||||
}).unwrap();
|
||||
@@ -88,8 +88,10 @@ fn should_send_initial_storage_changes_and_notifications() {
|
||||
{
|
||||
let api = State::new(Arc::new(test_client::new()), Subscriptions::new(remote));
|
||||
|
||||
let alice_balance_key = twox_128(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into()));
|
||||
|
||||
api.subscribe_storage(Default::default(), subscriber, Some(vec![
|
||||
StorageKey("a52da2b7c269da1366b3ed1cdb7299ce".from_hex().unwrap()),
|
||||
StorageKey(alice_balance_key.to_vec()),
|
||||
]).into());
|
||||
|
||||
// assert id assigned
|
||||
@@ -97,8 +99,8 @@ fn should_send_initial_storage_changes_and_notifications() {
|
||||
|
||||
let mut builder = api.client.new_block().unwrap();
|
||||
builder.push_transfer(runtime::Transfer {
|
||||
from: Keyring::Alice.to_raw_public().into(),
|
||||
to: Keyring::Ferdie.to_raw_public().into(),
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 42,
|
||||
nonce: 0,
|
||||
}).unwrap();
|
||||
@@ -131,8 +133,8 @@ fn should_query_storage() {
|
||||
let add_block = |nonce| {
|
||||
let mut builder = client.new_block().unwrap();
|
||||
builder.push_transfer(runtime::Transfer {
|
||||
from: Keyring::Alice.to_raw_public().into(),
|
||||
to: Keyring::Ferdie.to_raw_public().into(),
|
||||
from: AccountKeyring::Alice.into(),
|
||||
to: AccountKeyring::Ferdie.into(),
|
||||
amount: 42,
|
||||
nonce,
|
||||
}).unwrap();
|
||||
@@ -145,13 +147,14 @@ fn should_query_storage() {
|
||||
let block2_hash = add_block(1);
|
||||
let genesis_hash = client.genesis_hash();
|
||||
|
||||
let alice_balance_key = twox_128(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into()));
|
||||
|
||||
let mut expected = vec![
|
||||
StorageChangeSet {
|
||||
block: genesis_hash,
|
||||
changes: vec![
|
||||
(
|
||||
StorageKey("a52da2b7c269da1366b3ed1cdb7299ce".from_hex().unwrap()),
|
||||
StorageKey(alice_balance_key.to_vec()),
|
||||
Some(StorageData(vec![232, 3, 0, 0, 0, 0, 0, 0]))
|
||||
),
|
||||
],
|
||||
@@ -160,7 +163,7 @@ fn should_query_storage() {
|
||||
block: block1_hash,
|
||||
changes: vec![
|
||||
(
|
||||
StorageKey("a52da2b7c269da1366b3ed1cdb7299ce".from_hex().unwrap()),
|
||||
StorageKey(alice_balance_key.to_vec()),
|
||||
Some(StorageData(vec![190, 3, 0, 0, 0, 0, 0, 0]))
|
||||
),
|
||||
],
|
||||
@@ -169,7 +172,7 @@ fn should_query_storage() {
|
||||
|
||||
// Query changes only up to block1
|
||||
let result = api.query_storage(
|
||||
vec![StorageKey("a52da2b7c269da1366b3ed1cdb7299ce".from_hex().unwrap())],
|
||||
vec![StorageKey(alice_balance_key.to_vec())],
|
||||
genesis_hash,
|
||||
Some(block1_hash).into(),
|
||||
);
|
||||
@@ -178,7 +181,7 @@ fn should_query_storage() {
|
||||
|
||||
// Query all changes
|
||||
let result = api.query_storage(
|
||||
vec![StorageKey("a52da2b7c269da1366b3ed1cdb7299ce".from_hex().unwrap())],
|
||||
vec![StorageKey(alice_balance_key.to_vec())],
|
||||
genesis_hash,
|
||||
None.into(),
|
||||
);
|
||||
@@ -187,7 +190,7 @@ fn should_query_storage() {
|
||||
block: block2_hash,
|
||||
changes: vec![
|
||||
(
|
||||
StorageKey("a52da2b7c269da1366b3ed1cdb7299ce".from_hex().unwrap()),
|
||||
StorageKey(alice_balance_key.to_vec()),
|
||||
Some(StorageData(vec![148, 3, 0, 0, 0, 0, 0, 0]))
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user