diff --git a/packages/types-augment/src/registry/interfaces.ts b/packages/types-augment/src/registry/interfaces.ts index 0cccd8f1c6..fd613a4e97 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, 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 { 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, OldV1SessionInfo, 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'; @@ -691,6 +691,7 @@ declare module '@polkadot/types/types/registry' { OffchainAccuracyCompact: OffchainAccuracyCompact; OffenceDetails: OffenceDetails; Offender: Offender; + OldV1SessionInfo: OldV1SessionInfo; OpaqueCall: OpaqueCall; OpaqueKeyOwnershipProof: OpaqueKeyOwnershipProof; OpaqueMetadata: OpaqueMetadata; diff --git a/packages/types/src/interfaces/parachains/definitions.ts b/packages/types/src/interfaces/parachains/definitions.ts index 4195162629..137a1280d8 100644 --- a/packages/types/src/interfaces/parachains/definitions.ts +++ b/packages/types/src/interfaces/parachains/definitions.ts @@ -401,10 +401,25 @@ export default { disputes: 'MultiDisputeStatementSet' }, SessionInfo: { + activeValidatorIndices: 'Vec', + randomSeed: '[u8; 32]', + disputePeriod: 'SessionIndex', validators: 'Vec', discoveryKeys: 'Vec', assignmentKeys: 'Vec', - validatorGroups: 'Vec', + validatorGroups: 'Vec>', + nCores: 'u32', + zerothDelayTrancheWidth: 'u32', + relayVrfModuloSamples: 'u32', + nDelayTranches: 'u32', + noShowSlots: 'u32', + neededApprovals: 'u32' + }, + OldV1SessionInfo: { + validators: 'Vec', + discoveryKeys: 'Vec', + assignmentKeys: 'Vec', + validatorGroups: 'Vec>', nCores: 'u32', zerothDelayTrancheWidth: 'u32', relayVrfModuloSamples: 'u32', diff --git a/packages/types/src/interfaces/parachains/runtime.ts b/packages/types/src/interfaces/parachains/runtime.ts index 4f44296857..707b4b7b1f 100644 --- a/packages/types/src/interfaces/parachains/runtime.ts +++ b/packages/types/src/interfaces/parachains/runtime.ts @@ -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' + }, + 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' + }, + 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' + }, + 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' + } +}; 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' - }, + methods: objectSpread({ 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: [ @@ -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' - }, 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' - }, - 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' } - }, + }, 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' + } + }, PH_V1_TO_V2), + version: 1 } ] }; diff --git a/packages/types/src/interfaces/parachains/types.ts b/packages/types/src/interfaces/parachains/types.ts index e1144ce6fe..9f1a64be79 100644 --- a/packages/types/src/interfaces/parachains/types.ts +++ b/packages/types/src/interfaces/parachains/types.ts @@ -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; + readonly discoveryKeys: Vec; + readonly assignmentKeys: Vec; + readonly validatorGroups: Vec>; + 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; + readonly randomSeed: U8aFixed; + readonly disputePeriod: SessionIndex; readonly validators: Vec; readonly discoveryKeys: Vec; readonly assignmentKeys: Vec; - readonly validatorGroups: Vec; + readonly validatorGroups: Vec>; readonly nCores: u32; readonly zerothDelayTrancheWidth: u32; readonly relayVrfModuloSamples: u32;