Update session keys (with AuthorityDiscovery) (#1570)

* Update session keys (with AuthorityDiscovery)

* typo
This commit is contained in:
Jaco Greeff
2019-11-14 15:31:22 +01:00
committed by GitHub
parent 46b1429da9
commit be4b9a4133
3 changed files with 55 additions and 26 deletions
+19 -10
View File
@@ -18,7 +18,7 @@ import { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV
import { AuthorityIndex, AuthorityList, AuthorityWeight, NextAuthority, PendingPause, PendingResume, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline';
import { Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeysPolkadot, SessionKeysSubstrate } from '@polkadot/types/interfaces/session';
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeysPolkadot, SessionKeysSubstrate } from '@polkadot/types/interfaces/session';
import { EraIndex, EraPoints, EraRewards, Exposure, Forcing, IndividualExposure, MomentOf, Points, RewardDestination, SlashJournalEntry, StakingLedger, UnlockChunk, ValidatorPrefs, ValidatorPrefs0to145 } from '@polkadot/types/interfaces/staking';
import { DigestOf, DispatchError, Event, EventId, EventIndex, EventRecord, EventRecord0to76, Key, Phase } from '@polkadot/types/interfaces/system';
import { TreasuryProposal } from '@polkadot/types/interfaces/treasury';
@@ -565,6 +565,24 @@ export interface InterfaceRegistry {
Reporter: Reporter;
'Option<Reporter>': Option<Reporter>;
'Vec<Reporter>': Vec<Reporter>;
Keys: Keys;
'Option<Keys>': Option<Keys>;
'Vec<Keys>': Vec<Keys>;
SessionKeys3: SessionKeys3;
'Option<SessionKeys3>': Option<SessionKeys3>;
'Vec<SessionKeys3>': Vec<SessionKeys3>;
SessionKeys4: SessionKeys4;
'Option<SessionKeys4>': Option<SessionKeys4>;
'Vec<SessionKeys4>': Vec<SessionKeys4>;
SessionKeys5: SessionKeys5;
'Option<SessionKeys5>': Option<SessionKeys5>;
'Vec<SessionKeys5>': Vec<SessionKeys5>;
SessionKeysSubstrate: SessionKeysSubstrate;
'Option<SessionKeysSubstrate>': Option<SessionKeysSubstrate>;
'Vec<SessionKeysSubstrate>': Vec<SessionKeysSubstrate>;
SessionKeysPolkadot: SessionKeysPolkadot;
'Option<SessionKeysPolkadot>': Option<SessionKeysPolkadot>;
'Vec<SessionKeysPolkadot>': Vec<SessionKeysPolkadot>;
FullIdentification: FullIdentification;
'Option<FullIdentification>': Option<FullIdentification>;
'Vec<FullIdentification>': Vec<FullIdentification>;
@@ -575,15 +593,6 @@ export interface InterfaceRegistry {
'Compact<SessionIndex>': Compact<SessionIndex>;
'Option<SessionIndex>': Option<SessionIndex>;
'Vec<SessionIndex>': Vec<SessionIndex>;
Keys: Keys;
'Option<Keys>': Option<Keys>;
'Vec<Keys>': Vec<Keys>;
SessionKeysSubstrate: SessionKeysSubstrate;
'Option<SessionKeysSubstrate>': Option<SessionKeysSubstrate>;
'Vec<SessionKeysSubstrate>': Vec<SessionKeysSubstrate>;
SessionKeysPolkadot: SessionKeysPolkadot;
'Option<SessionKeysPolkadot>': Option<SessionKeysPolkadot>;
'Vec<SessionKeysPolkadot>': Vec<SessionKeysPolkadot>;
EraIndex: EraIndex;
'Compact<EraIndex>': Compact<EraIndex>;
'Option<EraIndex>': Option<EraIndex>;
@@ -2,21 +2,32 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// The runtime definition of SessionKeys are passed as a Trait to session
// Defined in `node/runtime/src/lib.rs` as follow
// impl_opaque_keys! {
// pub struct SessionKeys {
// Here we revert to tuples to keep the interfaces "opaque", as per the use
const keyTypes = {
// default to Substrate
Keys: 'SessionKeysSubstrate',
// shortcuts for 3, 4 & 5 key tuples
SessionKeys3: '(AccountId, AccountId, AccountId)',
SessionKeys4: '(AccountId, AccountId, AccountId, AccountId)',
SessionKeys5: '(AccountId, AccountId, AccountId, AccountId, AccountId)',
// For substrate: Grandpa, Babe, ImOnline, AuthorityDiscovery
SessionKeysSubstrate: 'SessionKeys4',
// For polkadot: Grandpa, Babe, ImOnline, Parachains
SessionKeysPolkadot: 'SessionKeys4'
};
export default {
types: {
...keyTypes,
FullIdentification: 'Exposure',
IdentificationTuple: '(ValidatorId, FullIdentification)',
SessionIndex: 'u32',
// The runtime definition of SessionKeys are passes as a Trait to session
// Defined in `node/runtime/src/lib.rs` as follow
// impl_opaque_keys! {
// pub struct SessionKeys {
// Here we revert to tuples to keep the interfaces "opaque", as per the use
Keys: 'SessionKeysSubstrate',
// For substrate: Grandpa, Babe, ImOnline
SessionKeysSubstrate: '(AccountId, AccountId, AccountId)',
// For polkadot: Grandpa, Babe, ImOnline, Parachains
SessionKeysPolkadot: '(AccountId, AccountId, AccountId, AccountId)'
SessionIndex: 'u32'
}
};
+13 -4
View File
@@ -18,8 +18,17 @@ export interface Keys extends SessionKeysSubstrate {}
/** u32 */
export interface SessionIndex extends u32 {}
/** ITuple<[AccountId, AccountId, AccountId, AccountId]> */
export interface SessionKeysPolkadot extends ITuple<[AccountId, AccountId, AccountId, AccountId]> {}
/** ITuple<[AccountId, AccountId, AccountId]> */
export interface SessionKeysSubstrate extends ITuple<[AccountId, AccountId, AccountId]> {}
export interface SessionKeys3 extends ITuple<[AccountId, AccountId, AccountId]> {}
/** ITuple<[AccountId, AccountId, AccountId, AccountId]> */
export interface SessionKeys4 extends ITuple<[AccountId, AccountId, AccountId, AccountId]> {}
/** ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId]> */
export interface SessionKeys5 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId]> {}
/** SessionKeys4 */
export interface SessionKeysPolkadot extends SessionKeys4 {}
/** SessionKeys4 */
export interface SessionKeysSubstrate extends SessionKeys4 {}