diff --git a/packages/types/src/augment/registry.ts b/packages/types/src/augment/registry.ts index 5c5f07b32c6b..f9698c738332 100644 --- a/packages/types/src/augment/registry.ts +++ b/packages/types/src/augment/registry.ts @@ -21,7 +21,7 @@ import { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine'; import { Account, Log } from '@polkadot/types/interfaces/evm'; import { EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics'; import { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset'; -import { AuthorityIndex, AuthorityList, AuthorityWeight, NextAuthority, PendingPause, PendingResume, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa'; +import { AuthorityIndex, AuthorityList, AuthorityWeight, Equivocation, EquivocationProof, GrandpaEquivocation, GrandpaPrevote, KeyOwnerProof, NextAuthority, PendingPause, PendingResume, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa'; import { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityJudgement, RegistrarIndex, RegistrarInfo, Registration, RegistrationJudgement } from '@polkadot/types/interfaces/identity'; import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline'; import { CallMetadataV0, DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV11, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapTypeLatest, MapTypeV0, MapTypeV10, MapTypeV11, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV11, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV11, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV4, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataLatest, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata'; @@ -33,7 +33,7 @@ import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recov import { RpcMethods } from '@polkadot/types/interfaces/rpc'; import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime'; import { SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler'; -import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6 } from '@polkadot/types/interfaces/session'; +import { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, ValidatorCount } from '@polkadot/types/interfaces/session'; import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society'; import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, OffchainAccuracy, PerU16, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking'; import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state'; @@ -633,6 +633,21 @@ declare module '@polkadot/types/types/registry' { 'Compact': Compact; 'Option': Option; 'Vec': Vec; + Equivocation: Equivocation; + 'Option': Option; + 'Vec': Vec; + EquivocationProof: EquivocationProof; + 'Option': Option; + 'Vec': Vec; + GrandpaEquivocation: GrandpaEquivocation; + 'Option': Option; + 'Vec': Vec; + GrandpaPrevote: GrandpaPrevote; + 'Option': Option; + 'Vec': Vec; + KeyOwnerProof: KeyOwnerProof; + 'Option': Option; + 'Vec': Vec; NextAuthority: NextAuthority; 'Option': Option; 'Vec': Vec; @@ -763,10 +778,17 @@ declare module '@polkadot/types/types/registry' { IdentificationTuple: IdentificationTuple; 'Option': Option; 'Vec': Vec; + MembershipProof: MembershipProof; + 'Option': Option; + 'Vec': Vec; SessionIndex: SessionIndex; 'Compact': Compact; 'Option': Option; 'Vec': Vec; + ValidatorCount: ValidatorCount; + 'Compact': Compact; + 'Option': Option; + 'Vec': Vec; Bid: Bid; 'Option': Option; 'Vec': Vec; diff --git a/packages/types/src/extrinsic/signedExtensions/substrate.ts b/packages/types/src/extrinsic/signedExtensions/substrate.ts index dc498d32cd33..b31d4459fe7c 100644 --- a/packages/types/src/extrinsic/signedExtensions/substrate.ts +++ b/packages/types/src/extrinsic/signedExtensions/substrate.ts @@ -48,5 +48,9 @@ export default { LockStakingStatus: { extra: {}, types: {} + }, + ValidateEquivocationReport: { + extra: {}, + types: {} } } as ExtDef; diff --git a/packages/types/src/interfaces/grandpa/definitions.ts b/packages/types/src/interfaces/grandpa/definitions.ts index 4903c79c00ce..28d77a300f77 100644 --- a/packages/types/src/interfaces/grandpa/definitions.ts +++ b/packages/types/src/interfaces/grandpa/definitions.ts @@ -13,6 +13,27 @@ export default { AuthorityIndex: 'u64', AuthorityList: 'Vec', AuthorityWeight: 'u64', + Equivocation: { + _enum: { + Prevote: 'GrandpaEquivocation', + Precommit: 'GrandpaEquivocation' + } + }, + EquivocationProof: { + setId: 'SetId', + equivocation: 'Equivocation' + }, + GrandpaEquivocation: { + roundNumber: 'u64', + identity: 'AuthorityId', + first: '(GrandpaPrevote, AuthoritySignature)', + second: '(GrandpaPrevote, AuthoritySignature)' + }, + GrandpaPrevote: { + targetHash: 'Hash', + targetNumber: 'BlockNumber' + }, + KeyOwnerProof: 'MembershipProof', NextAuthority: '(AuthorityId, AuthorityWeight)', PendingPause: { /// Block at which the intention to pause was scheduled. diff --git a/packages/types/src/interfaces/grandpa/types.ts b/packages/types/src/interfaces/grandpa/types.ts index e140ffbf6376..8dde9b92d593 100644 --- a/packages/types/src/interfaces/grandpa/types.ts +++ b/packages/types/src/interfaces/grandpa/types.ts @@ -5,7 +5,9 @@ import { ITuple } from '@polkadot/types/types'; import { Enum, Struct, Vec } from '@polkadot/types/codec'; import { u64 } from '@polkadot/types/primitive'; import { AuthorityId } from '@polkadot/types/interfaces/consensus'; -import { BlockNumber } from '@polkadot/types/interfaces/runtime'; +import { AuthoritySignature } from '@polkadot/types/interfaces/imOnline'; +import { BlockNumber, Hash } from '@polkadot/types/interfaces/runtime'; +import { MembershipProof } from '@polkadot/types/interfaces/session'; /** @name AuthorityIndex */ export interface AuthorityIndex extends u64 {} @@ -16,6 +18,37 @@ export interface AuthorityList extends Vec {} /** @name AuthorityWeight */ export interface AuthorityWeight extends u64 {} +/** @name Equivocation */ +export interface Equivocation extends Enum { + readonly isPrevote: boolean; + readonly asPrevote: GrandpaEquivocation; + readonly isPrecommit: boolean; + readonly asPrecommit: GrandpaEquivocation; +} + +/** @name EquivocationProof */ +export interface EquivocationProof extends Struct { + readonly setId: SetId; + readonly equivocation: Equivocation; +} + +/** @name GrandpaEquivocation */ +export interface GrandpaEquivocation extends Struct { + readonly roundNumber: u64; + readonly identity: AuthorityId; + readonly first: ITuple<[GrandpaPrevote, AuthoritySignature]>; + readonly second: ITuple<[GrandpaPrevote, AuthoritySignature]>; +} + +/** @name GrandpaPrevote */ +export interface GrandpaPrevote extends Struct { + readonly targetHash: Hash; + readonly targetNumber: BlockNumber; +} + +/** @name KeyOwnerProof */ +export interface KeyOwnerProof extends MembershipProof {} + /** @name NextAuthority */ export interface NextAuthority extends ITuple<[AuthorityId, AuthorityWeight]> {} diff --git a/packages/types/src/interfaces/session/definitions.ts b/packages/types/src/interfaces/session/definitions.ts index 8c7f4dc8924c..ea087a4fe780 100644 --- a/packages/types/src/interfaces/session/definitions.ts +++ b/packages/types/src/interfaces/session/definitions.ts @@ -34,6 +34,12 @@ export default { ...keyTypes, FullIdentification: 'Exposure', IdentificationTuple: '(ValidatorId, FullIdentification)', - SessionIndex: 'u32' + MembershipProof: { + session: 'SessionIndex', + trieNodes: 'Vec>', + validatorCount: 'ValidatorCount' + }, + SessionIndex: 'u32', + ValidatorCount: 'u32' } } as Definitions; diff --git a/packages/types/src/interfaces/session/types.ts b/packages/types/src/interfaces/session/types.ts index 07a5622ff669..277a07403c50 100644 --- a/packages/types/src/interfaces/session/types.ts +++ b/packages/types/src/interfaces/session/types.ts @@ -2,7 +2,8 @@ /* eslint-disable */ import { ITuple } from '@polkadot/types/types'; -import { u32 } from '@polkadot/types/primitive'; +import { Struct, Vec } from '@polkadot/types/codec'; +import { Bytes, u32 } from '@polkadot/types/primitive'; import { AccountId, ValidatorId } from '@polkadot/types/interfaces/runtime'; import { Exposure } from '@polkadot/types/interfaces/staking'; @@ -15,6 +16,13 @@ export interface IdentificationTuple extends ITuple<[ValidatorId, FullIdentifica /** @name Keys */ export interface Keys extends SessionKeys4 {} +/** @name MembershipProof */ +export interface MembershipProof extends Struct { + readonly session: SessionIndex; + readonly trieNodes: Vec; + readonly validatorCount: ValidatorCount; +} + /** @name SessionIndex */ export interface SessionIndex extends u32 {} @@ -36,4 +44,7 @@ export interface SessionKeys5 extends ITuple<[AccountId, AccountId, AccountId, A /** @name SessionKeys6 */ export interface SessionKeys6 extends ITuple<[AccountId, AccountId, AccountId, AccountId, AccountId, AccountId]> {} +/** @name ValidatorCount */ +export interface ValidatorCount extends u32 {} + export type PHANTOM_SESSION = 'session';