diff --git a/packages/api/src/augment/tx.ts b/packages/api/src/augment/tx.ts index 77b5c427b8..37fb5e17f0 100644 --- a/packages/api/src/augment/tx.ts +++ b/packages/api/src/augment/tx.ts @@ -9,7 +9,7 @@ import { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts'; import { AccountVote, Conviction, PropIndex, Proposal, ReferendumIndex } from '@polkadot/types/interfaces/democracy'; import { DefunctVoter, Renouncing } from '@polkadot/types/interfaces/elections'; import { Extrinsic, Signature } from '@polkadot/types/interfaces/extrinsics'; -import { EquivocationProof, KeyOwnerProof } from '@polkadot/types/interfaces/grandpa'; +import { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/interfaces/grandpa'; import { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity'; import { Heartbeat } from '@polkadot/types/interfaces/imOnline'; import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, Perbill, Percent, ProxyType, Weight } from '@polkadot/types/interfaces/runtime'; @@ -878,7 +878,7 @@ declare module '@polkadot/api/types/submittable' { * submission of invalid equivocation reports, a mandatory pre-validation of * the extrinsic is implemented in a `SignedExtension`. **/ - reportEquivocation: AugmentedSubmittable<(equivocationProof: EquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic>; + reportEquivocation: AugmentedSubmittable<(equivocationProof: GrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic>; }; identity: { [index: string]: SubmittableExtrinsicFunction; diff --git a/packages/metadata/src/Metadata/v11/static-substrate.json b/packages/metadata/src/Metadata/v11/static-substrate.json index 7e5aeb15d0..88e4fbb847 100644 --- a/packages/metadata/src/Metadata/v11/static-substrate.json +++ b/packages/metadata/src/Metadata/v11/static-substrate.json @@ -6391,7 +6391,7 @@ "args": [ { "name": "equivocation_proof", - "type": "EquivocationProof" + "type": "GrandpaEquivocationProof" }, { "name": "key_owner_proof", diff --git a/packages/types-known/src/modules.ts b/packages/types-known/src/modules.ts index 8100d0f5d2..b231cb12a2 100644 --- a/packages/types-known/src/modules.ts +++ b/packages/types-known/src/modules.ts @@ -6,6 +6,9 @@ import { OverrideModuleType } from '@polkadot/types/types'; // type overrides for modules (where duplication between modules exist) const typesModules: Record = { + babe: { + EquivocationProof: 'BabeEquivocationProof' + }, balances: { Releases: 'ReleasesBalances', Status: 'BalanceStatus' @@ -20,6 +23,10 @@ const typesModules: Record = { democracy: { Releases: 'ReleasesDemocracy' }, + grandpa: { + Equivocation: 'GrandpaEquivocation', + EquivocationProof: 'GrandpaEquivocationProof' + }, identity: { Judgement: 'IdentityJudgement' }, diff --git a/packages/types/src/augment/registry.ts b/packages/types/src/augment/registry.ts index d12f9ec75a..7e3c8d5776 100644 --- a/packages/types/src/augment/registry.ts +++ b/packages/types/src/augment/registry.ts @@ -7,7 +7,7 @@ import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/t import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura'; import { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author'; import { UncleEntryItem } from '@polkadot/types/interfaces/authorship'; -import { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe'; +import { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEquivocationProof, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe'; import { AccountData, BalanceLock, BalanceLockTo212, BalanceStatus, Reasons, ReleasesBalances, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances'; import { BlockHash } from '@polkadot/types/interfaces/chain'; import { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate'; @@ -21,7 +21,7 @@ import { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine'; import { Account, Log, Vicinity } 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, Equivocation, EquivocationProof, GrandpaEquivocation, GrandpaPrevote, KeyOwnerProof, NextAuthority, PendingPause, PendingResume, Precommits, Prevotes, ReportedRoundStates, RoundState, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa'; +import { AuthorityIndex, AuthorityList, AuthorityWeight, GrandpaEquivocation, GrandpaEquivocationProof, GrandpaEquivocationValue, GrandpaPrevote, KeyOwnerProof, NextAuthority, PendingPause, PendingResume, Precommits, Prevotes, ReportedRoundStates, RoundState, 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, HeartbeatTo244, 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'; @@ -304,16 +304,19 @@ declare module '@polkadot/types/types/registry' { 'Compact': Compact; 'Option': Option; 'Vec': Vec; + BabeEquivocationProof: BabeEquivocationProof; + 'Option': Option; + 'Vec': Vec; + BabeWeight: BabeWeight; + 'Compact': Compact; + 'Option': Option; + 'Vec': Vec; MaybeRandomness: MaybeRandomness; 'Option': Option; 'Vec': Vec; MaybeVrf: MaybeVrf; 'Option': Option; 'Vec': Vec; - BabeWeight: BabeWeight; - 'Compact': Compact; - 'Option': Option; - 'Vec': Vec; EpochAuthorship: EpochAuthorship; 'Option': Option; 'Vec': Vec; @@ -664,15 +667,15 @@ 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; + GrandpaEquivocationProof: GrandpaEquivocationProof; + 'Option': Option; + 'Vec': Vec; + GrandpaEquivocationValue: GrandpaEquivocationValue; + 'Option': Option; + 'Vec': Vec; GrandpaPrevote: GrandpaPrevote; 'Option': Option; 'Vec': Vec; diff --git a/packages/types/src/interfaces/babe/definitions.ts b/packages/types/src/interfaces/babe/definitions.ts index 48fdd68f86..08846a5cbe 100644 --- a/packages/types/src/interfaces/babe/definitions.ts +++ b/packages/types/src/interfaces/babe/definitions.ts @@ -21,10 +21,15 @@ export default { }, BabeAuthorityWeight: 'u64', BabeBlockWeight: 'u32', + BabeEquivocationProof: { + offender: 'AuthorityId', + slotNumber: 'SlotNumber', + firstHeader: 'Header', + secondHeader: 'Header' + }, + BabeWeight: 'u64', MaybeRandomness: 'Option', MaybeVrf: 'Option', - // TODO Remove as soon as merged and metadata static updated - BabeWeight: 'u64', EpochAuthorship: { primary: 'Vec', secondary: 'Vec' diff --git a/packages/types/src/interfaces/babe/types.ts b/packages/types/src/interfaces/babe/types.ts index d6350accac..91dd36a60a 100644 --- a/packages/types/src/interfaces/babe/types.ts +++ b/packages/types/src/interfaces/babe/types.ts @@ -4,7 +4,8 @@ import { ITuple } from '@polkadot/types/types'; import { Enum, Option, Struct, U8aFixed, Vec } from '@polkadot/types/codec'; import { u32, u64 } from '@polkadot/types/primitive'; -import { Hash } from '@polkadot/types/interfaces/runtime'; +import { AuthorityId } from '@polkadot/types/interfaces/consensus'; +import { Hash, Header } from '@polkadot/types/interfaces/runtime'; /** @name AllowedSlots */ export interface AllowedSlots extends Enum { @@ -19,6 +20,14 @@ export interface BabeAuthorityWeight extends u64 {} /** @name BabeBlockWeight */ export interface BabeBlockWeight extends u32 {} +/** @name BabeEquivocationProof */ +export interface BabeEquivocationProof extends Struct { + readonly offender: AuthorityId; + readonly slotNumber: SlotNumber; + readonly firstHeader: Header; + readonly secondHeader: Header; +} + /** @name BabeWeight */ export interface BabeWeight extends u64 {} diff --git a/packages/types/src/interfaces/grandpa/definitions.ts b/packages/types/src/interfaces/grandpa/definitions.ts index 0e18bc1fa3..ddcbdc5da5 100644 --- a/packages/types/src/interfaces/grandpa/definitions.ts +++ b/packages/types/src/interfaces/grandpa/definitions.ts @@ -19,17 +19,17 @@ export default { AuthorityIndex: 'u64', AuthorityList: 'Vec', AuthorityWeight: 'u64', - Equivocation: { + GrandpaEquivocation: { _enum: { - Prevote: 'GrandpaEquivocation', - Precommit: 'GrandpaEquivocation' + Prevote: 'GrandpaEquivocationValue', + Precommit: 'GrandpaEquivocationValue' } }, - EquivocationProof: { + GrandpaEquivocationProof: { setId: 'SetId', - equivocation: 'Equivocation' + equivocation: 'GrandpaEquivocation' }, - GrandpaEquivocation: { + GrandpaEquivocationValue: { roundNumber: 'u64', identity: 'AuthorityId', first: '(GrandpaPrevote, AuthoritySignature)', diff --git a/packages/types/src/interfaces/grandpa/types.ts b/packages/types/src/interfaces/grandpa/types.ts index 443e0b1681..bdb6115ff7 100644 --- a/packages/types/src/interfaces/grandpa/types.ts +++ b/packages/types/src/interfaces/grandpa/types.ts @@ -18,22 +18,22 @@ 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 { +export interface GrandpaEquivocation extends Enum { + readonly isPrevote: boolean; + readonly asPrevote: GrandpaEquivocationValue; + readonly isPrecommit: boolean; + readonly asPrecommit: GrandpaEquivocationValue; +} + +/** @name GrandpaEquivocationProof */ +export interface GrandpaEquivocationProof extends Struct { + readonly setId: SetId; + readonly equivocation: GrandpaEquivocation; +} + +/** @name GrandpaEquivocationValue */ +export interface GrandpaEquivocationValue extends Struct { readonly roundNumber: u64; readonly identity: AuthorityId; readonly first: ITuple<[GrandpaPrevote, AuthoritySignature]>;