From 62be4530f98e915fc7f69fdc05a7283b341f8bb9 Mon Sep 17 00:00:00 2001 From: Jaco Date: Thu, 30 Jun 2022 17:56:49 +0200 Subject: [PATCH] Runtime interface for ParachainHost (#4999) --- packages/api-augment/src/kusama/runtime.ts | 85 +++++++- packages/api-augment/src/polkadot/runtime.ts | 85 +++++++- .../types-augment/src/registry/interfaces.ts | 10 +- .../src/interfaces/parachains/definitions.ts | 49 +++++ .../src/interfaces/parachains/runtime.ts | 183 ++++++++++++++++++ .../types/src/interfaces/parachains/types.ts | 69 +++++++ 6 files changed, 476 insertions(+), 5 deletions(-) create mode 100644 packages/types/src/interfaces/parachains/runtime.ts diff --git a/packages/api-augment/src/kusama/runtime.ts b/packages/api-augment/src/kusama/runtime.ts index 36d23389c3..7787b914c8 100644 --- a/packages/api-augment/src/kusama/runtime.ts +++ b/packages/api-augment/src/kusama/runtime.ts @@ -2,7 +2,7 @@ /* eslint-disable */ import type { ApiTypes } from '@polkadot/api-base/types'; -import type { Bytes, Null, Option, Result, Vec, u32 } from '@polkadot/types-codec'; +import type { Bytes, Null, Option, Result, Vec, bool, u32 } from '@polkadot/types-codec'; import type { AnyNumber, 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'; @@ -13,8 +13,10 @@ import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics'; import type { AuthorityList, GrandpaEquivocationProof, SetId } from '@polkadot/types/interfaces/grandpa'; import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata'; import type { MmrBatchProof, MmrEncodableOpaqueLeaf, MmrError, MmrLeafIndex, MmrProof } from '@polkadot/types/interfaces/mmr'; +import type { CandidateCommitments, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption, ParaId, ParaValidatorIndex, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorSignature } from '@polkadot/types/interfaces/parachains'; import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment'; -import type { AccountId, Block, Hash, Header, Index, KeyTypeId, Slot } from '@polkadot/types/interfaces/runtime'; +import type { AccountId, Block, Hash, Header, Index, KeyTypeId, Slot, ValidatorId } from '@polkadot/types/interfaces/runtime'; +import type { SessionIndex } from '@polkadot/types/interfaces/session'; import type { RuntimeVersion } from '@polkadot/types/interfaces/state'; import type { ApplyExtrinsicResult } from '@polkadot/types/interfaces/system'; import type { TransactionSource, TransactionValidity } from '@polkadot/types/interfaces/txqueue'; @@ -208,6 +210,85 @@ declare module '@polkadot/api-base/types/calls' { **/ [key: string]: DecoratedCallBase; }; + /** 0xaf2c0297a23e6d3d/2 */ + parachainHost: { + /** + * Returns the persisted validation data for the given `ParaId` along with the corresponding validation code hash. + **/ + assumedValidationData: AugmentedCall Observable>>>; + /** + * Yields information on all availability cores as relevant to the child block. + **/ + availabilityCores: AugmentedCall Observable>>; + /** + * Get a vector of events concerning candidates that occurred within a block. + **/ + candidateEvents: AugmentedCall Observable>>; + /** + * Get the receipt of a candidate pending availability. + **/ + candidatePendingAvailability: AugmentedCall Observable>>; + /** + * Checks if the given validation outputs pass the acceptance criteria. + **/ + checkValidationOutputs: AugmentedCall Observable>; + /** + * Get all the pending inbound messages in the downward message queue for a para. + **/ + dmqContents: AugmentedCall Observable>>; + /** + * Get the contents of all channels addressed to the given recipient. + **/ + inboundHrmpChannelsContents: AugmentedCall Observable>>; + /** + * Scrape dispute relevant from on-chain, backing votes and resolved disputes. + **/ + onChainVotes: AugmentedCall Observable>>; + /** + * Yields the persisted validation data for the given `ParaId` along with an assumption that should be used if the para currently occupies a core. + **/ + persistedValidationData: AugmentedCall Observable>>; + /** + * Returns code hashes of PVFs that require pre-checking by validators in the active set. + **/ + pvfsRequirePrecheck: AugmentedCall Observable>>; + /** + * Returns the session index expected at a child of the block. + **/ + sessionIndexForChild: AugmentedCall Observable>; + /** + * Get the session info for the given session, if stored. + **/ + sessionInfo: AugmentedCall Observable>>; + /** + * Submits a PVF pre-checking statement into the transaction pool. + **/ + submitPvfCheckStatement: AugmentedCall Observable>; + /** + * Fetch the validation code used by a para, making the given `OccupiedCoreAssumption`. + **/ + validationCode: AugmentedCall Observable>; + /** + * Get the validation code from its hash. + **/ + validationCodeByHash: AugmentedCall Observable>>; + /** + * Fetch the hash of the validation code used by a para, making the given `OccupiedCoreAssumption`. + **/ + validationCodeHash: AugmentedCall Observable>>; + /** + * Returns the validator groups and rotation info localized based on the hypothetical child of a block whose state this is invoked on + **/ + validatorGroups: AugmentedCall Observable>, GroupRotationInfo]>>>; + /** + * Get the current validators. + **/ + validators: AugmentedCall Observable>>; + /** + * Generic call + **/ + [key: string]: DecoratedCallBase; + }; /** 0xab3c0572291feb8b/1 */ sessionKeys: { /** diff --git a/packages/api-augment/src/polkadot/runtime.ts b/packages/api-augment/src/polkadot/runtime.ts index 36d23389c3..7787b914c8 100644 --- a/packages/api-augment/src/polkadot/runtime.ts +++ b/packages/api-augment/src/polkadot/runtime.ts @@ -2,7 +2,7 @@ /* eslint-disable */ import type { ApiTypes } from '@polkadot/api-base/types'; -import type { Bytes, Null, Option, Result, Vec, u32 } from '@polkadot/types-codec'; +import type { Bytes, Null, Option, Result, Vec, bool, u32 } from '@polkadot/types-codec'; import type { AnyNumber, 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'; @@ -13,8 +13,10 @@ import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics'; import type { AuthorityList, GrandpaEquivocationProof, SetId } from '@polkadot/types/interfaces/grandpa'; import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata'; import type { MmrBatchProof, MmrEncodableOpaqueLeaf, MmrError, MmrLeafIndex, MmrProof } from '@polkadot/types/interfaces/mmr'; +import type { CandidateCommitments, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption, ParaId, ParaValidatorIndex, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorSignature } from '@polkadot/types/interfaces/parachains'; import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment'; -import type { AccountId, Block, Hash, Header, Index, KeyTypeId, Slot } from '@polkadot/types/interfaces/runtime'; +import type { AccountId, Block, Hash, Header, Index, KeyTypeId, Slot, ValidatorId } from '@polkadot/types/interfaces/runtime'; +import type { SessionIndex } from '@polkadot/types/interfaces/session'; import type { RuntimeVersion } from '@polkadot/types/interfaces/state'; import type { ApplyExtrinsicResult } from '@polkadot/types/interfaces/system'; import type { TransactionSource, TransactionValidity } from '@polkadot/types/interfaces/txqueue'; @@ -208,6 +210,85 @@ declare module '@polkadot/api-base/types/calls' { **/ [key: string]: DecoratedCallBase; }; + /** 0xaf2c0297a23e6d3d/2 */ + parachainHost: { + /** + * Returns the persisted validation data for the given `ParaId` along with the corresponding validation code hash. + **/ + assumedValidationData: AugmentedCall Observable>>>; + /** + * Yields information on all availability cores as relevant to the child block. + **/ + availabilityCores: AugmentedCall Observable>>; + /** + * Get a vector of events concerning candidates that occurred within a block. + **/ + candidateEvents: AugmentedCall Observable>>; + /** + * Get the receipt of a candidate pending availability. + **/ + candidatePendingAvailability: AugmentedCall Observable>>; + /** + * Checks if the given validation outputs pass the acceptance criteria. + **/ + checkValidationOutputs: AugmentedCall Observable>; + /** + * Get all the pending inbound messages in the downward message queue for a para. + **/ + dmqContents: AugmentedCall Observable>>; + /** + * Get the contents of all channels addressed to the given recipient. + **/ + inboundHrmpChannelsContents: AugmentedCall Observable>>; + /** + * Scrape dispute relevant from on-chain, backing votes and resolved disputes. + **/ + onChainVotes: AugmentedCall Observable>>; + /** + * Yields the persisted validation data for the given `ParaId` along with an assumption that should be used if the para currently occupies a core. + **/ + persistedValidationData: AugmentedCall Observable>>; + /** + * Returns code hashes of PVFs that require pre-checking by validators in the active set. + **/ + pvfsRequirePrecheck: AugmentedCall Observable>>; + /** + * Returns the session index expected at a child of the block. + **/ + sessionIndexForChild: AugmentedCall Observable>; + /** + * Get the session info for the given session, if stored. + **/ + sessionInfo: AugmentedCall Observable>>; + /** + * Submits a PVF pre-checking statement into the transaction pool. + **/ + submitPvfCheckStatement: AugmentedCall Observable>; + /** + * Fetch the validation code used by a para, making the given `OccupiedCoreAssumption`. + **/ + validationCode: AugmentedCall Observable>; + /** + * Get the validation code from its hash. + **/ + validationCodeByHash: AugmentedCall Observable>>; + /** + * Fetch the hash of the validation code used by a para, making the given `OccupiedCoreAssumption`. + **/ + validationCodeHash: AugmentedCall Observable>>; + /** + * Returns the validator groups and rotation info localized based on the hypothetical child of a block whose state this is invoked on + **/ + validatorGroups: AugmentedCall Observable>, GroupRotationInfo]>>>; + /** + * Get the current validators. + **/ + validators: AugmentedCall Observable>>; + /** + * Generic call + **/ + [key: string]: DecoratedCallBase; + }; /** 0xab3c0572291feb8b/1 */ sessionKeys: { /** diff --git a/packages/types-augment/src/registry/interfaces.ts b/packages/types-augment/src/registry/interfaces.ts index bea056f951..6cd5a9f345 100644 --- a/packages/types-augment/src/registry/interfaces.ts +++ b/packages/types-augment/src/registry/interfaces.ts @@ -40,7 +40,7 @@ import type { ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMeta import type { MmrBatchProof, MmrEncodableOpaqueLeaf, MmrError, MmrLeafBatchProof, MmrLeafIndex, MmrLeafProof, MmrNodeIndex, MmrProof } from '@polkadot/types/interfaces/mmr'; import type { StorageKind } from '@polkadot/types/interfaces/offchain'; import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences'; -import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, DisputeLocation, DisputeResult, DisputeState, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, ReplacementTimes, Retriable, Scheduling, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, SlotRange10, Statement, SubId, SystemInherentData, TransientValidationData, UpgradeGoAhead, UpgradeRestriction, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersData10, WinnersDataTuple, WinnersDataTuple10, WinningData, WinningData10, WinningDataEntry } from '@polkadot/types/interfaces/parachains'; +import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateEvent, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, CoreState, DisputeLocation, DisputeResult, DisputeState, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, GroupRotationInfo, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OccupiedCore, OccupiedCoreAssumption, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, PvfCheckStatement, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, ReplacementTimes, Retriable, ScheduledCore, Scheduling, ScrapedOnChainVotes, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, SlotRange10, Statement, SubId, SystemInherentData, TransientValidationData, UpgradeGoAhead, UpgradeRestriction, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersData10, WinnersDataTuple, WinnersDataTuple10, WinningData, WinningData10, WinningDataEntry } from '@polkadot/types/interfaces/parachains'; import type { FeeDetails, InclusionFee, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment'; import type { Approvals } from '@polkadot/types/interfaces/poll'; import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy'; @@ -196,6 +196,7 @@ declare module '@polkadot/types/types/registry' { CallOrigin: CallOrigin; CandidateCommitments: CandidateCommitments; CandidateDescriptor: CandidateDescriptor; + CandidateEvent: CandidateEvent; CandidateHash: CandidateHash; CandidateInfo: CandidateInfo; CandidatePendingAvailability: CandidatePendingAvailability; @@ -298,6 +299,7 @@ declare module '@polkadot/types/types/registry' { CoreAssignment: CoreAssignment; CoreIndex: CoreIndex; CoreOccupied: CoreOccupied; + CoreState: CoreState; CrateVersion: CrateVersion; CreatedBlock: CreatedBlock; Data: Data; @@ -488,6 +490,7 @@ declare module '@polkadot/types/types/registry' { GrandpaPrevote: GrandpaPrevote; GrandpaSignedPrecommit: GrandpaSignedPrecommit; GroupIndex: GroupIndex; + GroupRotationInfo: GroupRotationInfo; H1024: H1024; H128: H128; H160: H160; @@ -674,6 +677,8 @@ declare module '@polkadot/types/types/registry' { NominatorIndexCompact: NominatorIndexCompact; NotConnectedPeer: NotConnectedPeer; Null: Null; + OccupiedCore: OccupiedCore; + OccupiedCoreAssumption: OccupiedCoreAssumption; OffchainAccuracy: OffchainAccuracy; OffchainAccuracyCompact: OffchainAccuracyCompact; OffenceDetails: OffenceDetails; @@ -781,6 +786,7 @@ declare module '@polkadot/types/types/registry' { ProxyDefinition: ProxyDefinition; ProxyState: ProxyState; ProxyType: ProxyType; + PvfCheckStatement: PvfCheckStatement; QueryId: QueryId; QueryStatus: QueryStatus; QueueConfigData: QueueConfigData; @@ -853,6 +859,7 @@ declare module '@polkadot/types/types/registry' { RuntimeVersionPartial: RuntimeVersionPartial; Schedule: Schedule; Scheduled: Scheduled; + ScheduledCore: ScheduledCore; ScheduledTo254: ScheduledTo254; SchedulePeriod: SchedulePeriod; SchedulePriority: SchedulePriority; @@ -860,6 +867,7 @@ declare module '@polkadot/types/types/registry' { ScheduleTo258: ScheduleTo258; ScheduleTo264: ScheduleTo264; Scheduling: Scheduling; + ScrapedOnChainVotes: ScrapedOnChainVotes; Seal: Seal; SealV0: SealV0; SeatHolder: SeatHolder; diff --git a/packages/types/src/interfaces/parachains/definitions.ts b/packages/types/src/interfaces/parachains/definitions.ts index 4c04ba96ed..976979ff67 100644 --- a/packages/types/src/interfaces/parachains/definitions.ts +++ b/packages/types/src/interfaces/parachains/definitions.ts @@ -9,6 +9,7 @@ import type { Definitions } from '../../types'; import { objectSpread } from '@polkadot/util'; import hrmpTypes from './hrmp'; +import { runtime } from './runtime'; import slotTypes from './slots'; // proposeParachain @@ -77,6 +78,7 @@ const disputeTypes = { export default { rpc: {}, + runtime, types: objectSpread({}, cumulusTypes, disputeTypes, hrmpTypes, proposeTypes, slotTypes, { AbridgedCandidateReceipt: { parachainIndex: 'ParaId', @@ -154,6 +156,13 @@ export default { paraHead: 'Hash', validationCodeHash: 'ValidationCodeHash' }, + CandidateEvent: { + _enum: { + CandidateBacked: '(CandidateReceipt, HeadData, CoreIndex, GroupIndex)', + CandidateIncluded: '(CandidateReceipt, HeadData, CoreIndex, GroupIndex)', + CandidateTimedOut: '(CandidateReceipt, HeadData, CoreIndex)' + } + }, CandidateHash: 'Hash', CandidateInfo: { who: 'AccountId', @@ -197,6 +206,13 @@ export default { Parachain: 'Null' } }, + CoreState: { + _enum: { + Occupied: 'OccupiedCore', + Scheduled: 'ScheduledCore', + Free: 'Null' + } + }, DoubleVoteReport: { identity: 'ValidatorId', first: '(Statement, ValidatorSignature)', @@ -206,6 +222,11 @@ export default { }, DownwardMessage: 'Bytes', GroupIndex: 'u32', + GroupRotationInfo: { + sessionStartBlock: 'BlockNumber', + groupRotationFrequency: 'BlockNumber', + now: 'BlockNumber' + }, GlobalValidationSchedule: { maxCodeSize: 'u32', maxHeadDataSize: 'u32', @@ -273,6 +294,19 @@ export default { horizontalMessages: 'BTreeMap' }, MessageQueueChain: 'RelayChainHash', + OccupiedCore: { + nextUpOnVvailable: 'Option', + occupiedSince: 'BlockNumber', + timeOutAt: 'BlockNumber', + nextUpOnTimeOut: 'Option', + availability: 'BitVec', + group_responsible: 'GroupIndex', + candidateHash: 'CandidateHash', + candidateDescriptor: 'CandidateDescriptor' + }, + OccupiedCoreAssumption: { + _enum: ['Included,', 'TimedOut', 'Free'] + }, OutboundHrmpMessage: { recipient: 'u32', data: 'Bytes' @@ -329,6 +363,12 @@ export default { relayParentStorageRoot: 'Hash', maxPovSize: 'u32' }, + PvfCheckStatement: { + accept: 'bool', + subject: 'ValidationCodeHash', + sessionIndex: 'SessionIndex', + validatorIndex: 'ParaValidatorIndex' + }, QueuedParathread: { claim: 'ParathreadEntry', coreOffset: 'u32' @@ -348,9 +388,18 @@ export default { WithRetries: 'u32' } }, + ScheduledCore: { + paraId: 'ParaId', + collator: 'Option' + }, Scheduling: { _enum: ['Always', 'Dynamic'] }, + ScrapedOnChainVotes: { + session: 'SessionIndex', + backingValidatorsPerCandidate: 'Vec<(CandidateReceipt, Vec<(ParaValidatorIndex, ValidityAttestation)>)>', + disputes: 'MultiDisputeStatementSet' + }, SessionInfo: { validators: 'Vec', discoveryKeys: 'Vec', diff --git a/packages/types/src/interfaces/parachains/runtime.ts b/packages/types/src/interfaces/parachains/runtime.ts new file mode 100644 index 0000000000..4f44296857 --- /dev/null +++ b/packages/types/src/interfaces/parachains/runtime.ts @@ -0,0 +1,183 @@ +// Copyright 2017-2022 @polkadot/types authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type { DefinitionsCall } from '../../types'; + +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' + }, + candidate_events: { + description: 'Get a vector of events concerning candidates that occurred within a block.', + params: [], + type: 'Vec' + }, + candidate_pending_availability: { + description: 'Get the receipt of a candidate pending availability.', + params: [ + { + name: 'paraId', + type: 'ParaId' + } + ], + type: 'Option' + }, + 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' + }, + inbound_hrmp_channels_contents: { + description: 'Get the contents of all channels addressed to the given recipient.', + params: [ + { + name: 'paraId', + type: 'ParaId' + } + ], + type: 'Vec' + }, + on_chain_votes: { + description: 'Scrape dispute relevant from on-chain, backing votes and resolved disputes.', + params: [], + type: 'Option' + }, + 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' + }, + pvfs_require_precheck: { + description: 'Returns code hashes of PVFs that require pre-checking by validators in the active set.', + params: [], + type: 'Vec' + }, + 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: [ + { + name: 'index', + type: 'SessionIndex' + } + ], + type: 'Option' + }, + submit_pvf_check_statement: { + description: 'Submits a PVF pre-checking statement into the transaction pool.', + params: [ + { + name: 'stmt', + type: 'PvfCheckStatement' + }, + { + name: 'signature', + type: 'ValidatorSignature' + } + ], + 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' + }, + validation_code_hash: { + description: 'Fetch the hash of the validation code used by a para, making the given `OccupiedCoreAssumption`.', + params: [ + { + name: 'paraId', + type: 'ParaId' + }, + { + name: 'assumption', + type: 'OccupiedCoreAssumption' + } + ], + type: 'Option' + }, + 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>, GroupRotationInfo)' + }, + validators: { + description: 'Get the current validators.', + params: [], + type: 'Vec' + } + }, + version: 2 + } + ] +}; diff --git a/packages/types/src/interfaces/parachains/types.ts b/packages/types/src/interfaces/parachains/types.ts index 4817657e07..6e894df777 100644 --- a/packages/types/src/interfaces/parachains/types.ts +++ b/packages/types/src/interfaces/parachains/types.ts @@ -121,6 +121,17 @@ export interface CandidateDescriptor extends Struct { readonly validationCodeHash: ValidationCodeHash; } +/** @name CandidateEvent */ +export interface CandidateEvent extends Enum { + readonly isCandidateBacked: boolean; + readonly asCandidateBacked: ITuple<[CandidateReceipt, HeadData, CoreIndex, GroupIndex]>; + readonly isCandidateIncluded: boolean; + readonly asCandidateIncluded: ITuple<[CandidateReceipt, HeadData, CoreIndex, GroupIndex]>; + readonly isCandidateTimedOut: boolean; + readonly asCandidateTimedOut: ITuple<[CandidateReceipt, HeadData, CoreIndex]>; + readonly type: 'CandidateBacked' | 'CandidateIncluded' | 'CandidateTimedOut'; +} + /** @name CandidateHash */ export interface CandidateHash extends Hash {} @@ -179,6 +190,16 @@ export interface CoreOccupied extends Enum { readonly type: 'Parathread' | 'Parachain'; } +/** @name CoreState */ +export interface CoreState extends Enum { + readonly isOccupied: boolean; + readonly asOccupied: OccupiedCore; + readonly isScheduled: boolean; + readonly asScheduled: ScheduledCore; + readonly isFree: boolean; + readonly type: 'Occupied' | 'Scheduled' | 'Free'; +} + /** @name DisputeLocation */ export interface DisputeLocation extends Enum { readonly isLocal: boolean; @@ -253,6 +274,13 @@ export interface GlobalValidationSchedule extends Struct { /** @name GroupIndex */ export interface GroupIndex extends u32 {} +/** @name GroupRotationInfo */ +export interface GroupRotationInfo extends Struct { + readonly sessionStartBlock: BlockNumber; + readonly groupRotationFrequency: BlockNumber; + readonly now: BlockNumber; +} + /** @name HeadData */ export interface HeadData extends Bytes {} @@ -413,6 +441,26 @@ export interface NewBidder extends Struct { readonly sub: SubId; } +/** @name OccupiedCore */ +export interface OccupiedCore extends Struct { + readonly nextUpOnVvailable: Option; + readonly occupiedSince: BlockNumber; + readonly timeOutAt: BlockNumber; + readonly nextUpOnTimeOut: Option; + readonly availability: BitVec; + readonly group_responsible: GroupIndex; + readonly candidateHash: CandidateHash; + readonly candidateDescriptor: CandidateDescriptor; +} + +/** @name OccupiedCoreAssumption */ +export interface OccupiedCoreAssumption extends Enum { + readonly isIncluded: boolean; + readonly isTimedOut: boolean; + readonly isFree: boolean; + readonly type: 'Included' | 'TimedOut' | 'Free'; +} + /** @name OutboundHrmpMessage */ export interface OutboundHrmpMessage extends Struct { readonly recipient: u32; @@ -520,6 +568,14 @@ export interface PersistedValidationData extends Struct { readonly maxPovSize: u32; } +/** @name PvfCheckStatement */ +export interface PvfCheckStatement extends Struct { + readonly accept: bool; + readonly subject: ValidationCodeHash; + readonly sessionIndex: SessionIndex; + readonly validatorIndex: ParaValidatorIndex; +} + /** @name QueuedParathread */ export interface QueuedParathread extends Struct { readonly claim: ParathreadEntry; @@ -561,6 +617,12 @@ export interface Retriable extends Enum { readonly type: 'Never' | 'WithRetries'; } +/** @name ScheduledCore */ +export interface ScheduledCore extends Struct { + readonly paraId: ParaId; + readonly collator: Option; +} + /** @name Scheduling */ export interface Scheduling extends Enum { readonly isAlways: boolean; @@ -568,6 +630,13 @@ export interface Scheduling extends Enum { readonly type: 'Always' | 'Dynamic'; } +/** @name ScrapedOnChainVotes */ +export interface ScrapedOnChainVotes extends Struct { + readonly session: SessionIndex; + readonly backingValidatorsPerCandidate: Vec>]>>; + readonly disputes: MultiDisputeStatementSet; +} + /** @name ServiceQuality */ export interface ServiceQuality extends Enum { readonly isOrdered: boolean;