Latest BeefyApi & ParachainHost runtime interfaces (#5718)

* Latest BeefyApi & ParachainHost runtime interfaces

* Add missing types

* Correct string closing
This commit is contained in:
Jaco
2023-08-29 11:07:39 +03:00
committed by GitHub
parent c028c69582
commit 6f24d2f5dc
5 changed files with 101 additions and 4 deletions
@@ -3,7 +3,7 @@
import type { DefinitionCall, DefinitionsCall } from '../../types/index.js';
const BEEFY_V1_V2: Record<string, DefinitionCall> = {
const BEEFY_V1_V3: Record<string, DefinitionCall> = {
beefy_genesis: {
description: 'Return the block number where BEEFY consensus is enabled/started',
params: [],
@@ -60,11 +60,15 @@ const BEEFY_MMR_V1: Record<string, DefinitionCall> = {
export const runtime: DefinitionsCall = {
BeefyApi: [
{
methods: BEEFY_V1_V2,
methods: BEEFY_V1_V3,
version: 3
},
{
methods: BEEFY_V1_V3,
version: 2
},
{
methods: BEEFY_V1_V2,
methods: BEEFY_V1_V3,
version: 1
}
],
@@ -235,6 +235,16 @@ export default {
Free: 'Null'
}
},
DisputeProof: {
timeSlot: 'DisputesTimeSlot',
kind: 'SlashingOffenceKind',
validatorIndex: 'ValidatorIndex',
validatorId: 'ValidatorId'
},
DisputesTimeSlot: {
sessionIndex: 'SessionIndex',
candidateHash: 'CandidateHash'
},
DoubleVoteReport: {
identity: 'ValidatorId',
first: '(Statement, ValidatorSignature)',
@@ -333,6 +343,13 @@ export default {
recipient: 'u32',
data: 'Bytes'
},
PendingSlashes: {
_alias: {
slashKeys: 'keys'
},
slashKeys: 'BTreeMap<ValidatorIndex, ValidatorId>',
kind: 'SlashingOffenceKind'
},
ParachainDispatchOrigin: {
_enum: ['Signed', 'Parachain', 'Root']
},
@@ -460,6 +477,9 @@ export default {
sessionIndex: 'SessionIndex',
parentHash: 'Hash'
},
SlashingOffenceKind: {
_enum: ['ForInvalid', 'AgainstValid']
},
Statement: {
_enum: {
Never: 'Null', // starts at 1
@@ -199,8 +199,50 @@ const PH_V4: DefinitionsCallEntry['methods'] = {
}
};
const PH_V5: DefinitionsCallEntry['methods'] = {
key_ownership_proof: {
description: 'Returns a merkle proof of a validator session key',
params: [
{
name: 'validatorId',
type: 'ValidatorId'
}
],
type: 'Option<OpaqueKeyOwnershipProof>'
},
submit_report_dispute_lost: {
description: 'Submit an unsigned extrinsic to slash validators who lost a dispute about a candidate of a past session',
params: [
{
name: 'disputeProof',
type: 'DisputeProof'
},
{
name: 'keyOwnershipProof',
type: 'OpaqueKeyOwnershipProof'
}
],
type: 'Option<Null>'
},
unapplied_slashes: {
description: 'Returns a list of validators that lost a past session dispute and need to be slashed',
params: [],
type: 'Vec<(SessionIndex, CandidateHash, PendingSlashes)>'
}
};
export const runtime: DefinitionsCall = {
ParachainHost: [
{
methods: {
...PH_V1_TO_V2,
...PH_V2_TO_V3,
...PH_V3,
...PH_V4,
...PH_V5
},
version: 5
},
{
methods: {
...PH_V1_TO_V2,
@@ -208,6 +208,14 @@ export interface DisputeLocation extends Enum {
readonly type: 'Local' | 'Remote';
}
/** @name DisputeProof */
export interface DisputeProof extends Struct {
readonly timeSlot: DisputesTimeSlot;
readonly kind: SlashingOffenceKind;
readonly validatorIndex: ValidatorIndex;
readonly validatorId: ValidatorId;
}
/** @name DisputeResult */
export interface DisputeResult extends Enum {
readonly isValid: boolean;
@@ -239,6 +247,12 @@ export interface DisputeStatementSet extends Struct {
readonly statements: Vec<ITuple<[DisputeStatement, ParaValidatorIndex, ValidatorSignature]>>;
}
/** @name DisputesTimeSlot */
export interface DisputesTimeSlot extends Struct {
readonly sessionIndex: SessionIndex;
readonly candidateHash: CandidateHash;
}
/** @name DoubleVoteReport */
export interface DoubleVoteReport extends Struct {
readonly identity: ValidatorId;
@@ -599,6 +613,12 @@ export interface ParathreadEntry extends Struct {
/** @name ParaValidatorIndex */
export interface ParaValidatorIndex extends u32 {}
/** @name PendingSlashes */
export interface PendingSlashes extends Struct {
readonly slashKeys: BTreeMap<ValidatorIndex, ValidatorId>;
readonly kind: SlashingOffenceKind;
}
/** @name PersistedValidationData */
export interface PersistedValidationData extends Struct {
readonly parentHead: HeadData;
@@ -733,6 +753,13 @@ export interface SigningContext extends Struct {
readonly parentHash: Hash;
}
/** @name SlashingOffenceKind */
export interface SlashingOffenceKind extends Enum {
readonly isForInvalid: boolean;
readonly isAgainstValid: boolean;
readonly type: 'ForInvalid' | 'AgainstValid';
}
/** @name SlotRange */
export interface SlotRange extends Enum {
readonly isZeroZero: boolean;