Grandpa Equivocation types (#2239)

* Grandpa Equivocation types

* typo
This commit is contained in:
Jaco Greeff
2020-05-06 10:25:37 +02:00
committed by GitHub
parent 8bb1d1259e
commit f5d2449407
6 changed files with 102 additions and 5 deletions
+24 -2
View File
@@ -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<AuthorityWeight>': Compact<AuthorityWeight>;
'Option<AuthorityWeight>': Option<AuthorityWeight>;
'Vec<AuthorityWeight>': Vec<AuthorityWeight>;
Equivocation: Equivocation;
'Option<Equivocation>': Option<Equivocation>;
'Vec<Equivocation>': Vec<Equivocation>;
EquivocationProof: EquivocationProof;
'Option<EquivocationProof>': Option<EquivocationProof>;
'Vec<EquivocationProof>': Vec<EquivocationProof>;
GrandpaEquivocation: GrandpaEquivocation;
'Option<GrandpaEquivocation>': Option<GrandpaEquivocation>;
'Vec<GrandpaEquivocation>': Vec<GrandpaEquivocation>;
GrandpaPrevote: GrandpaPrevote;
'Option<GrandpaPrevote>': Option<GrandpaPrevote>;
'Vec<GrandpaPrevote>': Vec<GrandpaPrevote>;
KeyOwnerProof: KeyOwnerProof;
'Option<KeyOwnerProof>': Option<KeyOwnerProof>;
'Vec<KeyOwnerProof>': Vec<KeyOwnerProof>;
NextAuthority: NextAuthority;
'Option<NextAuthority>': Option<NextAuthority>;
'Vec<NextAuthority>': Vec<NextAuthority>;
@@ -763,10 +778,17 @@ declare module '@polkadot/types/types/registry' {
IdentificationTuple: IdentificationTuple;
'Option<IdentificationTuple>': Option<IdentificationTuple>;
'Vec<IdentificationTuple>': Vec<IdentificationTuple>;
MembershipProof: MembershipProof;
'Option<MembershipProof>': Option<MembershipProof>;
'Vec<MembershipProof>': Vec<MembershipProof>;
SessionIndex: SessionIndex;
'Compact<SessionIndex>': Compact<SessionIndex>;
'Option<SessionIndex>': Option<SessionIndex>;
'Vec<SessionIndex>': Vec<SessionIndex>;
ValidatorCount: ValidatorCount;
'Compact<ValidatorCount>': Compact<ValidatorCount>;
'Option<ValidatorCount>': Option<ValidatorCount>;
'Vec<ValidatorCount>': Vec<ValidatorCount>;
Bid: Bid;
'Option<Bid>': Option<Bid>;
'Vec<Bid>': Vec<Bid>;
@@ -48,5 +48,9 @@ export default {
LockStakingStatus: {
extra: {},
types: {}
},
ValidateEquivocationReport: {
extra: {},
types: {}
}
} as ExtDef;
@@ -13,6 +13,27 @@ export default {
AuthorityIndex: 'u64',
AuthorityList: 'Vec<NextAuthority>',
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.
+34 -1
View File
@@ -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<NextAuthority> {}
/** @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]> {}
@@ -34,6 +34,12 @@ export default {
...keyTypes,
FullIdentification: 'Exposure',
IdentificationTuple: '(ValidatorId, FullIdentification)',
SessionIndex: 'u32'
MembershipProof: {
session: 'SessionIndex',
trieNodes: 'Vec<Vec<u8>>',
validatorCount: 'ValidatorCount'
},
SessionIndex: 'u32',
ValidatorCount: 'u32'
}
} as Definitions;
+12 -1
View File
@@ -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<Bytes>;
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';