mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 02:21:14 +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:
@@ -67,6 +67,7 @@ use crate::account_db::AccountDb;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use serde_derive::{Serialize, Deserialize};
|
||||
use substrate_primitives::crypto::UncheckedFrom;
|
||||
use rstd::prelude::*;
|
||||
use rstd::marker::PhantomData;
|
||||
use parity_codec::{Codec, Encode, Decode};
|
||||
@@ -120,7 +121,7 @@ pub trait Trait: fees::Trait + balances::Trait + timestamp::Trait {
|
||||
pub struct SimpleAddressDeterminator<T: Trait>(PhantomData<T>);
|
||||
impl<T: Trait> ContractAddressFor<CodeHash<T>, T::AccountId> for SimpleAddressDeterminator<T>
|
||||
where
|
||||
T::AccountId: From<T::Hash> + AsRef<[u8]>
|
||||
T::AccountId: UncheckedFrom<T::Hash> + AsRef<[u8]>
|
||||
{
|
||||
fn contract_address_for(code_hash: &CodeHash<T>, data: &[u8], origin: &T::AccountId) -> T::AccountId {
|
||||
let data_hash = T::Hashing::hash(data);
|
||||
@@ -130,7 +131,7 @@ where
|
||||
buf.extend_from_slice(data_hash.as_ref());
|
||||
buf.extend_from_slice(origin.as_ref());
|
||||
|
||||
T::Hashing::hash(&buf[..]).into()
|
||||
UncheckedFrom::unchecked_from(T::Hashing::hash(&buf[..]))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -580,7 +580,7 @@ mod tests {
|
||||
|
||||
/// calls `ext_caller`, loads the address from the scratch buffer and
|
||||
/// compares it with the constant 42.
|
||||
const CODE_CALLER: &'static str = r#"
|
||||
const CODE_CALLER: &str = r#"
|
||||
(module
|
||||
(import "env" "ext_caller" (func $ext_caller))
|
||||
(import "env" "ext_scratch_size" (func $ext_scratch_size (result i32)))
|
||||
@@ -645,7 +645,7 @@ mod tests {
|
||||
|
||||
/// calls `ext_address`, loads the address from the scratch buffer and
|
||||
/// compares it with the constant 69.
|
||||
const CODE_ADDRESS: &'static str = r#"
|
||||
const CODE_ADDRESS: &str = r#"
|
||||
(module
|
||||
(import "env" "ext_address" (func $ext_address))
|
||||
(import "env" "ext_scratch_size" (func $ext_scratch_size (result i32)))
|
||||
|
||||
Reference in New Issue
Block a user