diff --git a/packages/api-augment/src/kusama/runtime.ts b/packages/api-augment/src/kusama/runtime.ts index 25efde00a5..fcda1a03ab 100644 --- a/packages/api-augment/src/kusama/runtime.ts +++ b/packages/api-augment/src/kusama/runtime.ts @@ -9,7 +9,7 @@ import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-b import type { Bytes, Null, Option, Result, Vec, bool, u32 } from '@polkadot/types-codec'; import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types'; import type { BabeEquivocationProof, BabeGenesisConfiguration, Epoch, OpaqueKeyOwnershipProof } from '@polkadot/types/interfaces/babe'; -import type { ValidatorSet } from '@polkadot/types/interfaces/beefy'; +import type { BeefyEquivocationProof, ValidatorSet, ValidatorSetId } from '@polkadot/types/interfaces/beefy'; import type { CheckInherentsResult, InherentData } from '@polkadot/types/interfaces/blockbuilder'; import type { BlockHash } from '@polkadot/types/interfaces/chain'; import type { AuthorityId } from '@polkadot/types/interfaces/consensus'; @@ -91,6 +91,14 @@ declare module '@polkadot/api-base/types/calls' { * Return the block number where BEEFY consensus is enabled/started **/ beefyGenesis: AugmentedCall Observable>>; + /** + * Generates a proof of key ownership for the given authority in the given set. + **/ + generateKeyOwnershipProof: AugmentedCall Observable>>; + /** + * Submits an unsigned extrinsic to report an equivocation. + **/ + submitReportEquivocationUnsignedExtrinsic: AugmentedCall Observable>>; /** * Return the current active BEEFY validator set **/ diff --git a/packages/api-augment/src/polkadot/runtime.ts b/packages/api-augment/src/polkadot/runtime.ts index 25efde00a5..fcda1a03ab 100644 --- a/packages/api-augment/src/polkadot/runtime.ts +++ b/packages/api-augment/src/polkadot/runtime.ts @@ -9,7 +9,7 @@ import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-b import type { Bytes, Null, Option, Result, Vec, bool, u32 } from '@polkadot/types-codec'; import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types'; import type { BabeEquivocationProof, BabeGenesisConfiguration, Epoch, OpaqueKeyOwnershipProof } from '@polkadot/types/interfaces/babe'; -import type { ValidatorSet } from '@polkadot/types/interfaces/beefy'; +import type { BeefyEquivocationProof, ValidatorSet, ValidatorSetId } from '@polkadot/types/interfaces/beefy'; import type { CheckInherentsResult, InherentData } from '@polkadot/types/interfaces/blockbuilder'; import type { BlockHash } from '@polkadot/types/interfaces/chain'; import type { AuthorityId } from '@polkadot/types/interfaces/consensus'; @@ -91,6 +91,14 @@ declare module '@polkadot/api-base/types/calls' { * Return the block number where BEEFY consensus is enabled/started **/ beefyGenesis: AugmentedCall Observable>>; + /** + * Generates a proof of key ownership for the given authority in the given set. + **/ + generateKeyOwnershipProof: AugmentedCall Observable>>; + /** + * Submits an unsigned extrinsic to report an equivocation. + **/ + submitReportEquivocationUnsignedExtrinsic: AugmentedCall Observable>>; /** * Return the current active BEEFY validator set **/ diff --git a/packages/types-augment/src/registry/interfaces.ts b/packages/types-augment/src/registry/interfaces.ts index c08f91b56c..5ce509bfd6 100644 --- a/packages/types-augment/src/registry/interfaces.ts +++ b/packages/types-augment/src/registry/interfaces.ts @@ -14,7 +14,7 @@ import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interface import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship'; import type { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEpochConfiguration, BabeEquivocationProof, BabeGenesisConfiguration, BabeGenesisConfigurationV1, BabeWeight, Epoch, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, OpaqueKeyOwnershipProof, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe'; import type { AccountData, BalanceLock, BalanceLockTo212, BalanceStatus, Reasons, ReserveData, ReserveIdentifier, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances'; -import type { BeefyAuthoritySet, BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, BeefyPayloadId, BeefySignedCommitment, MmrRootHash, ValidatorSet, ValidatorSetId } from '@polkadot/types/interfaces/beefy'; +import type { BeefyAuthoritySet, BeefyCommitment, BeefyEquivocationProof, BeefyId, BeefyNextAuthoritySet, BeefyPayload, BeefyPayloadId, BeefySignedCommitment, BeefyVoteMessage, MmrRootHash, ValidatorSet, ValidatorSetId } from '@polkadot/types/interfaces/beefy'; import type { BenchmarkBatch, BenchmarkConfig, BenchmarkList, BenchmarkMetadata, BenchmarkParameter, BenchmarkResult } from '@polkadot/types/interfaces/benchmark'; import type { CheckInherentsResult, InherentData, InherentIdentifier } from '@polkadot/types/interfaces/blockbuilder'; import type { BridgeMessageId, BridgedBlockHash, BridgedBlockNumber, BridgedHeader, CallOrigin, ChainId, DeliveredMessages, DispatchFeePayment, InboundLaneData, InboundRelayer, InitializationData, LaneId, MessageData, MessageKey, MessageNonce, MessagesDeliveryProofOf, MessagesProofOf, OperatingMode, OutboundLaneData, OutboundMessageFee, OutboundPayload, Parameter, RelayerId, UnrewardedRelayer, UnrewardedRelayersState } from '@polkadot/types/interfaces/bridges'; @@ -151,12 +151,14 @@ declare module '@polkadot/types/types/registry' { BalanceStatus: BalanceStatus; BeefyAuthoritySet: BeefyAuthoritySet; BeefyCommitment: BeefyCommitment; + BeefyEquivocationProof: BeefyEquivocationProof; BeefyId: BeefyId; BeefyKey: BeefyKey; BeefyNextAuthoritySet: BeefyNextAuthoritySet; BeefyPayload: BeefyPayload; BeefyPayloadId: BeefyPayloadId; BeefySignedCommitment: BeefySignedCommitment; + BeefyVoteMessage: BeefyVoteMessage; BenchmarkBatch: BenchmarkBatch; BenchmarkConfig: BenchmarkConfig; BenchmarkList: BenchmarkList; diff --git a/packages/types/src/interfaces/beefy/definitions.ts b/packages/types/src/interfaces/beefy/definitions.ts index 9542df0c38..47ddbc51a0 100644 --- a/packages/types/src/interfaces/beefy/definitions.ts +++ b/packages/types/src/interfaces/beefy/definitions.ts @@ -24,6 +24,10 @@ export default { validatorSetId: 'ValidatorSetId' }, BeefyId: '[u8; 33]', + BeefyEquivocationProof: { + first: 'BeefyVoteMessage', + second: 'BeefyVoteMessage' + }, BeefySignedCommitment: { commitment: 'BeefyCommitment', signatures: 'Vec>' @@ -35,6 +39,11 @@ export default { }, BeefyPayload: 'Vec<(BeefyPayloadId, Bytes)>', BeefyPayloadId: '[u8;2]', + BeefyVoteMessage: { + commitment: 'BeefyCommitment', + id: 'AuthorityId', + signature: 'Signature' + }, MmrRootHash: 'H256', ValidatorSetId: 'u64', ValidatorSet: { diff --git a/packages/types/src/interfaces/beefy/runtime.ts b/packages/types/src/interfaces/beefy/runtime.ts index 6a7b32a204..8bd27c6fe2 100644 --- a/packages/types/src/interfaces/beefy/runtime.ts +++ b/packages/types/src/interfaces/beefy/runtime.ts @@ -12,6 +12,34 @@ export const runtime: DefinitionsCall = { params: [], type: 'Option' }, + generate_key_ownership_proof: { + description: 'Generates a proof of key ownership for the given authority in the given set.', + params: [ + { + name: 'setId', + type: 'ValidatorSetId' + }, + { + name: 'authorityId', + type: 'AuthorityId' + } + ], + type: 'Option' + }, + submit_report_equivocation_unsigned_extrinsic: { + description: 'Submits an unsigned extrinsic to report an equivocation.', + params: [ + { + name: 'equivocationProof', + type: 'BeefyEquivocationProof' + }, + { + name: 'keyOwnerProof', + type: 'OpaqueKeyOwnershipProof' + } + ], + type: 'Option' + }, validator_set: { description: 'Return the current active BEEFY validator set', params: [], diff --git a/packages/types/src/interfaces/beefy/types.ts b/packages/types/src/interfaces/beefy/types.ts index 4835b5a638..e46a392ca3 100644 --- a/packages/types/src/interfaces/beefy/types.ts +++ b/packages/types/src/interfaces/beefy/types.ts @@ -4,7 +4,7 @@ import type { Bytes, Option, Struct, U8aFixed, Vec, u32, u64 } from '@polkadot/types-codec'; import type { ITuple } from '@polkadot/types-codec/types'; import type { AuthorityId } from '@polkadot/types/interfaces/consensus'; -import type { EcdsaSignature } from '@polkadot/types/interfaces/extrinsics'; +import type { EcdsaSignature, Signature } from '@polkadot/types/interfaces/extrinsics'; import type { BlockNumber, H256 } from '@polkadot/types/interfaces/runtime'; /** @name BeefyAuthoritySet */ @@ -21,6 +21,12 @@ export interface BeefyCommitment extends Struct { readonly validatorSetId: ValidatorSetId; } +/** @name BeefyEquivocationProof */ +export interface BeefyEquivocationProof extends Struct { + readonly first: BeefyVoteMessage; + readonly second: BeefyVoteMessage; +} + /** @name BeefyId */ export interface BeefyId extends U8aFixed {} @@ -43,6 +49,13 @@ export interface BeefySignedCommitment extends Struct { readonly signatures: Vec>; } +/** @name BeefyVoteMessage */ +export interface BeefyVoteMessage extends Struct { + readonly commitment: BeefyCommitment; + readonly id: AuthorityId; + readonly signature: Signature; +} + /** @name MmrRootHash */ export interface MmrRootHash extends H256 {}