mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 12:38:04 +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:
@@ -27,7 +27,7 @@ use support::{Serialize, Deserialize};
|
||||
use support::construct_runtime;
|
||||
use substrate_primitives::u32_trait::{_2, _4};
|
||||
use node_primitives::{
|
||||
AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, SessionKey, Signature
|
||||
AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, AuthorityId, Signature, AuthoritySignature
|
||||
};
|
||||
use grandpa::fg_primitives::{self, ScheduledChange};
|
||||
use client::{
|
||||
@@ -37,7 +37,7 @@ use client::{
|
||||
use runtime_primitives::{ApplyResult, generic, create_runtime_str};
|
||||
use runtime_primitives::transaction_validity::TransactionValidity;
|
||||
use runtime_primitives::traits::{
|
||||
Convert, BlakeTwo256, Block as BlockT, DigestFor, NumberFor, StaticLookup,
|
||||
BlakeTwo256, Block as BlockT, DigestFor, NumberFor, StaticLookup,
|
||||
};
|
||||
use version::RuntimeVersion;
|
||||
use council::{motions as council_motions, voting as council_voting};
|
||||
@@ -60,7 +60,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("node"),
|
||||
impl_name: create_runtime_str!("substrate-node"),
|
||||
authoring_version: 10,
|
||||
spec_version: 34,
|
||||
spec_version: 35,
|
||||
impl_version: 35,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
};
|
||||
@@ -113,7 +113,7 @@ impl fees::Trait for Runtime {
|
||||
|
||||
impl consensus::Trait for Runtime {
|
||||
type Log = Log;
|
||||
type SessionKey = SessionKey;
|
||||
type SessionKey = AuthorityId;
|
||||
|
||||
// The Aura module handles offline-reports internally
|
||||
// rather than using an explicit report system.
|
||||
@@ -125,16 +125,8 @@ impl timestamp::Trait for Runtime {
|
||||
type OnTimestampSet = Aura;
|
||||
}
|
||||
|
||||
/// Session key conversion.
|
||||
pub struct SessionKeyConversion;
|
||||
impl Convert<AccountId, SessionKey> for SessionKeyConversion {
|
||||
fn convert(a: AccountId) -> SessionKey {
|
||||
a.to_fixed_bytes().into()
|
||||
}
|
||||
}
|
||||
|
||||
impl session::Trait for Runtime {
|
||||
type ConvertAccountIdToSessionKey = SessionKeyConversion;
|
||||
type ConvertAccountIdToSessionKey = ();
|
||||
type OnSessionChange = (Staking, grandpa::SyncedAuthorities<Runtime>);
|
||||
type Event = Event;
|
||||
}
|
||||
@@ -186,7 +178,7 @@ impl sudo::Trait for Runtime {
|
||||
}
|
||||
|
||||
impl grandpa::Trait for Runtime {
|
||||
type SessionKey = SessionKey;
|
||||
type SessionKey = AuthorityId;
|
||||
type Log = Log;
|
||||
type Event = Event;
|
||||
}
|
||||
@@ -196,7 +188,7 @@ impl finality_tracker::Trait for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime!(
|
||||
pub enum Runtime with Log(InternalLog: DigestItem<Hash, SessionKey>) where
|
||||
pub enum Runtime with Log(InternalLog: DigestItem<Hash, AuthorityId, AuthoritySignature>) where
|
||||
Block = Block,
|
||||
NodeBlock = node_primitives::Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
@@ -246,7 +238,7 @@ impl_runtime_apis! {
|
||||
VERSION
|
||||
}
|
||||
|
||||
fn authorities() -> Vec<SessionKey> {
|
||||
fn authorities() -> Vec<AuthorityId> {
|
||||
Consensus::authorities()
|
||||
}
|
||||
|
||||
@@ -322,7 +314,7 @@ impl_runtime_apis! {
|
||||
None
|
||||
}
|
||||
|
||||
fn grandpa_authorities() -> Vec<(SessionKey, u64)> {
|
||||
fn grandpa_authorities() -> Vec<(AuthorityId, u64)> {
|
||||
Grandpa::grandpa_authorities()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user