Old runtime versions for Core (all) & BlockBuilder (some) (#5010)

This commit is contained in:
Jaco
2022-07-01 12:15:14 +03:00
committed by GitHub
parent 2ef672d4ec
commit e39a1ebac5
7 changed files with 229 additions and 55 deletions
@@ -1,12 +1,46 @@
// 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 BB_V5_TO_V6: DefinitionsCallEntry['methods'] = {
check_inherents: {
description: 'Check that the inherents are valid.',
params: [
{
name: 'block',
type: 'Block'
},
{
name: 'data',
type: 'InherentData'
}
],
type: 'CheckInherentsResult'
},
finalize_block: {
description: 'Finish the current block.',
params: [],
type: 'Header'
},
inherent_extrinsics: {
description: 'Generate inherent extrinsics.',
params: [
{
name: 'inherent',
type: 'InherentData'
}
],
type: 'Vec<Extrinsic>'
}
};
export const runtime: DefinitionsCall = {
BlockBuilder: [
{
methods: {
methods: objectSpread({
apply_extrinsic: {
description: 'Apply the given extrinsic.',
params: [
@@ -16,38 +50,24 @@ export const runtime: DefinitionsCall = {
}
],
type: 'ApplyExtrinsicResult'
},
check_inherents: {
description: 'Check that the inherents are valid.',
params: [
{
name: 'block',
type: 'Block'
},
{
name: 'data',
type: 'InherentData'
}
],
type: 'CheckInherentsResult'
},
finalize_block: {
description: 'Finish the current block.',
params: [],
type: 'Header'
},
inherent_extrinsics: {
description: 'Generate inherent extrinsics.',
params: [
{
name: 'inherent',
type: 'InherentData'
}
],
type: 'Vec<Extrinsic>'
}
},
}, BB_V5_TO_V6),
version: 6
},
{
methods: objectSpread({
apply_extrinsic: {
description: 'Apply the given extrinsic.',
params: [
{
name: 'extrinsic',
type: 'Extrinsic'
}
],
type: 'ApplyExtrinsicResultPre6'
}
}, BB_V5_TO_V6),
version: 5
}
]
};
@@ -1,23 +1,73 @@
// 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 CORE_V1_TO_V4: DefinitionsCallEntry['methods'] = {
execute_block: {
description: 'Execute the given block.',
params: [
{
name: 'block',
type: 'Block'
}
],
type: 'Null'
}
};
const CORE_V1_TO_V2: DefinitionsCallEntry['methods'] = {
version: {
description: 'Returns the version of the runtime.',
params: [],
type: 'RuntimeVersionPre3'
}
};
const CORE_V2_TO_V4: DefinitionsCallEntry['methods'] = {
initialize_block: {
description: 'Initialize a block with the given header.',
params: [
{
name: 'header',
type: 'Header'
}
],
type: 'Null'
}
};
export const runtime: DefinitionsCall = {
Core: [
{
methods: {
execute_block: {
description: 'Execute the given block.',
params: [
{
name: 'block',
type: 'Block'
}
],
type: 'Null'
},
initialize_block: {
methods: objectSpread({
version: {
description: 'Returns the version of the runtime.',
params: [],
type: 'RuntimeVersion'
}
}, CORE_V1_TO_V4, CORE_V2_TO_V4),
version: 4
},
{
methods: objectSpread({
version: {
description: 'Returns the version of the runtime.',
params: [],
type: 'RuntimeVersionPre4'
}
}, CORE_V1_TO_V4, CORE_V2_TO_V4),
version: 3
},
{
methods: objectSpread({}, CORE_V1_TO_V2, CORE_V1_TO_V4, CORE_V2_TO_V4),
version: 2
},
{
methods: objectSpread({
initialise_block: {
description: 'Initialize a block with the given header.',
params: [
{
@@ -26,14 +76,9 @@ export const runtime: DefinitionsCall = {
}
],
type: 'Null'
},
version: {
description: 'Returns the version of the runtime.',
params: [],
type: 'RuntimeVersion'
}
},
version: 4
}, CORE_V1_TO_V2, CORE_V1_TO_V4),
version: 1
}
],
TryRuntime: [
@@ -46,6 +46,16 @@ export default {
},
RuntimeVersionApi: '(ApiId, u32)',
RuntimeVersion: {
specName: 'Text',
implName: 'Text',
authoringVersion: 'u32',
specVersion: 'u32',
implVersion: 'u32',
apis: 'Vec<RuntimeVersionApi>',
transactionVersion: 'u32',
stateVersion: 'u8'
},
RuntimeVersionPre4: {
specName: 'Text',
implName: 'Text',
authoringVersion: 'u32',
@@ -54,6 +64,14 @@ export default {
apis: 'Vec<RuntimeVersionApi>',
transactionVersion: 'u32'
},
RuntimeVersionPre3: {
specName: 'Text',
implName: 'Text',
authoringVersion: 'u32',
specVersion: 'u32',
implVersion: 'u32',
apis: 'Vec<RuntimeVersionApi>'
},
RuntimeVersionPartial: {
specName: 'Text',
specVersion: 'u32',
+23 -1
View File
@@ -2,7 +2,7 @@
/* eslint-disable */
import type { StorageKey } from '@polkadot/types';
import type { Bytes, Enum, HashMap, Option, Struct, Text, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types-codec';
import type { Bytes, Enum, HashMap, Option, Struct, Text, U8aFixed, Vec, bool, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { Hash, StorageData } from '@polkadot/types/interfaces/runtime';
@@ -64,6 +64,7 @@ export interface RuntimeVersion extends Struct {
readonly implVersion: u32;
readonly apis: Vec<RuntimeVersionApi>;
readonly transactionVersion: u32;
readonly stateVersion: u8;
}
/** @name RuntimeVersionApi */
@@ -76,6 +77,27 @@ export interface RuntimeVersionPartial extends Struct {
readonly apis: Vec<RuntimeVersionApi>;
}
/** @name RuntimeVersionPre3 */
export interface RuntimeVersionPre3 extends Struct {
readonly specName: Text;
readonly implName: Text;
readonly authoringVersion: u32;
readonly specVersion: u32;
readonly implVersion: u32;
readonly apis: Vec<RuntimeVersionApi>;
}
/** @name RuntimeVersionPre4 */
export interface RuntimeVersionPre4 extends Struct {
readonly specName: Text;
readonly implName: Text;
readonly authoringVersion: u32;
readonly specVersion: u32;
readonly implVersion: u32;
readonly apis: Vec<RuntimeVersionApi>;
readonly transactionVersion: u32;
}
/** @name SpecVersion */
export interface SpecVersion extends u32 {}
@@ -43,6 +43,7 @@ export default {
data: 'AccountData'
},
ApplyExtrinsicResult: 'Result<DispatchOutcome, TransactionValidityError>',
ApplyExtrinsicResultPre6: 'Result<DispatchOutcomePre6, TransactionValidityError>',
ArithmeticError: {
_enum: [
'Underflow',
@@ -86,6 +87,20 @@ export default {
Transactional: 'TransactionalError'
}
},
DispatchErrorPre6: {
_enum: {
Other: 'Null',
CannotLookup: 'Null',
BadOrigin: 'Null',
Module: 'DispatchErrorModulePre6',
ConsumerRemaining: 'Null',
NoProviders: 'Null',
TooManyConsumers: 'Null',
Token: 'TokenError',
Arithmetic: 'ArithmeticError',
Transactional: 'TransactionalError'
}
},
DispatchErrorModuleU8: {
index: 'u8',
error: 'u8'
@@ -95,6 +110,7 @@ export default {
error: '[u8; 4]'
},
DispatchErrorModule: 'DispatchErrorModuleU8a',
DispatchErrorModulePre6: 'DispatchErrorModuleU8',
DispatchErrorTo198: {
module: 'Option<u8>',
error: 'u8'
@@ -114,6 +130,7 @@ export default {
paysFee: 'bool'
},
DispatchOutcome: 'Result<(), DispatchError>',
DispatchOutcomePre6: 'Result<(), DispatchErrorPre6>',
DispatchResult: 'Result<(), DispatchError>',
DispatchResultOf: 'DispatchResult',
DispatchResultTo198: 'Result<(), Text>',
@@ -56,6 +56,18 @@ export interface ApplyExtrinsicResult extends Result<DispatchOutcome, Transactio
readonly asOk: DispatchOutcome;
}
/** @name ApplyExtrinsicResultPre6 */
export interface ApplyExtrinsicResultPre6 extends Result<DispatchOutcomePre6, TransactionValidityError> {
readonly isErr: boolean;
readonly asErr: TransactionValidityError;
/** @deprecated Use isErr */
readonly isError: boolean;
/** @deprecated Use asErr */
readonly asError: TransactionValidityError;
readonly isOk: boolean;
readonly asOk: DispatchOutcomePre6;
}
/** @name ArithmeticError */
export interface ArithmeticError extends Enum {
readonly isUnderflow: boolean;
@@ -125,6 +137,9 @@ export interface DispatchError extends Enum {
/** @name DispatchErrorModule */
export interface DispatchErrorModule extends DispatchErrorModuleU8a {}
/** @name DispatchErrorModulePre6 */
export interface DispatchErrorModulePre6 extends DispatchErrorModuleU8 {}
/** @name DispatchErrorModuleU8 */
export interface DispatchErrorModuleU8 extends Struct {
readonly index: u8;
@@ -137,6 +152,25 @@ export interface DispatchErrorModuleU8a extends Struct {
readonly error: U8aFixed;
}
/** @name DispatchErrorPre6 */
export interface DispatchErrorPre6 extends Enum {
readonly isOther: boolean;
readonly isCannotLookup: boolean;
readonly isBadOrigin: boolean;
readonly isModule: boolean;
readonly asModule: DispatchErrorModulePre6;
readonly isConsumerRemaining: boolean;
readonly isNoProviders: boolean;
readonly isTooManyConsumers: boolean;
readonly isToken: boolean;
readonly asToken: TokenError;
readonly isArithmetic: boolean;
readonly asArithmetic: ArithmeticError;
readonly isTransactional: boolean;
readonly asTransactional: TransactionalError;
readonly type: 'Other' | 'CannotLookup' | 'BadOrigin' | 'Module' | 'ConsumerRemaining' | 'NoProviders' | 'TooManyConsumers' | 'Token' | 'Arithmetic' | 'Transactional';
}
/** @name DispatchErrorTo198 */
export interface DispatchErrorTo198 extends Struct {
readonly module: Option<u8>;
@@ -175,6 +209,18 @@ export interface DispatchOutcome extends Result<ITuple<[]>, DispatchError> {
readonly asOk: ITuple<[]>;
}
/** @name DispatchOutcomePre6 */
export interface DispatchOutcomePre6 extends Result<ITuple<[]>, DispatchErrorPre6> {
readonly isErr: boolean;
readonly asErr: DispatchErrorPre6;
/** @deprecated Use isErr */
readonly isError: boolean;
/** @deprecated Use asErr */
readonly asError: DispatchErrorPre6;
readonly isOk: boolean;
readonly asOk: ITuple<[]>;
}
/** @name DispatchResult */
export interface DispatchResult extends Result<ITuple<[]>, DispatchError> {
readonly isErr: boolean;