From 5b5d0a3fb8d493a37b831bbb765d237444824dd8 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Fri, 8 Nov 2019 14:45:48 +0100 Subject: [PATCH] Add AuthorityList types (#1557) --- packages/types/src/interfaceRegistry.ts | 9 ++++++++- .../types/src/interfaces/grandpa/definitions.ts | 6 ++++-- packages/types/src/interfaces/grandpa/types.ts | 14 ++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/packages/types/src/interfaceRegistry.ts b/packages/types/src/interfaceRegistry.ts index 37d79743b9..b44fef0e19 100644 --- a/packages/types/src/interfaceRegistry.ts +++ b/packages/types/src/interfaceRegistry.ts @@ -15,7 +15,7 @@ import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from import { AccountInfo, Amount, AssetOf, InherentOfflineReport, LockPeriods, NewAccountOutcome, OpaqueKey, SessionKey } from '@polkadot/types/interfaces/deprecated'; import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections'; import { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset'; -import { AuthorityWeight, NextAuthority, PendingPause, PendingResume, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa'; +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'; @@ -498,6 +498,13 @@ export interface InterfaceRegistry { PermissionLatest: PermissionLatest; 'Option': Option; 'Vec': Vec; + AuthorityIndex: AuthorityIndex; + 'Compact': Compact; + 'Option': Option; + 'Vec': Vec; + AuthorityList: AuthorityList; + 'Option': Option; + 'Vec': Vec; AuthorityWeight: AuthorityWeight; 'Compact': Compact; 'Option': Option; diff --git a/packages/types/src/interfaces/grandpa/definitions.ts b/packages/types/src/interfaces/grandpa/definitions.ts index 48ddce95d4..6ba62edd8d 100644 --- a/packages/types/src/interfaces/grandpa/definitions.ts +++ b/packages/types/src/interfaces/grandpa/definitions.ts @@ -4,8 +4,10 @@ export default { types: { + AuthorityIndex: 'u64', + AuthorityList: 'Vec', AuthorityWeight: 'u64', - NextAuthority: '(AuthorityId, u64)', + NextAuthority: '(AuthorityId, AuthorityWeight)', PendingPause: { /// Block at which the intention to pause was scheduled. scheduledAt: 'BlockNumber', @@ -22,7 +24,7 @@ export default { StoredPendingChange: { scheduledAt: 'BlockNumber', delay: 'BlockNumber', - nextAuthorities: 'Vec' + nextAuthorities: 'AuthorityList' }, StoredState: { _enum: { diff --git a/packages/types/src/interfaces/grandpa/types.ts b/packages/types/src/interfaces/grandpa/types.ts index 6b802c1866..7da2148e3d 100644 --- a/packages/types/src/interfaces/grandpa/types.ts +++ b/packages/types/src/interfaces/grandpa/types.ts @@ -7,11 +7,17 @@ import { u64 } from '@polkadot/types/primitive'; import { BlockNumber } from '@polkadot/types/interfaces/runtime'; import { AuthorityId } from '@polkadot/types/interfaces/consensus'; +/** u64 */ +export interface AuthorityIndex extends u64 {} + +/** Vec */ +export interface AuthorityList extends Vec {} + /** u64 */ export interface AuthorityWeight extends u64 {} -/** ITuple<[AuthorityId, u64]> */ -export interface NextAuthority extends ITuple<[AuthorityId, u64]> {} +/** ITuple<[AuthorityId, AuthorityWeight]> */ +export interface NextAuthority extends ITuple<[AuthorityId, AuthorityWeight]> {} /** Struct */ export interface PendingPause extends Struct { @@ -38,8 +44,8 @@ export interface StoredPendingChange extends Struct { readonly scheduledAt: BlockNumber; /** BlockNumber */ readonly delay: BlockNumber; - /** Vec */ - readonly nextAuthorities: Vec; + /** AuthorityList */ + readonly nextAuthorities: AuthorityList; } /** Enum */