Runtime ParachainHost v1 (#5011)

This commit is contained in:
Jaco
2022-07-01 13:31:05 +03:00
committed by GitHub
parent 5800ba5d91
commit 511a345b23
4 changed files with 186 additions and 132 deletions
@@ -401,10 +401,25 @@ export default {
disputes: 'MultiDisputeStatementSet'
},
SessionInfo: {
activeValidatorIndices: 'Vec<ParaValidatorIndex>',
randomSeed: '[u8; 32]',
disputePeriod: 'SessionIndex',
validators: 'Vec<ValidatorId>',
discoveryKeys: 'Vec<AuthorityDiscoveryId>',
assignmentKeys: 'Vec<AssignmentId>',
validatorGroups: 'Vec<SessionInfoValidatorGroup>',
validatorGroups: 'Vec<Vec<ValidatorIndex>>',
nCores: 'u32',
zerothDelayTrancheWidth: 'u32',
relayVrfModuloSamples: 'u32',
nDelayTranches: 'u32',
noShowSlots: 'u32',
neededApprovals: 'u32'
},
OldV1SessionInfo: {
validators: 'Vec<ValidatorId>',
discoveryKeys: 'Vec<AuthorityDiscoveryId>',
assignmentKeys: 'Vec<AssignmentId>',
validatorGroups: 'Vec<Vec<ParaValidatorIndex>>',
nCores: 'u32',
zerothDelayTrancheWidth: 'u32',
relayVrfModuloSamples: 'u32',
@@ -1,109 +1,148 @@
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types';
import type { DefinitionsCall, DefinitionsCallEntry } from '../../types';
import { objectSpread } from '@polkadot/util';
const PH_V1_TO_V2: DefinitionsCallEntry['methods'] = {
assumed_validation_data: {
description: 'Returns the persisted validation data for the given `ParaId` along with the corresponding validation code hash.',
params: [
{
name: 'paraId',
type: 'ParaId'
},
{
name: 'hash',
type: 'Hash'
}
],
type: 'Option<(PersistedValidationData, ValidationCodeHash)>'
},
availability_cores: {
description: 'Yields information on all availability cores as relevant to the child block.',
params: [],
type: 'Vec<CoreState>'
},
candidate_events: {
description: 'Get a vector of events concerning candidates that occurred within a block.',
params: [],
type: 'Vec<CandidateEvent>'
},
candidate_pending_availability: {
description: 'Get the receipt of a candidate pending availability.',
params: [
{
name: 'paraId',
type: 'ParaId'
}
],
type: 'Option<CommittedCandidateReceipt>'
},
check_validation_outputs: {
description: 'Checks if the given validation outputs pass the acceptance criteria.',
params: [
{
name: 'paraId',
type: 'ParaId'
},
{
name: 'outputs',
type: 'CandidateCommitments'
}
],
type: 'bool'
},
dmq_contents: {
description: 'Get all the pending inbound messages in the downward message queue for a para.',
params: [
{
name: 'paraId',
type: 'ParaId'
}
],
type: 'Vec<InboundDownwardMessage>'
},
inbound_hrmp_channels_contents: {
description: 'Get the contents of all channels addressed to the given recipient.',
params: [
{
name: 'paraId',
type: 'ParaId'
}
],
type: 'Vec<InboundHrmpMessage>'
},
on_chain_votes: {
description: 'Scrape dispute relevant from on-chain, backing votes and resolved disputes.',
params: [],
type: 'Option<ScrapedOnChainVotes>'
},
persisted_validation_data: {
description: 'Yields the persisted validation data for the given `ParaId` along with an assumption that should be used if the para currently occupies a core.',
params: [
{
name: 'paraId',
type: 'ParaId'
},
{
name: 'assumption',
type: 'OccupiedCoreAssumption'
}
],
type: 'Option<PersistedValidationData>'
},
session_index_for_child: {
description: 'Returns the session index expected at a child of the block.',
params: [],
type: 'SessionIndex'
},
validation_code: {
description: 'Fetch the validation code used by a para, making the given `OccupiedCoreAssumption`.',
params: [
{
name: 'paraId',
type: 'ParaId'
},
{
name: 'assumption',
type: 'OccupiedCoreAssumption'
}
],
type: 'ValidationCode'
},
validation_code_by_hash: {
description: 'Get the validation code from its hash.',
params: [
{
name: 'hash',
type: 'ValidationCodeHash'
}
],
type: 'Option<ValidationCode>'
},
validator_groups: {
description: 'Returns the validator groups and rotation info localized based on the hypothetical child of a block whose state this is invoked on',
params: [],
type: '(Vec<Vec<ParaValidatorIndex>>, GroupRotationInfo)'
},
validators: {
description: 'Get the current validators.',
params: [],
type: 'Vec<ValidatorId>'
}
};
export const runtime: DefinitionsCall = {
ParachainHost: [
{
methods: {
assumed_validation_data: {
description: 'Returns the persisted validation data for the given `ParaId` along with the corresponding validation code hash.',
params: [
{
name: 'paraId',
type: 'ParaId'
},
{
name: 'hash',
type: 'Hash'
}
],
type: 'Option<(PersistedValidationData, ValidationCodeHash)>'
},
availability_cores: {
description: 'Yields information on all availability cores as relevant to the child block.',
params: [],
type: 'Vec<CoreState>'
},
candidate_events: {
description: 'Get a vector of events concerning candidates that occurred within a block.',
params: [],
type: 'Vec<CandidateEvent>'
},
candidate_pending_availability: {
description: 'Get the receipt of a candidate pending availability.',
params: [
{
name: 'paraId',
type: 'ParaId'
}
],
type: 'Option<CommittedCandidateReceipt>'
},
check_validation_outputs: {
description: 'Checks if the given validation outputs pass the acceptance criteria.',
params: [
{
name: 'paraId',
type: 'ParaId'
},
{
name: 'outputs',
type: 'CandidateCommitments'
}
],
type: 'bool'
},
dmq_contents: {
description: 'Get all the pending inbound messages in the downward message queue for a para.',
params: [
{
name: 'paraId',
type: 'ParaId'
}
],
type: 'Vec<InboundDownwardMessage>'
},
inbound_hrmp_channels_contents: {
description: 'Get the contents of all channels addressed to the given recipient.',
params: [
{
name: 'paraId',
type: 'ParaId'
}
],
type: 'Vec<InboundHrmpMessage>'
},
on_chain_votes: {
description: 'Scrape dispute relevant from on-chain, backing votes and resolved disputes.',
params: [],
type: 'Option<ScrapedOnChainVotes>'
},
persisted_validation_data: {
description: 'Yields the persisted validation data for the given `ParaId` along with an assumption that should be used if the para currently occupies a core.',
params: [
{
name: 'paraId',
type: 'ParaId'
},
{
name: 'assumption',
type: 'OccupiedCoreAssumption'
}
],
type: 'Option<PersistedValidationData>'
},
methods: objectSpread({
pvfs_require_precheck: {
description: 'Returns code hashes of PVFs that require pre-checking by validators in the active set.',
params: [],
type: 'Vec<ValidationCodeHash>'
},
session_index_for_child: {
description: 'Returns the session index expected at a child of the block.',
params: [],
type: 'SessionIndex'
},
session_info: {
description: 'Get the session info for the given session, if stored.',
params: [
@@ -128,30 +167,6 @@ export const runtime: DefinitionsCall = {
],
type: 'Null'
},
validation_code: {
description: 'Fetch the validation code used by a para, making the given `OccupiedCoreAssumption`.',
params: [
{
name: 'paraId',
type: 'ParaId'
},
{
name: 'assumption',
type: 'OccupiedCoreAssumption'
}
],
type: 'ValidationCode'
},
validation_code_by_hash: {
description: 'Get the validation code from its hash.',
params: [
{
name: 'hash',
type: 'ValidationCodeHash'
}
],
type: 'Option<ValidationCode>'
},
validation_code_hash: {
description: 'Fetch the hash of the validation code used by a para, making the given `OccupiedCoreAssumption`.',
params: [
@@ -165,19 +180,24 @@ export const runtime: DefinitionsCall = {
}
],
type: 'Option<ValidationCodeHash>'
},
validator_groups: {
description: 'Returns the validator groups and rotation info localized based on the hypothetical child of a block whose state this is invoked on',
params: [],
type: '(Vec<Vec<ParaValidatorIndex>>, GroupRotationInfo)'
},
validators: {
description: 'Get the current validators.',
params: [],
type: 'Vec<ValidatorId>'
}
},
}, PH_V1_TO_V2),
version: 2
},
{
methods: objectSpread({
session_info: {
description: 'Get the session info for the given session, if stored.',
params: [
{
name: 'index',
type: 'SessionIndex'
}
],
type: 'Option<OldV1SessionInfo>'
}
}, PH_V1_TO_V2),
version: 1
}
]
};
@@ -6,6 +6,7 @@ import type { ITuple } from '@polkadot/types-codec/types';
import type { Signature } from '@polkadot/types/interfaces/extrinsics';
import type { AccountId, Balance, BalanceOf, BlockNumber, H256, Hash, Header, StorageProof, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
import type { MembershipProof, SessionIndex } from '@polkadot/types/interfaces/session';
import type { ValidatorIndex } from '@polkadot/types/interfaces/staking';
/** @name AbridgedCandidateReceipt */
export interface AbridgedCandidateReceipt extends Struct {
@@ -461,6 +462,20 @@ export interface OccupiedCoreAssumption extends Enum {
readonly type: 'Included' | 'TimedOut' | 'Free';
}
/** @name OldV1SessionInfo */
export interface OldV1SessionInfo extends Struct {
readonly validators: Vec<ValidatorId>;
readonly discoveryKeys: Vec<AuthorityDiscoveryId>;
readonly assignmentKeys: Vec<AssignmentId>;
readonly validatorGroups: Vec<Vec<ParaValidatorIndex>>;
readonly nCores: u32;
readonly zerothDelayTrancheWidth: u32;
readonly relayVrfModuloSamples: u32;
readonly nDelayTranches: u32;
readonly noShowSlots: u32;
readonly neededApprovals: u32;
}
/** @name OutboundHrmpMessage */
export interface OutboundHrmpMessage extends Struct {
readonly recipient: u32;
@@ -646,10 +661,13 @@ export interface ServiceQuality extends Enum {
/** @name SessionInfo */
export interface SessionInfo extends Struct {
readonly activeValidatorIndices: Vec<ParaValidatorIndex>;
readonly randomSeed: U8aFixed;
readonly disputePeriod: SessionIndex;
readonly validators: Vec<ValidatorId>;
readonly discoveryKeys: Vec<AuthorityDiscoveryId>;
readonly assignmentKeys: Vec<AssignmentId>;
readonly validatorGroups: Vec<SessionInfoValidatorGroup>;
readonly validatorGroups: Vec<Vec<ValidatorIndex>>;
readonly nCores: u32;
readonly zerothDelayTrancheWidth: u32;
readonly relayVrfModuloSamples: u32;