Add Polkadot AuthorityDiscovery session keys (#1573)
* Add Polkadot AuthorityDiscovery session keys * SessionKey5 based on CC3 specVersion
This commit is contained in:
@@ -19,9 +19,15 @@ interface VersionedType {
|
||||
// definition as applicable. (4 keys in substrate vs 5 in Polkadot/CC3).
|
||||
const TYPES_POLKADOT_VERSIONED: VersionedType[] = [
|
||||
{
|
||||
minmax: [0, undefined],
|
||||
minmax: [0, 1018], // CC2
|
||||
types: {
|
||||
Keys: 'SessionKeysPolkadot'
|
||||
Keys: 'SessionKeys4'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [1019, undefined], // CC3
|
||||
types: {
|
||||
Keys: 'SessionKeys5'
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -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, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeysPolkadot, SessionKeysSubstrate } from '@polkadot/types/interfaces/session';
|
||||
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6 } from '@polkadot/types/interfaces/session';
|
||||
import { EraIndex, EraPoints, EraRewards, Exposure, Forcing, IndividualExposure, MomentOf, Nominations, Points, RewardDestination, SlashJournalEntry, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, UnappliedSlashOther, 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';
|
||||
@@ -574,6 +574,12 @@ export interface InterfaceRegistry {
|
||||
Keys: Keys;
|
||||
'Option<Keys>': Option<Keys>;
|
||||
'Vec<Keys>': Vec<Keys>;
|
||||
SessionKeys1: SessionKeys1;
|
||||
'Option<SessionKeys1>': Option<SessionKeys1>;
|
||||
'Vec<SessionKeys1>': Vec<SessionKeys1>;
|
||||
SessionKeys2: SessionKeys2;
|
||||
'Option<SessionKeys2>': Option<SessionKeys2>;
|
||||
'Vec<SessionKeys2>': Vec<SessionKeys2>;
|
||||
SessionKeys3: SessionKeys3;
|
||||
'Option<SessionKeys3>': Option<SessionKeys3>;
|
||||
'Vec<SessionKeys3>': Vec<SessionKeys3>;
|
||||
@@ -583,12 +589,9 @@ export interface InterfaceRegistry {
|
||||
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>;
|
||||
SessionKeys6: SessionKeys6;
|
||||
'Option<SessionKeys6>': Option<SessionKeys6>;
|
||||
'Vec<SessionKeys6>': Vec<SessionKeys6>;
|
||||
FullIdentification: FullIdentification;
|
||||
'Option<FullIdentification>': Option<FullIdentification>;
|
||||
'Vec<FullIdentification>': Vec<FullIdentification>;
|
||||
|
||||
@@ -8,19 +8,19 @@
|
||||
// pub struct SessionKeys {
|
||||
// Here we revert to tuples to keep the interfaces "opaque", as per the use
|
||||
const keyTypes = {
|
||||
// default to Substrate
|
||||
Keys: 'SessionKeysSubstrate',
|
||||
// default to Substrate master defaults, 4 keys (polkadot master, 5 keys)
|
||||
Keys: 'SessionKeys4',
|
||||
|
||||
// shortcuts for 3, 4 & 5 key tuples
|
||||
// shortcuts for 1, 2, 3, 4, 5 & 6 key tuples
|
||||
SessionKeys1: '(AccountId)',
|
||||
SessionKeys2: '(AccountId, AccountId)',
|
||||
// older substrate master
|
||||
SessionKeys3: '(AccountId, AccountId, AccountId)',
|
||||
// CC2, Substrate master
|
||||
SessionKeys4: '(AccountId, AccountId, AccountId, AccountId)',
|
||||
// CC3
|
||||
SessionKeys5: '(AccountId, AccountId, AccountId, AccountId, AccountId)',
|
||||
|
||||
// For substrate: Grandpa, Babe, ImOnline, AuthorityDiscovery
|
||||
SessionKeysSubstrate: 'SessionKeys4',
|
||||
|
||||
// For polkadot: Grandpa, Babe, ImOnline, Parachains
|
||||
SessionKeysPolkadot: 'SessionKeys4'
|
||||
SessionKeys6: '(AccountId, AccountId, AccountId, AccountId, AccountId, AccountId)'
|
||||
};
|
||||
|
||||
export default {
|
||||
|
||||
@@ -12,12 +12,18 @@ export interface FullIdentification extends Exposure {}
|
||||
/** ITuple<[ValidatorId, FullIdentification]> */
|
||||
export interface IdentificationTuple extends ITuple<[ValidatorId, FullIdentification]> {}
|
||||
|
||||
/** SessionKeysSubstrate */
|
||||
export interface Keys extends SessionKeysSubstrate {}
|
||||
/** SessionKeys4 */
|
||||
export interface Keys extends SessionKeys4 {}
|
||||
|
||||
/** u32 */
|
||||
export interface SessionIndex extends u32 {}
|
||||
|
||||
/** AccountId */
|
||||
export interface SessionKeys1 extends AccountId {}
|
||||
|
||||
/** ITuple<[AccountId, AccountId]> */
|
||||
export interface SessionKeys2 extends ITuple<[AccountId, AccountId]> {}
|
||||
|
||||
/** ITuple<[AccountId, AccountId, AccountId]> */
|
||||
export interface SessionKeys3 extends ITuple<[AccountId, AccountId, AccountId]> {}
|
||||
|
||||
@@ -27,8 +33,5 @@ export interface SessionKeys4 extends ITuple<[AccountId, AccountId, AccountId, A
|
||||
/** 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 {}
|
||||
/** ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> */
|
||||
export interface SessionKeys6 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {}
|
||||
|
||||
Reference in New Issue
Block a user