Add Updated Runtime Defintions (#5837)

* Start v15 runtime api support

* Update root too mmr_root

* fix MmrError type

* ensure type is generated

* Add ValidateStatement

* touch up statement

* Update core

* get core fixed

* Fix ExtrinsicInclusionMode type

* add mixnet

* Fix mixnet export

* fix type

* Add GenesisBuilder
This commit is contained in:
Tarik Gul
2024-04-01 16:41:30 +03:00
committed by GitHub
parent be0a764be7
commit ccae7c9421
24 changed files with 456 additions and 18 deletions
@@ -25,11 +25,13 @@ export { default as evm } from './evm/definitions.js';
export { default as extrinsics } from './extrinsics/definitions.js';
export { default as fungibles } from './fungibles/definitions.js';
export { default as genericAsset } from './genericAsset/definitions.js';
export { default as genesisBuilder } from './genesisBuilder/definitions.js';
export { default as gilt } from './gilt/definitions.js';
export { default as grandpa } from './grandpa/definitions.js';
export { default as identity } from './identity/definitions.js';
export { default as imOnline } from './imOnline/definitions.js';
export { default as lottery } from './lottery/definitions.js';
export { default as mixnet } from './mixnet/definitions.js';
export { default as mmr } from './mmr/definitions.js';
export { default as nfts } from './nfts/definitions.js';
export { default as nompools } from './nompools/definitions.js';
@@ -41,6 +43,7 @@ export { default as scheduler } from './scheduler/definitions.js';
export { default as session } from './session/definitions.js';
export { default as society } from './society/definitions.js';
export { default as staking } from './staking/definitions.js';
export { default as statement } from './statement/definitions.js';
export { default as support } from './support/definitions.js';
export { default as syncstate } from './syncstate/definitions.js';
export { default as system } from './system/definitions.js';
@@ -0,0 +1,14 @@
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Definitions } from '../../types/index.js';
import { runtime } from './runtime.js';
export default {
rpc: {},
runtime,
types: {
GenesisBuildErr: 'Text'
}
} as Definitions;
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types.js';
@@ -0,0 +1,29 @@
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types/index.js';
export const runtime: DefinitionsCall = {
GenesisBuilder: [
{
methods: {
build_config: {
description: 'Build `RuntimeGenesisConfig` from a JSON blob not using any defaults and store it in the storage.',
params: [
{
name: 'json',
type: 'Vec<u8>'
}
],
type: 'Result<(), GenesisBuildErr>'
},
create_default_config: {
description: 'Creates the default `RuntimeGenesisConfig` and returns it as a JSON blob.',
params: [],
type: 'Vec<u8>'
}
},
version: 1
}
]
};
@@ -0,0 +1,9 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Text } from '@polkadot/types-codec';
/** @name GenesisBuildErr */
export interface GenesisBuildErr extends Text {}
export type PHANTOM_GENESISBUILDER = 'genesisBuilder';
@@ -0,0 +1,33 @@
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Definitions } from '../../types/index.js';
import { runtime } from './runtime.js';
export default {
rpc: {},
runtime,
types: {
Mixnode: {
externalAddresses: 'Vec<Bytes>',
kxPublic: '[u8; 32]',
peerId: '[u8; 32]'
},
MixnodesErr: {
_enum: {
InsufficientRegistrations: {
min: 'u32',
num: 'u32'
}
}
},
SessionPhase: {
_enum: ['CoverToCurrent', 'RequestsToCurrent', 'CoverToPrev', 'DisconnectFromPrev']
},
SessionStatus: {
currentIndex: 'u32',
phase: 'SessionPhase'
}
}
} as Definitions;
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types.js';
@@ -0,0 +1,43 @@
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types/index.js';
export const runtime: DefinitionsCall = {
MixnetApi: [
{
methods: {
current_mixnodes: {
description: 'Get the index and phase of the current session.',
params: [],
type: 'Result<Mixnode, MixnodesErr>'
},
maybe_register: {
description: 'Try to register a mixnode for the next session.',
params: [
{
name: 'session_index',
type: 'u32'
},
{
name: 'mixnode',
type: 'Mixnode'
}
],
type: 'bool'
},
prev_mixnodes: {
description: 'Get the index and phase of the current session.',
params: [],
type: 'Result<Mixnode, MixnodesErr>'
},
session_status: {
description: 'Get the index and phase of the current session.',
params: [],
type: 'SessionStatus'
}
},
version: 1
}
]
};
@@ -0,0 +1,38 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Bytes, Enum, Struct, U8aFixed, Vec, u32 } from '@polkadot/types-codec';
/** @name Mixnode */
export interface Mixnode extends Struct {
readonly externalAddresses: Vec<Bytes>;
readonly kxPublic: U8aFixed;
readonly peerId: U8aFixed;
}
/** @name MixnodesErr */
export interface MixnodesErr extends Enum {
readonly isInsufficientRegistrations: boolean;
readonly asInsufficientRegistrations: {
readonly min: u32;
readonly num: u32;
} & Struct;
readonly type: 'InsufficientRegistrations';
}
/** @name SessionPhase */
export interface SessionPhase extends Enum {
readonly isCoverToCurrent: boolean;
readonly isRequestsToCurrent: boolean;
readonly isCoverToPrev: boolean;
readonly isDisconnectFromPrev: boolean;
readonly type: 'CoverToCurrent' | 'RequestsToCurrent' | 'CoverToPrev' | 'DisconnectFromPrev';
}
/** @name SessionStatus */
export interface SessionStatus extends Struct {
readonly currentIndex: u32;
readonly phase: SessionPhase;
}
export type PHANTOM_MIXNET = 'mixnet';
@@ -20,7 +20,7 @@ export default {
},
MmrEncodableOpaqueLeaf: 'Bytes',
MmrError: {
_enum: ['Push', 'GetRoot', 'Commit', 'GenerateProof', 'Verify', 'LeafNotFound', ' PalletNotIncluded', 'InvalidLeafIndex']
_enum: ['InvalidNumericOp', 'Push', 'GetRoot', 'Commit', 'GenerateProof', 'Verify', 'LeafNotFound', ' PalletNotIncluded', 'InvalidLeafIndex', 'InvalidBestKnownBlock']
},
MmrHash: 'Hash',
MmrLeafBatchProof: {
+6 -1
View File
@@ -18,7 +18,12 @@ const MMR_V2: Record<string, DefinitionCall> = {
],
type: 'Result<(Vec<MmrEncodableOpaqueLeaf>, MmrBatchProof), MmrError>'
},
root: {
mmr_leaf_count: {
description: 'Return the number of MMR blocks in the chain.',
params: [],
type: 'Result<U64, MmrError>'
},
mmr_root: {
description: 'Return the on-chain MMR root hash.',
params: [],
type: 'Result<Hash, MmrError>'
+3 -1
View File
@@ -17,6 +17,7 @@ export interface MmrEncodableOpaqueLeaf extends Bytes {}
/** @name MmrError */
export interface MmrError extends Enum {
readonly isInvalidNumericOp: boolean;
readonly isPush: boolean;
readonly isGetRoot: boolean;
readonly isCommit: boolean;
@@ -25,7 +26,8 @@ export interface MmrError extends Enum {
readonly isLeafNotFound: boolean;
readonly isPalletNotIncluded: boolean;
readonly isInvalidLeafIndex: boolean;
readonly type: 'Push' | 'GetRoot' | 'Commit' | 'GenerateProof' | 'Verify' | 'LeafNotFound' | 'PalletNotIncluded' | 'InvalidLeafIndex';
readonly isInvalidBestKnownBlock: boolean;
readonly type: 'InvalidNumericOp' | 'Push' | 'GetRoot' | 'Commit' | 'GenerateProof' | 'Verify' | 'LeafNotFound' | 'PalletNotIncluded' | 'InvalidLeafIndex' | 'InvalidBestKnownBlock';
}
/** @name MmrHash */
@@ -226,6 +226,11 @@ export default {
PreRuntime: '(ConsensusEngineId, Bytes)',
SealV0: '(u64, Signature)',
Seal: '(ConsensusEngineId, Bytes)',
Consensus: '(ConsensusEngineId, Bytes)'
Consensus: '(ConsensusEngineId, Bytes)',
// Type when core initialize_block went from v4 to v5
ExtrinsicInclusionMode: {
_enum: ['AllExtrinsics', 'OnlyInherents']
}
}
} as Definitions;
@@ -37,15 +37,40 @@ const CORE_V2_TO_V4: DefinitionsCallEntry['methods'] = {
}
};
const CORE_V4_VERSION: DefinitionsCallEntry['methods'] = {
version: {
description: 'Returns the version of the runtime.',
params: [],
type: 'RuntimeVersion'
}
};
const CORE_V4_TO_V5: DefinitionsCallEntry['methods'] = {
...CORE_V1_TO_V4,
initialize_block: {
description: 'Initialize a block with the given header.',
params: [
{
name: 'header',
type: 'Header'
}
],
type: 'ExtrinsicInclusionMode'
}
};
export const runtime: DefinitionsCall = {
Core: [
{
methods: {
version: {
description: 'Returns the version of the runtime.',
params: [],
type: 'RuntimeVersion'
},
...CORE_V4_VERSION,
...CORE_V4_TO_V5
},
version: 5
},
{
methods: {
...CORE_V4_VERSION,
...CORE_V1_TO_V4,
...CORE_V2_TO_V4
},
@@ -118,6 +118,13 @@ export interface DigestItem extends Enum {
/** @name EncodedJustification */
export interface EncodedJustification extends Bytes {}
/** @name ExtrinsicInclusionMode */
export interface ExtrinsicInclusionMode extends Enum {
readonly isAllExtrinsics: boolean;
readonly isOnlyInherents: boolean;
readonly type: 'AllExtrinsics' | 'OnlyInherents';
}
/** @name ExtrinsicsWeight */
export interface ExtrinsicsWeight extends Struct {
readonly normal: Weight;
@@ -0,0 +1,26 @@
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { Definitions } from '../../types/index.js';
import { runtime } from './runtime.js';
export default {
rpc: {},
runtime,
types: {
StatementStoreStatementSource: {
_enum: ['Chain', 'Network', 'Local']
},
StatementStoreValidStatement: {
maxCount: 'u32',
maxSize: 'u32'
},
StatementStoreInvalidStatement: {
_enum: ['BadProof', 'NoProof', 'InternalError']
}
}
} as Definitions;
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types.js';
@@ -0,0 +1,28 @@
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types/index.js';
export const runtime: DefinitionsCall = {
ValidateStatement: [
{
methods: {
valdate_statement: {
description: 'Validate the statement.',
params: [
{
name: 'source',
type: 'StatementStoreStatementSource'
},
{
name: 'statement',
type: 'SpStatementStoreStatement'
}
],
type: 'Result<StatementStoreValidStatement, StatementStoreInvalidStatement>'
}
},
version: 1
}
]
};
@@ -0,0 +1,28 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Enum, Struct, u32 } from '@polkadot/types-codec';
/** @name StatementStoreInvalidStatement */
export interface StatementStoreInvalidStatement extends Enum {
readonly isBadProof: boolean;
readonly isNoProof: boolean;
readonly isInternalError: boolean;
readonly type: 'BadProof' | 'NoProof' | 'InternalError';
}
/** @name StatementStoreStatementSource */
export interface StatementStoreStatementSource extends Enum {
readonly isChain: boolean;
readonly isNetwork: boolean;
readonly isLocal: boolean;
readonly type: 'Chain' | 'Network' | 'Local';
}
/** @name StatementStoreValidStatement */
export interface StatementStoreValidStatement extends Struct {
readonly maxCount: u32;
readonly maxSize: u32;
}
export type PHANTOM_STATEMENT = 'statement';
+3
View File
@@ -33,12 +33,14 @@ export * from './extrinsics/types.js';
export * from './finality/types.js';
export * from './fungibles/types.js';
export * from './genericAsset/types.js';
export * from './genesisBuilder/types.js';
export * from './gilt/types.js';
export * from './grandpa/types.js';
export * from './identity/types.js';
export * from './imOnline/types.js';
export * from './lottery/types.js';
export * from './metadata/types.js';
export * from './mixnet/types.js';
export * from './mmr/types.js';
export * from './nfts/types.js';
export * from './nimbus/types.js';
@@ -62,6 +64,7 @@ export * from './session/types.js';
export * from './society/types.js';
export * from './staking/types.js';
export * from './state/types.js';
export * from './statement/types.js';
export * from './support/types.js';
export * from './syncstate/types.js';
export * from './system/types.js';