state_trieMigrationStatus RPC (#4664)

This commit is contained in:
Jaco
2022-03-18 09:40:37 +02:00
committed by GitHub
parent 8c87b16924
commit 9dfb5cb237
5 changed files with 21 additions and 4 deletions
+2 -1
View File
@@ -5,7 +5,8 @@
Changes:
- Support for rejection of hanging RPC requests (30s timeout)
- Add `.stats()` to provider interfaces with running counters
- Add `.stats` to provider interfaces with running counters
- Add support for `state_trieMigrationStatus` RPC
- Update to latest Substrate, Kusama & Polkadot static metadata
+1 -1
View File
@@ -91,7 +91,7 @@ export class HttpProvider implements ProviderInterface {
/**
* @description Returns the connection stats
*/
public stats (): ProviderStats {
public get stats (): ProviderStats {
return this.#stats;
}
+1 -1
View File
@@ -51,13 +51,13 @@ export type ProviderInterfaceEmitCb = (value?: any) => any;
export interface ProviderInterface {
readonly hasSubscriptions: boolean;
readonly isConnected: boolean;
readonly stats?: ProviderStats;
clone (): ProviderInterface;
connect (): Promise<void>;
disconnect (): Promise<void>;
on (type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): () => void;
send <T = any> (method: string, params: unknown[], isCacheable?: boolean): Promise<T>;
stats?: () => ProviderStats;
subscribe (type: string, method: string, params: unknown[], cb: ProviderInterfaceCallback): Promise<number | string>;
unsubscribe (type: string, method: string, id: number | string): Promise<boolean>;
}
+1 -1
View File
@@ -260,7 +260,7 @@ export class WsProvider implements ProviderInterface {
/**
* @description Returns the connection stats
*/
public stats (): ProviderStats {
public get stats (): ProviderStats {
return {
active: {
requests: Object.keys(this.#handlers).length,
@@ -394,6 +394,18 @@ export default {
}
],
type: 'TraceBlockResponse'
},
trieMigrationStatus: {
description: 'Check current migration state',
params: [
{
name: 'at',
type: 'BlockHash',
isHistoric: true,
isOptional: true
}
],
type: 'MigrationStatusResult'
}
},
types: {
@@ -422,6 +434,10 @@ export default {
wasm: 'bool'
},
KeyValueOption: '(StorageKey, Option<StorageData>)',
MigrationStatusResult: {
topRemainingToMigrate: 'u64',
childRemainingToMigrate: 'u64'
},
ReadProof: {
at: 'Hash',
proof: 'Vec<Bytes>'