@maci-protocol/coordinator 0.0.0-ci.da13fbb → 0.0.0-ci.de6bbd5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/build/scripts/generateKeypair.js +2 -2
- package/build/scripts/generateKeypair.js.map +1 -1
- package/build/tests/e2e.deploy.test.js +28 -17
- package/build/tests/e2e.deploy.test.js.map +1 -1
- package/build/tests/e2e.redis.test.d.ts +2 -0
- package/build/tests/e2e.redis.test.d.ts.map +1 -0
- package/build/tests/e2e.redis.test.js +119 -0
- package/build/tests/e2e.redis.test.js.map +1 -0
- package/build/tests/utils.d.ts.map +1 -1
- package/build/tests/utils.js.map +1 -1
- package/build/ts/app.module.d.ts.map +1 -1
- package/build/ts/app.module.js +4 -0
- package/build/ts/app.module.js.map +1 -1
- package/build/ts/common/__tests__/common.test.js +1 -11
- package/build/ts/common/__tests__/common.test.js.map +1 -1
- package/build/ts/common/chain.d.ts.map +1 -1
- package/build/ts/common/chain.js +4 -3
- package/build/ts/common/chain.js.map +1 -1
- package/build/ts/common/errors.d.ts +12 -11
- package/build/ts/common/errors.d.ts.map +1 -1
- package/build/ts/common/errors.js +12 -11
- package/build/ts/common/errors.js.map +1 -1
- package/build/ts/deployer/__tests__/deployer.controller.test.js +7 -7
- package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -1
- package/build/ts/deployer/__tests__/deployer.service.test.js +71 -11
- package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -1
- package/build/ts/deployer/__tests__/utils.d.ts +0 -1
- package/build/ts/deployer/__tests__/utils.d.ts.map +1 -1
- package/build/ts/deployer/__tests__/utils.js +4 -4
- package/build/ts/deployer/__tests__/utils.js.map +1 -1
- package/build/ts/deployer/deployer.service.d.ts +17 -7
- package/build/ts/deployer/deployer.service.d.ts.map +1 -1
- package/build/ts/deployer/deployer.service.js +207 -54
- package/build/ts/deployer/deployer.service.js.map +1 -1
- package/build/ts/deployer/types.d.ts +18 -11
- package/build/ts/deployer/types.d.ts.map +1 -1
- package/build/ts/file/file.service.js +2 -2
- package/build/ts/file/file.service.js.map +1 -1
- package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
- package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
- package/build/ts/health/__tests__/health.controller.test.js +28 -0
- package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
- package/build/ts/health/__tests__/health.service.test.d.ts +2 -0
- package/build/ts/health/__tests__/health.service.test.d.ts.map +1 -0
- package/build/ts/health/__tests__/health.service.test.js +88 -0
- package/build/ts/health/__tests__/health.service.test.js.map +1 -0
- package/build/ts/health/health.controller.d.ts +16 -0
- package/build/ts/health/health.controller.d.ts.map +1 -0
- package/build/ts/health/health.controller.js +43 -0
- package/build/ts/health/health.controller.js.map +1 -0
- package/build/ts/health/health.module.d.ts +3 -0
- package/build/ts/health/health.module.d.ts.map +1 -0
- package/build/ts/health/health.module.js +22 -0
- package/build/ts/health/health.module.js.map +1 -0
- package/build/ts/health/health.service.d.ts +42 -0
- package/build/ts/health/health.service.d.ts.map +1 -0
- package/build/ts/health/health.service.js +182 -0
- package/build/ts/health/health.service.js.map +1 -0
- package/build/ts/health/types.d.ts +83 -0
- package/build/ts/health/types.d.ts.map +1 -0
- package/build/ts/health/types.js +2 -0
- package/build/ts/health/types.js.map +1 -0
- package/build/ts/proof/__tests__/proof.service.test.js +28 -54
- package/build/ts/proof/__tests__/proof.service.test.js.map +1 -1
- package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
- package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
- package/build/ts/redis/__tests__/redis.service.test.js +149 -0
- package/build/ts/redis/__tests__/redis.service.test.js.map +1 -0
- package/build/ts/redis/redis.module.d.ts +3 -0
- package/build/ts/redis/redis.module.d.ts.map +1 -0
- package/build/ts/redis/redis.module.js +18 -0
- package/build/ts/redis/redis.module.js.map +1 -0
- package/build/ts/redis/redis.service.d.ts +52 -0
- package/build/ts/redis/redis.service.d.ts.map +1 -0
- package/build/ts/redis/redis.service.js +97 -0
- package/build/ts/redis/redis.service.js.map +1 -0
- package/build/ts/redis/types.d.ts +54 -0
- package/build/ts/redis/types.d.ts.map +1 -0
- package/build/ts/redis/types.js +2 -0
- package/build/ts/redis/types.js.map +1 -0
- package/build/ts/redis/utils.d.ts +20 -0
- package/build/ts/redis/utils.d.ts.map +1 -0
- package/build/ts/redis/utils.js +27 -0
- package/build/ts/redis/utils.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +2 -2
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -1
- package/build/ts/subgraph/__tests__/subgraph.service.test.js +2 -3
- package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -1
- package/build/ts/subgraph/subgraph.service.d.ts +4 -0
- package/build/ts/subgraph/subgraph.service.d.ts.map +1 -1
- package/build/ts/subgraph/subgraph.service.js +16 -5
- package/build/ts/subgraph/subgraph.service.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +22 -21
- package/build/tests/e2e.aa.test.d.ts +0 -2
- package/build/tests/e2e.aa.test.d.ts.map +0 -1
- package/build/tests/e2e.aa.test.js +0 -96
- package/build/tests/e2e.aa.test.js.map +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { EMode } from "@maci-protocol/contracts";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
import { zeroAddress } from "viem";
|
|
4
|
+
import { FileService } from "../../file/file.service";
|
|
5
|
+
import { RedisService } from "../../redis/redis.service";
|
|
6
|
+
import { HealthService } from "../health.service";
|
|
7
|
+
dotenv.config();
|
|
8
|
+
describe("HealthService", () => {
|
|
9
|
+
const fileService = new FileService();
|
|
10
|
+
const redisService = new RedisService();
|
|
11
|
+
const healthService = new HealthService(fileService, redisService);
|
|
12
|
+
beforeAll(async () => {
|
|
13
|
+
await redisService.onModuleInit();
|
|
14
|
+
});
|
|
15
|
+
describe("checkRapidsnark", () => {
|
|
16
|
+
it("should return rapidsnark path and executability status", async () => {
|
|
17
|
+
const response = await healthService.checkRapidsnark();
|
|
18
|
+
expect(response.rapidsnarkExecutablePath).toBe(process.env.COORDINATOR_RAPIDSNARK_EXE);
|
|
19
|
+
expect(response.rapidsnarkIsAccessible).toBe(true);
|
|
20
|
+
expect(response.rapidsnarkIsExecutable).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
it("should return false when rapidsnark path is not set", async () => {
|
|
23
|
+
process.env.COORDINATOR_RAPIDSNARK_EXE = "/incorrect/path/to/rapidsnark";
|
|
24
|
+
const response = await healthService.checkRapidsnark();
|
|
25
|
+
expect(response.rapidsnarkIsAccessible).toBe(false);
|
|
26
|
+
expect(response.rapidsnarkIsExecutable).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe("checkZkeysDirectory", () => {
|
|
30
|
+
it("should return if zkeys directory exists and the available zkeys paths", async () => {
|
|
31
|
+
const { zkeysDirectoryExists, availableZkeys } = await healthService.checkZkeysDirectory();
|
|
32
|
+
const numberofZkeys = Object.keys(availableZkeys).length;
|
|
33
|
+
const expectedNumberOfZkeys = 1 + // poll joining zkey
|
|
34
|
+
1 + // poll joined zkey
|
|
35
|
+
3 + // message process zkey for modes (QV, NON_QV, FULL)
|
|
36
|
+
2; // vote tally zkey for modes (only QV and NON_QV)
|
|
37
|
+
expect(zkeysDirectoryExists).toBe(true);
|
|
38
|
+
expect(numberofZkeys).toBe(expectedNumberOfZkeys);
|
|
39
|
+
});
|
|
40
|
+
it("should return less available zkeys when COORDINATOR_POLL_JOINING_ZKEY_NAME is not set in the env file", async () => {
|
|
41
|
+
process.env.COORDINATOR_POLL_JOINING_ZKEY_NAME = "/incorrect/path/to/poll_joining";
|
|
42
|
+
const { availableZkeys } = await healthService.checkZkeysDirectory();
|
|
43
|
+
expect(availableZkeys[process.env.COORDINATOR_POLL_JOINING_ZKEY_NAME]).toBe(undefined);
|
|
44
|
+
});
|
|
45
|
+
it("should return less available zkeys when COORDINATOR_POLL_JOINED_ZKEY_NAME is not set in the env file", async () => {
|
|
46
|
+
process.env.COORDINATOR_POLL_JOINED_ZKEY_NAME = "/incorrect/path/to/poll_joined";
|
|
47
|
+
const { availableZkeys } = await healthService.checkZkeysDirectory();
|
|
48
|
+
expect(availableZkeys[process.env.COORDINATOR_POLL_JOINED_ZKEY_NAME]).toBe(undefined);
|
|
49
|
+
});
|
|
50
|
+
it("should return less available zkeys when COORDINATOR_TALLY_ZKEY_NAME is not set in the env file", async () => {
|
|
51
|
+
process.env.COORDINATOR_TALLY_ZKEY_NAME = "/incorrect/path/to/tally_zkey";
|
|
52
|
+
const { availableZkeys } = await healthService.checkZkeysDirectory();
|
|
53
|
+
expect(availableZkeys[`${process.env.COORDINATOR_TALLY_ZKEY_NAME}_Mode_${String(EMode.NON_QV)}`]).toBe(undefined);
|
|
54
|
+
expect(availableZkeys[`${process.env.COORDINATOR_TALLY_ZKEY_NAME}_Mode_${String(EMode.QV)}`]).toBe(undefined);
|
|
55
|
+
});
|
|
56
|
+
it("should return less available zkeys when COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME is not set in the env file", async () => {
|
|
57
|
+
process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME = "/incorrect/path/to/message_process_zkey";
|
|
58
|
+
const { availableZkeys } = await healthService.checkZkeysDirectory();
|
|
59
|
+
expect(availableZkeys[`${process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME}_Mode_${String(EMode.NON_QV)}`]).toBe(undefined);
|
|
60
|
+
expect(availableZkeys[`${process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME}_Mode_${String(EMode.QV)}`]).toBe(undefined);
|
|
61
|
+
expect(availableZkeys[`${process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME}_Mode_${String(EMode.FULL)}`]).toBe(undefined);
|
|
62
|
+
});
|
|
63
|
+
it("should return false when zkeys directory is not set", async () => {
|
|
64
|
+
process.env.COORDINATOR_ZKEY_PATH = "/incorrect/path/to/zkeys";
|
|
65
|
+
const { zkeysDirectoryExists } = await healthService.checkZkeysDirectory();
|
|
66
|
+
expect(zkeysDirectoryExists).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe("checkWalletFunds", () => {
|
|
70
|
+
it("should return the wallet address", async () => {
|
|
71
|
+
const { address } = await healthService.checkWalletFunds();
|
|
72
|
+
expect(address).toBeDefined();
|
|
73
|
+
expect(address).not.toBe(zeroAddress);
|
|
74
|
+
});
|
|
75
|
+
it("should return 0x if coordinator private key is not set", async () => {
|
|
76
|
+
process.env.PRIVATE_KEY = "";
|
|
77
|
+
const { address } = await healthService.checkWalletFunds();
|
|
78
|
+
expect(address).toBe(zeroAddress);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe("checkRedisConnection", () => {
|
|
82
|
+
it("should return true if Redis connection is open", () => {
|
|
83
|
+
const isRedisOpen = healthService.checkRedisConnection();
|
|
84
|
+
expect(isRedisOpen).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=health.service.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.service.test.js","sourceRoot":"","sources":["../../../../ts/health/__tests__/health.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,M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MAAM,aAAa,CAAC,mBAAmB,EAAE,CAAC;YAE3E,MAAM,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;YAChD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,aAAa,CAAC,gBAAgB,EAAE,CAAC;YAE3D,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;YAC9B,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;YACtE,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,EAAE,CAAC;YAC7B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,aAAa,CAAC,gBAAgB,EAAE,CAAC;YAE3D,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,WAAW,GAAG,aAAa,CAAC,oBAAoB,EAAE,CAAC;YAEzD,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HealthService } from "./health.service";
|
|
2
|
+
import { IHealthCheckResponse } from "./types";
|
|
3
|
+
export declare class HealthController {
|
|
4
|
+
private readonly healthService;
|
|
5
|
+
/**
|
|
6
|
+
* Initialize HealthController
|
|
7
|
+
*/
|
|
8
|
+
constructor(healthService: HealthService);
|
|
9
|
+
/**
|
|
10
|
+
* Health check api method.
|
|
11
|
+
*
|
|
12
|
+
* @returns true if the service is running
|
|
13
|
+
*/
|
|
14
|
+
check(): Promise<IHealthCheckResponse>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=health.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.controller.d.ts","sourceRoot":"","sources":["../../../ts/health/health.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,qBAEa,gBAAgB;IAIf,OAAO,CAAC,QAAQ,CAAC,aAAa;IAH1C;;OAEG;gBAC0B,aAAa,EAAE,aAAa;IAEzD;;;;OAIG;IAGH,KAAK,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAGvC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Controller, Get, HttpStatus } from "@nestjs/common";
|
|
11
|
+
import { ApiResponse, ApiTags } from "@nestjs/swagger";
|
|
12
|
+
import { HealthService } from "./health.service";
|
|
13
|
+
let HealthController = class HealthController {
|
|
14
|
+
healthService;
|
|
15
|
+
/**
|
|
16
|
+
* Initialize HealthController
|
|
17
|
+
*/
|
|
18
|
+
constructor(healthService) {
|
|
19
|
+
this.healthService = healthService;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Health check api method.
|
|
23
|
+
*
|
|
24
|
+
* @returns true if the service is running
|
|
25
|
+
*/
|
|
26
|
+
check() {
|
|
27
|
+
return this.healthService.checkCoordinatorHealth();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
__decorate([
|
|
31
|
+
ApiResponse({ status: HttpStatus.OK, description: "The service is running" }),
|
|
32
|
+
Get("check"),
|
|
33
|
+
__metadata("design:type", Function),
|
|
34
|
+
__metadata("design:paramtypes", []),
|
|
35
|
+
__metadata("design:returntype", Promise)
|
|
36
|
+
], HealthController.prototype, "check", null);
|
|
37
|
+
HealthController = __decorate([
|
|
38
|
+
ApiTags("v1/health"),
|
|
39
|
+
Controller("v1/health"),
|
|
40
|
+
__metadata("design:paramtypes", [HealthService])
|
|
41
|
+
], HealthController);
|
|
42
|
+
export { HealthController };
|
|
43
|
+
//# sourceMappingURL=health.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../../ts/health/health.controller.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAK1C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAIE;IAH7B;;OAEG;IACH,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAE7D;;;;OAIG;IAGH,KAAK;QACH,OAAO,IAAI,CAAC,aAAa,CAAC,sBAAsB,EAAE,CAAC;IACrD,CAAC;CACF,CAAA;AAHC;IAFC,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IAC7E,GAAG,CAAC,OAAO,CAAC;;;;6CAGZ;AAfU,gBAAgB;IAF5B,OAAO,CAAC,WAAW,CAAC;IACpB,UAAU,CAAC,WAAW,CAAC;qCAKsB,aAAa;GAJ9C,gBAAgB,CAgB5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.module.d.ts","sourceRoot":"","sources":["../../../ts/health/health.module.ts"],"names":[],"mappings":"AAQA,qBAKa,YAAY;CAAG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Module } from "@nestjs/common";
|
|
8
|
+
import { FileModule } from "../file/file.module";
|
|
9
|
+
import { RedisModule } from "../redis/redis.module";
|
|
10
|
+
import { HealthController } from "./health.controller";
|
|
11
|
+
import { HealthService } from "./health.service";
|
|
12
|
+
let HealthModule = class HealthModule {
|
|
13
|
+
};
|
|
14
|
+
HealthModule = __decorate([
|
|
15
|
+
Module({
|
|
16
|
+
imports: [FileModule, RedisModule],
|
|
17
|
+
controllers: [HealthController],
|
|
18
|
+
providers: [HealthService],
|
|
19
|
+
})
|
|
20
|
+
], HealthModule);
|
|
21
|
+
export { HealthModule };
|
|
22
|
+
//# sourceMappingURL=health.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.module.js","sourceRoot":"","sources":["../../../ts/health/health.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAO1C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,YAAY;IALxB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;QAClC,WAAW,EAAE,CAAC,gBAAgB,CAAC;QAC/B,SAAS,EAAE,CAAC,aAAa,CAAC;KAC3B,CAAC;GACW,YAAY,CAAG"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ICheckRapidsnark, ICheckWalletFunds, ICheckZkeysDirectory, IHealthCheckResponse } from "./types";
|
|
2
|
+
import { FileService } from "../file/file.service";
|
|
3
|
+
import { RedisService } from "../redis/redis.service";
|
|
4
|
+
/**
|
|
5
|
+
* Health service functions to check the status of the coordinator service.
|
|
6
|
+
*/
|
|
7
|
+
export declare class HealthService {
|
|
8
|
+
private readonly fileService;
|
|
9
|
+
private readonly redisService;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new instance of the HealthService.
|
|
12
|
+
*
|
|
13
|
+
* @param fileService - file service
|
|
14
|
+
*/
|
|
15
|
+
constructor(fileService: FileService, redisService: RedisService);
|
|
16
|
+
/**
|
|
17
|
+
* Check if rapidsnark is available and executable.
|
|
18
|
+
* @returns the rapidsnark executable path and its executability status
|
|
19
|
+
*/
|
|
20
|
+
checkRapidsnark(): Promise<ICheckRapidsnark>;
|
|
21
|
+
/**
|
|
22
|
+
* Check if zkeys directory exists
|
|
23
|
+
* @returns the existence of the zkeys directory and the required zkeys
|
|
24
|
+
*/
|
|
25
|
+
checkZkeysDirectory(): Promise<ICheckZkeysDirectory>;
|
|
26
|
+
/**
|
|
27
|
+
* Check if coordinator wallet has funds
|
|
28
|
+
* @returns the address and its funds in all networks
|
|
29
|
+
*/
|
|
30
|
+
checkWalletFunds(): Promise<ICheckWalletFunds>;
|
|
31
|
+
/**
|
|
32
|
+
* Check redis client is connected and open
|
|
33
|
+
* @return true if the redis client is connected and open, false otherwise
|
|
34
|
+
*/
|
|
35
|
+
checkRedisConnection(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Check coordinator service health
|
|
38
|
+
* @returns an object containing the results of all the health checks
|
|
39
|
+
*/
|
|
40
|
+
checkCoordinatorHealth(): Promise<IHealthCheckResponse>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=health.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.service.d.ts","sourceRoot":"","sources":["../../../ts/health/health.service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG/G,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;GAEG;AACH,qBACa,aAAa;IAOtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAP/B;;;;OAIG;gBAEgB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY;IAG7C;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAuBlD;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IA0D1D;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAuCpD;;;OAGG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;;OAGG;IACG,sBAAsB,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAe9D"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EMode } from "@maci-protocol/sdk";
|
|
11
|
+
import { Injectable } from "@nestjs/common";
|
|
12
|
+
import { formatEther } from "ethers";
|
|
13
|
+
import { zeroAddress } from "viem";
|
|
14
|
+
import fs from "fs";
|
|
15
|
+
import path from "path";
|
|
16
|
+
import { ESupportedNetworks, getSigner } from "../common";
|
|
17
|
+
import { FileService } from "../file/file.service";
|
|
18
|
+
import { RedisService } from "../redis/redis.service";
|
|
19
|
+
/**
|
|
20
|
+
* Health service functions to check the status of the coordinator service.
|
|
21
|
+
*/
|
|
22
|
+
let HealthService = class HealthService {
|
|
23
|
+
fileService;
|
|
24
|
+
redisService;
|
|
25
|
+
/**
|
|
26
|
+
* Create a new instance of the HealthService.
|
|
27
|
+
*
|
|
28
|
+
* @param fileService - file service
|
|
29
|
+
*/
|
|
30
|
+
constructor(fileService, redisService) {
|
|
31
|
+
this.fileService = fileService;
|
|
32
|
+
this.redisService = redisService;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if rapidsnark is available and executable.
|
|
36
|
+
* @returns the rapidsnark executable path and its executability status
|
|
37
|
+
*/
|
|
38
|
+
async checkRapidsnark() {
|
|
39
|
+
const rapidsnarkExecutablePath = process.env.COORDINATOR_RAPIDSNARK_EXE || "";
|
|
40
|
+
const [rapidsnarkIsAccessible, rapidsnarkIsExecutable] = await Promise.all([
|
|
41
|
+
fs.promises
|
|
42
|
+
// eslint-disable-next-line no-bitwise
|
|
43
|
+
.access(rapidsnarkExecutablePath, fs.constants.F_OK | fs.constants.X_OK)
|
|
44
|
+
.then(() => true)
|
|
45
|
+
.catch(() => false),
|
|
46
|
+
fs.promises
|
|
47
|
+
// eslint-disable-next-line no-bitwise
|
|
48
|
+
.stat(rapidsnarkExecutablePath)
|
|
49
|
+
.then((stats) => stats.isFile())
|
|
50
|
+
.catch(() => false),
|
|
51
|
+
]);
|
|
52
|
+
return {
|
|
53
|
+
rapidsnarkExecutablePath,
|
|
54
|
+
rapidsnarkIsAccessible,
|
|
55
|
+
rapidsnarkIsExecutable,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if zkeys directory exists
|
|
60
|
+
* @returns the existence of the zkeys directory and the required zkeys
|
|
61
|
+
*/
|
|
62
|
+
async checkZkeysDirectory() {
|
|
63
|
+
const zkeysDirectoryPath = path.resolve(process.env.COORDINATOR_ZKEY_PATH);
|
|
64
|
+
const requiredZkeyNames = [
|
|
65
|
+
{
|
|
66
|
+
name: process.env.COORDINATOR_TALLY_ZKEY_NAME,
|
|
67
|
+
modes: [EMode.QV, EMode.NON_QV],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME,
|
|
71
|
+
modes: [EMode.QV, EMode.NON_QV, EMode.FULL],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: process.env.COORDINATOR_POLL_JOINING_ZKEY_NAME,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: process.env.COORDINATOR_POLL_JOINED_ZKEY_NAME,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
const zkeysDirectoryExists = await fs.promises
|
|
81
|
+
.stat(zkeysDirectoryPath)
|
|
82
|
+
.then((stats) => stats.isDirectory())
|
|
83
|
+
.catch(() => false);
|
|
84
|
+
const availableZkeys = requiredZkeyNames.reduce((acc, { name, modes }) => {
|
|
85
|
+
if (!modes) {
|
|
86
|
+
try {
|
|
87
|
+
acc[name] = this.fileService.getZkeyFilePaths(name);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
acc[name] = undefined;
|
|
91
|
+
}
|
|
92
|
+
return acc;
|
|
93
|
+
}
|
|
94
|
+
const modeEntries = modes.reduce((modeAcc, mode) => {
|
|
95
|
+
const pathname = `${name}_Mode_${String(mode)}`;
|
|
96
|
+
try {
|
|
97
|
+
// eslint-disable-next-line no-param-reassign
|
|
98
|
+
modeAcc[pathname] = this.fileService.getZkeyFilePaths(name, mode);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
// eslint-disable-next-line no-param-reassign
|
|
102
|
+
modeAcc[pathname] = undefined;
|
|
103
|
+
}
|
|
104
|
+
return modeAcc;
|
|
105
|
+
}, {});
|
|
106
|
+
return { ...acc, ...modeEntries };
|
|
107
|
+
}, {});
|
|
108
|
+
return {
|
|
109
|
+
zkeysDirectoryExists,
|
|
110
|
+
availableZkeys,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Check if coordinator wallet has funds
|
|
115
|
+
* @returns the address and its funds in all networks
|
|
116
|
+
*/
|
|
117
|
+
async checkWalletFunds() {
|
|
118
|
+
let address;
|
|
119
|
+
const networks = Object.values(ESupportedNetworks);
|
|
120
|
+
try {
|
|
121
|
+
const signer = getSigner(networks[0]);
|
|
122
|
+
address = await signer.getAddress();
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
return {
|
|
126
|
+
address: zeroAddress,
|
|
127
|
+
fundsInNetworks: [],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const fundsInNetworks = await Promise.all(networks.map(async (network) => {
|
|
131
|
+
const signer = getSigner(network);
|
|
132
|
+
return signer.provider
|
|
133
|
+
?.getBalance(address)
|
|
134
|
+
.then((balance) => ({
|
|
135
|
+
network,
|
|
136
|
+
balance: formatEther(balance),
|
|
137
|
+
status: true,
|
|
138
|
+
}))
|
|
139
|
+
.catch(() => ({
|
|
140
|
+
network,
|
|
141
|
+
balance: formatEther(0n),
|
|
142
|
+
status: false,
|
|
143
|
+
}));
|
|
144
|
+
}));
|
|
145
|
+
return {
|
|
146
|
+
address,
|
|
147
|
+
fundsInNetworks,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Check redis client is connected and open
|
|
152
|
+
* @return true if the redis client is connected and open, false otherwise
|
|
153
|
+
*/
|
|
154
|
+
checkRedisConnection() {
|
|
155
|
+
return this.redisService.isOpen();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Check coordinator service health
|
|
159
|
+
* @returns an object containing the results of all the health checks
|
|
160
|
+
*/
|
|
161
|
+
async checkCoordinatorHealth() {
|
|
162
|
+
const [rapidsnark, zkeysDirectory, coordinatorWalletFunds] = await Promise.all([
|
|
163
|
+
this.checkRapidsnark(),
|
|
164
|
+
this.checkZkeysDirectory(),
|
|
165
|
+
this.checkWalletFunds(),
|
|
166
|
+
]);
|
|
167
|
+
const isRedisOpen = this.checkRedisConnection();
|
|
168
|
+
return {
|
|
169
|
+
rapidsnark,
|
|
170
|
+
zkeysDirectory,
|
|
171
|
+
coordinatorWalletFunds,
|
|
172
|
+
isRedisOpen,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
HealthService = __decorate([
|
|
177
|
+
Injectable(),
|
|
178
|
+
__metadata("design:paramtypes", [FileService,
|
|
179
|
+
RedisService])
|
|
180
|
+
], HealthService);
|
|
181
|
+
export { HealthService };
|
|
182
|
+
//# sourceMappingURL=health.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.service.js","sourceRoot":"","sources":["../../../ts/health/health.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAa;IAOL;IACA;IAPnB;;;;OAIG;IACH,YACmB,WAAwB,EACxB,YAA0B;QAD1B,gBAAW,GAAX,WAAW,CAAa;QACxB,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAEJ;;;OAGG;IACH,KAAK,CAAC,eAAe;QACnB,MAAM,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,EAAE,CAAC;QAE9E,MAAM,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACzE,EAAE,CAAC,QAAQ;gBACT,sCAAsC;iBACrC,MAAM,CAAC,wBAAwB,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,GAAG,EAAE,CAAC,SAAS,CAAC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,OAAO;YACL,UAAU;YACV,cAAc;YACd,sBAAsB;YACtB,WAAW;SACZ,CAAC;IACJ,CAAC;CACF,CAAA;AA1KY,aAAa;IADzB,UAAU,EAAE;qCAQqB,WAAW;QACV,YAAY;GARlC,aAAa,CA0KzB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { IGetZkeyFilePathsData } from "../file/types";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for checking the rapidsnark setup
|
|
4
|
+
*/
|
|
5
|
+
export interface ICheckRapidsnark {
|
|
6
|
+
/**
|
|
7
|
+
* Rapidsnark executable path
|
|
8
|
+
*/
|
|
9
|
+
rapidsnarkExecutablePath: string;
|
|
10
|
+
/**
|
|
11
|
+
* Is rapidsnark accessible
|
|
12
|
+
*/
|
|
13
|
+
rapidsnarkIsAccessible: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Is rapidsnark executable
|
|
16
|
+
*/
|
|
17
|
+
rapidsnarkIsExecutable: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Interface for checking the zkeys directory
|
|
21
|
+
*/
|
|
22
|
+
export interface ICheckZkeysDirectory {
|
|
23
|
+
/**
|
|
24
|
+
* Does zkeys directory exist
|
|
25
|
+
*/
|
|
26
|
+
zkeysDirectoryExists: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Available zkeys
|
|
29
|
+
*/
|
|
30
|
+
availableZkeys: Record<string, IGetZkeyFilePathsData | undefined>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Interface for network info (balance and status)
|
|
34
|
+
*/
|
|
35
|
+
export interface INetworkInfo {
|
|
36
|
+
/**
|
|
37
|
+
* Network name
|
|
38
|
+
*/
|
|
39
|
+
network: string;
|
|
40
|
+
/**
|
|
41
|
+
* Balance in the network
|
|
42
|
+
*/
|
|
43
|
+
balance: string;
|
|
44
|
+
/**
|
|
45
|
+
* Is the network accessible
|
|
46
|
+
*/
|
|
47
|
+
status: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Interface for checking the coordinator wallet funds
|
|
51
|
+
*/
|
|
52
|
+
export interface ICheckWalletFunds {
|
|
53
|
+
/**
|
|
54
|
+
* Coordinator address
|
|
55
|
+
*/
|
|
56
|
+
address: string;
|
|
57
|
+
/**
|
|
58
|
+
* Funds in all networks
|
|
59
|
+
*/
|
|
60
|
+
fundsInNetworks: (INetworkInfo | undefined)[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Interface for the health check response
|
|
64
|
+
*/
|
|
65
|
+
export interface IHealthCheckResponse {
|
|
66
|
+
/**
|
|
67
|
+
* Rapidsnark check result
|
|
68
|
+
*/
|
|
69
|
+
rapidsnark: ICheckRapidsnark;
|
|
70
|
+
/**
|
|
71
|
+
* Zkeys directory check result
|
|
72
|
+
*/
|
|
73
|
+
zkeysDirectory: ICheckZkeysDirectory;
|
|
74
|
+
/**
|
|
75
|
+
* Coordinator wallet funds check result
|
|
76
|
+
*/
|
|
77
|
+
coordinatorWalletFunds: ICheckWalletFunds;
|
|
78
|
+
/**
|
|
79
|
+
* Redis connection is open
|
|
80
|
+
*/
|
|
81
|
+
isRedisOpen: boolean;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/health/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,wBAAwB,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAAC,CAAC;CACnE;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,eAAe,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAE7B;;OAEG;IACH,cAAc,EAAE,oBAAoB,CAAC;IAErC;;OAEG;IACH,sBAAsB,EAAE,iBAAiB,CAAC;IAE1C;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../ts/health/types.ts"],"names":[],"mappings":""}
|