From 41bf6fa8eaaaf4e2ba15936ca99a3e8f202f5d6d Mon Sep 17 00:00:00 2001 From: Jaco Date: Thu, 13 Oct 2022 10:23:45 +0300 Subject: [PATCH] Add `ParachainHost` version 3 runtime calls (#5270) --- CHANGELOG.md | 7 ++ .../src/interfaces/parachains/runtime.ts | 96 +++++++++++-------- 2 files changed, 61 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcf9229df2..7d5e4312e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## master + +Changes: + +- Add `ParachainHost` version 3 runtime calls + + ## 9.5.1 Oct 8, 2022 - **Important** While the API witll detect and decorate the weight type based on V1 or V2, the default `Weight` type (used in runtime calls and RPCs) has not been swapped from the old `u64` variant. This means that on new chains using `WeightV2`, the TS decorated type will still reflect the old version. diff --git a/packages/types/src/interfaces/parachains/runtime.ts b/packages/types/src/interfaces/parachains/runtime.ts index 707b4b7b1f..591f854306 100644 --- a/packages/types/src/interfaces/parachains/runtime.ts +++ b/packages/types/src/interfaces/parachains/runtime.ts @@ -134,54 +134,66 @@ const PH_V1_TO_V2: DefinitionsCallEntry['methods'] = { } }; +const PH_V2_TO_V3: DefinitionsCallEntry['methods'] = { + pvfs_require_precheck: { + description: 'Returns code hashes of PVFs that require pre-checking by validators in the active set.', + params: [], + type: 'Vec' + }, + 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_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' + } +}; + export const runtime: DefinitionsCall = { ParachainHost: [ { methods: objectSpread({ - pvfs_require_precheck: { - description: 'Returns code hashes of PVFs that require pre-checking by validators in the active set.', + disputes: { + description: 'Returns all onchain disputes.', params: [], - type: 'Vec' - }, - 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_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' + type: 'Vec<(SessionIndex, CandidateHash, DisputeState)>' } - }, PH_V1_TO_V2), + }, PH_V1_TO_V2, PH_V2_TO_V3), + version: 3 + }, + { + methods: objectSpread({}, PH_V1_TO_V2, PH_V2_TO_V3), version: 2 }, {