diff --git a/dist/cjs/helper/task.d.ts b/dist/cjs/helper/task.d.ts index 9f839f1f..2e4d166b 100644 --- a/dist/cjs/helper/task.d.ts +++ b/dist/cjs/helper/task.d.ts @@ -1,4 +1,4 @@ -import { QueryParams, ProvingParams, DeployParams, Statistics, AddImageParams, WithSignature, UserQueryParams, PaymentParams, TxHistoryQueryParams, LogQuery, ResetImageParams, PaginationResult, Task, Image, TransactionInfo, AppConfig, OmitSignature, ModifyImageParams, SubscriptionRequest, ERC20DepositInfo, User, Subscription, PaginatedQuery, AutoSubmitProofQuery, Round1InfoQuery, Round1Info, Round2Info, Round2InfoQuery, AutoSubmitProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams } from "../interface/interface.js"; +import { QueryParams, ProvingParams, DeployParams, Statistics, AddImageParams, WithSignature, UserQueryParams, PaymentParams, TxHistoryQueryParams, LogQuery, ResetImageParams, PaginationResult, Task, Image, TransactionInfo, AppConfig, OmitSignature, ModifyImageParams, SubscriptionRequest, ERC20DepositInfo, User, Subscription, PaginatedQuery, AutoSubmitProofQuery, Round1InfoQuery, Round1Info, Round2Info, Round2InfoQuery, AutoSubmitProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams, ProverNodesSummary } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; export declare class ZkWasmServiceHelper { endpoint: ZkWasmServiceEndpoint; @@ -12,6 +12,7 @@ export declare class ZkWasmServiceHelper { queryConfig(): Promise; loadStatistics(): Promise; queryNodeStatistics(query: NodeStatisticsQueryParams): Promise>; + queryProverNodeSummary(): Promise; loadTasks(query: QueryParams): Promise>; loadTaskList(query: QueryParams): Promise>; queryAutoSubmitProofs(query: PaginatedQuery): Promise>; diff --git a/dist/cjs/helper/task.js b/dist/cjs/helper/task.js index 60510d05..7868bded 100644 --- a/dist/cjs/helper/task.js +++ b/dist/cjs/helper/task.js @@ -134,6 +134,16 @@ class ZkWasmServiceHelper { return res; }); } + queryProverNodeSummary() { + return __awaiter(this, void 0, void 0, function* () { + let headers = { "Content-Type": "application/json" }; + let res = yield this.endpoint.invokeRequest("GET", `/prover_node_summary`, JSON.parse("{}")); + if (this.endpoint.enable_logs) { + console.log("loading node summary"); + } + return res; + }); + } loadTasks(query) { return __awaiter(this, void 0, void 0, function* () { let headers = { "Content-Type": "application/json" }; diff --git a/dist/cjs/index.d.ts b/dist/cjs/index.d.ts index 9c046396..4dbcf018 100644 --- a/dist/cjs/index.d.ts +++ b/dist/cjs/index.d.ts @@ -1,7 +1,7 @@ -import { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, WithSignature, User, UserQueryParams, PaymentParams, SubscriptionParams, Subscription, SubscriptionType, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, TaskStatus, TaskType, AppConfig, PaginationResult, ResetImageParams, LogQuery, ModifyImageParams, ChainDetails, InputContextType, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProofStatus, Round1Status, Round2Status, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc, NodeStatistics, NodeStatisticsQueryParams, MaintenanceModeType, SetMaintenanceModeParams, AdminRequestType, ServerVersionInfo } from "./interface/interface.js"; +import { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, WithSignature, User, UserQueryParams, PaymentParams, SubscriptionParams, Subscription, SubscriptionType, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, TaskStatus, TaskType, AppConfig, PaginationResult, ResetImageParams, LogQuery, ModifyImageParams, ChainDetails, InputContextType, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProofStatus, Round1Status, Round2Status, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc, NodeStatistics, NodeStatisticsQueryParams, MaintenanceModeType, SetMaintenanceModeParams, AdminRequestType, ServerVersionInfo, ProverLevel, ProverNodesSummary } from "./interface/interface.js"; import { ZkWasmUtil } from "./helper/util.js"; import { ZkWasmServiceEndpoint } from "./helper/endpoint.js"; import { ZkWasmServiceHelper } from "./helper/task.js"; import { ERC20Lib } from "./abi/ERC20.js"; -export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, }; -export type { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, TaskStatus, TaskType, WithSignature, User, UserQueryParams, Subscription, SubscriptionType, PaymentParams, SubscriptionParams, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, ResetImageParams, AppConfig, PaginationResult, LogQuery, ModifyImageParams, ChainDetails, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams, ServerVersionInfo, }; +export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, ProverLevel, }; +export type { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, TaskStatus, TaskType, WithSignature, User, UserQueryParams, Subscription, SubscriptionType, PaymentParams, SubscriptionParams, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, ResetImageParams, AppConfig, PaginationResult, LogQuery, ModifyImageParams, ChainDetails, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams, ServerVersionInfo, ProverNodesSummary, }; diff --git a/dist/cjs/index.js b/dist/cjs/index.js index bcc0d5d6..38971ef6 100644 --- a/dist/cjs/index.js +++ b/dist/cjs/index.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.AdminRequestType = exports.MaintenanceModeType = exports.ProvePaymentSrc = exports.ProofSubmitMode = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.AutoSubmitStatus = exports.InputContextType = exports.ERC20Lib = exports.ZkWasmUtil = exports.ZkWasmServiceHelper = exports.ZkWasmServiceEndpoint = void 0; +exports.ProverLevel = exports.AdminRequestType = exports.MaintenanceModeType = exports.ProvePaymentSrc = exports.ProofSubmitMode = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.AutoSubmitStatus = exports.InputContextType = exports.ERC20Lib = exports.ZkWasmUtil = exports.ZkWasmServiceHelper = exports.ZkWasmServiceEndpoint = void 0; const interface_js_1 = require("./interface/interface.js"); Object.defineProperty(exports, "InputContextType", { enumerable: true, get: function () { return interface_js_1.InputContextType; } }); Object.defineProperty(exports, "AutoSubmitProofStatus", { enumerable: true, get: function () { return interface_js_1.AutoSubmitProofStatus; } }); @@ -11,6 +11,7 @@ Object.defineProperty(exports, "ProofSubmitMode", { enumerable: true, get: funct Object.defineProperty(exports, "ProvePaymentSrc", { enumerable: true, get: function () { return interface_js_1.ProvePaymentSrc; } }); Object.defineProperty(exports, "MaintenanceModeType", { enumerable: true, get: function () { return interface_js_1.MaintenanceModeType; } }); Object.defineProperty(exports, "AdminRequestType", { enumerable: true, get: function () { return interface_js_1.AdminRequestType; } }); +Object.defineProperty(exports, "ProverLevel", { enumerable: true, get: function () { return interface_js_1.ProverLevel; } }); const util_js_1 = require("./helper/util.js"); Object.defineProperty(exports, "ZkWasmUtil", { enumerable: true, get: function () { return util_js_1.ZkWasmUtil; } }); const endpoint_js_1 = require("./helper/endpoint.js"); diff --git a/dist/cjs/interface/interface.d.ts b/dist/cjs/interface/interface.d.ts index 6eb53308..becada43 100644 --- a/dist/cjs/interface/interface.d.ts +++ b/dist/cjs/interface/interface.d.ts @@ -22,6 +22,26 @@ export interface NodeStatistics { version_info?: { version: string; }; + performance_track: string; + prover_level: ProverLevel; + last_attempted_task?: { + task_id: { + $oid: string; + }; + timestamp: string; + }; +} +export interface ProverNodesSummary { + certified_prover_count: number; + active_prover_count: number; + intern_prover_count: number; + inactive_prover_count: number; +} +export declare enum ProverLevel { + Inactive = "Inactive", + Intern = "Intern", + Active = "Active", + Certified = "Certified" } export interface NodeStatisticsQueryParams { address?: string; @@ -200,7 +220,7 @@ export type TaskType = "Setup" | "Prove" | "Reset"; * Verified: At least one of the proof task had been done successfully for the image. **/ export type ImageStatus = "Received" | "Initialized" | "Verified"; -export type TaskStatus = "Pending" | "Processing" | "DryRunSuccess" | "DryRunFailed" | "Done" | "Fail" | "Stale"; +export type TaskStatus = "Pending" | "Processing" | "DryRunSuccess" | "DryRunFailed" | "Done" | "Fail" | "Unprovable" | "Stale"; export declare enum AutoSubmitStatus { Round1 = "Round1", Round2 = "Round2", diff --git a/dist/cjs/interface/interface.js b/dist/cjs/interface/interface.js index f97a0a08..f9aaf12d 100644 --- a/dist/cjs/interface/interface.js +++ b/dist/cjs/interface/interface.js @@ -1,6 +1,13 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.AdminRequestType = exports.MaintenanceModeType = exports.ProofSubmitMode = exports.ProvePaymentSrc = exports.AutoSubmitStatus = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.InputContextType = void 0; +exports.AdminRequestType = exports.MaintenanceModeType = exports.ProofSubmitMode = exports.ProvePaymentSrc = exports.AutoSubmitStatus = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.InputContextType = exports.ProverLevel = void 0; +var ProverLevel; +(function (ProverLevel) { + ProverLevel["Inactive"] = "Inactive"; + ProverLevel["Intern"] = "Intern"; + ProverLevel["Active"] = "Active"; + ProverLevel["Certified"] = "Certified"; +})(ProverLevel = exports.ProverLevel || (exports.ProverLevel = {})); var InputContextType; (function (InputContextType) { InputContextType["Custom"] = "Custom"; diff --git a/dist/mjs/helper/task.d.ts b/dist/mjs/helper/task.d.ts index 9f839f1f..2e4d166b 100644 --- a/dist/mjs/helper/task.d.ts +++ b/dist/mjs/helper/task.d.ts @@ -1,4 +1,4 @@ -import { QueryParams, ProvingParams, DeployParams, Statistics, AddImageParams, WithSignature, UserQueryParams, PaymentParams, TxHistoryQueryParams, LogQuery, ResetImageParams, PaginationResult, Task, Image, TransactionInfo, AppConfig, OmitSignature, ModifyImageParams, SubscriptionRequest, ERC20DepositInfo, User, Subscription, PaginatedQuery, AutoSubmitProofQuery, Round1InfoQuery, Round1Info, Round2Info, Round2InfoQuery, AutoSubmitProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams } from "../interface/interface.js"; +import { QueryParams, ProvingParams, DeployParams, Statistics, AddImageParams, WithSignature, UserQueryParams, PaymentParams, TxHistoryQueryParams, LogQuery, ResetImageParams, PaginationResult, Task, Image, TransactionInfo, AppConfig, OmitSignature, ModifyImageParams, SubscriptionRequest, ERC20DepositInfo, User, Subscription, PaginatedQuery, AutoSubmitProofQuery, Round1InfoQuery, Round1Info, Round2Info, Round2InfoQuery, AutoSubmitProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams, ProverNodesSummary } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; export declare class ZkWasmServiceHelper { endpoint: ZkWasmServiceEndpoint; @@ -12,6 +12,7 @@ export declare class ZkWasmServiceHelper { queryConfig(): Promise; loadStatistics(): Promise; queryNodeStatistics(query: NodeStatisticsQueryParams): Promise>; + queryProverNodeSummary(): Promise; loadTasks(query: QueryParams): Promise>; loadTaskList(query: QueryParams): Promise>; queryAutoSubmitProofs(query: PaginatedQuery): Promise>; diff --git a/dist/mjs/helper/task.js b/dist/mjs/helper/task.js index 26ef7651..de8390e5 100644 --- a/dist/mjs/helper/task.js +++ b/dist/mjs/helper/task.js @@ -91,6 +91,14 @@ export class ZkWasmServiceHelper { } return res; } + async queryProverNodeSummary() { + let headers = { "Content-Type": "application/json" }; + let res = await this.endpoint.invokeRequest("GET", `/prover_node_summary`, JSON.parse("{}")); + if (this.endpoint.enable_logs) { + console.log("loading node summary"); + } + return res; + } async loadTasks(query) { let headers = { "Content-Type": "application/json" }; let queryJson = JSON.parse("{}"); diff --git a/dist/mjs/index.d.ts b/dist/mjs/index.d.ts index 9c046396..4dbcf018 100644 --- a/dist/mjs/index.d.ts +++ b/dist/mjs/index.d.ts @@ -1,7 +1,7 @@ -import { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, WithSignature, User, UserQueryParams, PaymentParams, SubscriptionParams, Subscription, SubscriptionType, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, TaskStatus, TaskType, AppConfig, PaginationResult, ResetImageParams, LogQuery, ModifyImageParams, ChainDetails, InputContextType, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProofStatus, Round1Status, Round2Status, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc, NodeStatistics, NodeStatisticsQueryParams, MaintenanceModeType, SetMaintenanceModeParams, AdminRequestType, ServerVersionInfo } from "./interface/interface.js"; +import { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, WithSignature, User, UserQueryParams, PaymentParams, SubscriptionParams, Subscription, SubscriptionType, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, TaskStatus, TaskType, AppConfig, PaginationResult, ResetImageParams, LogQuery, ModifyImageParams, ChainDetails, InputContextType, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProofStatus, Round1Status, Round2Status, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc, NodeStatistics, NodeStatisticsQueryParams, MaintenanceModeType, SetMaintenanceModeParams, AdminRequestType, ServerVersionInfo, ProverLevel, ProverNodesSummary } from "./interface/interface.js"; import { ZkWasmUtil } from "./helper/util.js"; import { ZkWasmServiceEndpoint } from "./helper/endpoint.js"; import { ZkWasmServiceHelper } from "./helper/task.js"; import { ERC20Lib } from "./abi/ERC20.js"; -export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, }; -export type { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, TaskStatus, TaskType, WithSignature, User, UserQueryParams, Subscription, SubscriptionType, PaymentParams, SubscriptionParams, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, ResetImageParams, AppConfig, PaginationResult, LogQuery, ModifyImageParams, ChainDetails, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams, ServerVersionInfo, }; +export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, ProverLevel, }; +export type { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, TaskStatus, TaskType, WithSignature, User, UserQueryParams, Subscription, SubscriptionType, PaymentParams, SubscriptionParams, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, ResetImageParams, AppConfig, PaginationResult, LogQuery, ModifyImageParams, ChainDetails, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams, ServerVersionInfo, ProverNodesSummary, }; diff --git a/dist/mjs/index.js b/dist/mjs/index.js index 159dcf4e..8f7abefc 100644 --- a/dist/mjs/index.js +++ b/dist/mjs/index.js @@ -1,6 +1,6 @@ -import { InputContextType, AutoSubmitProofStatus, Round1Status, Round2Status, AutoSubmitStatus, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, } from "./interface/interface.js"; +import { InputContextType, AutoSubmitProofStatus, Round1Status, Round2Status, AutoSubmitStatus, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, ProverLevel, } from "./interface/interface.js"; import { ZkWasmUtil } from "./helper/util.js"; import { ZkWasmServiceEndpoint } from "./helper/endpoint.js"; import { ZkWasmServiceHelper } from "./helper/task.js"; import { ERC20Lib } from "./abi/ERC20.js"; -export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, }; +export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, ProverLevel, }; diff --git a/dist/mjs/interface/interface.d.ts b/dist/mjs/interface/interface.d.ts index 6eb53308..becada43 100644 --- a/dist/mjs/interface/interface.d.ts +++ b/dist/mjs/interface/interface.d.ts @@ -22,6 +22,26 @@ export interface NodeStatistics { version_info?: { version: string; }; + performance_track: string; + prover_level: ProverLevel; + last_attempted_task?: { + task_id: { + $oid: string; + }; + timestamp: string; + }; +} +export interface ProverNodesSummary { + certified_prover_count: number; + active_prover_count: number; + intern_prover_count: number; + inactive_prover_count: number; +} +export declare enum ProverLevel { + Inactive = "Inactive", + Intern = "Intern", + Active = "Active", + Certified = "Certified" } export interface NodeStatisticsQueryParams { address?: string; @@ -200,7 +220,7 @@ export type TaskType = "Setup" | "Prove" | "Reset"; * Verified: At least one of the proof task had been done successfully for the image. **/ export type ImageStatus = "Received" | "Initialized" | "Verified"; -export type TaskStatus = "Pending" | "Processing" | "DryRunSuccess" | "DryRunFailed" | "Done" | "Fail" | "Stale"; +export type TaskStatus = "Pending" | "Processing" | "DryRunSuccess" | "DryRunFailed" | "Done" | "Fail" | "Unprovable" | "Stale"; export declare enum AutoSubmitStatus { Round1 = "Round1", Round2 = "Round2", diff --git a/dist/mjs/interface/interface.js b/dist/mjs/interface/interface.js index 3dc08efe..b6d989b8 100644 --- a/dist/mjs/interface/interface.js +++ b/dist/mjs/interface/interface.js @@ -1,3 +1,10 @@ +export var ProverLevel; +(function (ProverLevel) { + ProverLevel["Inactive"] = "Inactive"; + ProverLevel["Intern"] = "Intern"; + ProverLevel["Active"] = "Active"; + ProverLevel["Certified"] = "Certified"; +})(ProverLevel || (ProverLevel = {})); export var InputContextType; (function (InputContextType) { InputContextType["Custom"] = "Custom"; diff --git a/src/helper/task.ts b/src/helper/task.ts index c04bf1df..2da48b7e 100644 --- a/src/helper/task.ts +++ b/src/helper/task.ts @@ -34,6 +34,7 @@ import { NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams, + ProverNodesSummary, } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; import { ethers } from "ethers"; @@ -178,6 +179,21 @@ export class ZkWasmServiceHelper { return res as PaginationResult; } + async queryProverNodeSummary(): Promise { + let headers = { "Content-Type": "application/json" }; + + let res = await this.endpoint.invokeRequest( + "GET", + `/prover_node_summary`, + JSON.parse("{}") + ); + if (this.endpoint.enable_logs) { + console.log("loading node summary"); + } + + return res as ProverNodesSummary; + } + async loadTasks(query: QueryParams): Promise> { let headers = { "Content-Type": "application/json" }; let queryJson = JSON.parse("{}"); diff --git a/src/index.ts b/src/index.ts index 0244fd0a..983de20a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,6 +60,8 @@ import { SetMaintenanceModeParams, AdminRequestType, ServerVersionInfo, + ProverLevel, + ProverNodesSummary, } from "./interface/interface.js"; import { ZkWasmUtil } from "./helper/util.js"; @@ -81,6 +83,7 @@ export { ProvePaymentSrc, MaintenanceModeType, AdminRequestType, + ProverLevel, }; export type { @@ -136,4 +139,5 @@ export type { NodeStatisticsQueryParams, SetMaintenanceModeParams, ServerVersionInfo, + ProverNodesSummary, }; diff --git a/src/interface/interface.ts b/src/interface/interface.ts index bdee3fc6..b49bd125 100644 --- a/src/interface/interface.ts +++ b/src/interface/interface.ts @@ -24,6 +24,28 @@ export interface NodeStatistics { version_info?: { version: string; }; + performance_track: string; + prover_level: ProverLevel; + last_attempted_task?: { + task_id: { + $oid: string; + }; + timestamp: string; + }; +} + +export interface ProverNodesSummary { + certified_prover_count: number; + active_prover_count: number; + intern_prover_count: number; + inactive_prover_count: number; +} + +export enum ProverLevel { + Inactive = "Inactive", + Intern = "Intern", + Active = "Active", + Certified = "Certified", } export interface NodeStatisticsQueryParams { @@ -251,6 +273,7 @@ export type TaskStatus = | "DryRunFailed" | "Done" | "Fail" + | "Unprovable" | "Stale"; export enum AutoSubmitStatus {