@maci-protocol/coordinator 0.0.0-ci.00107eb
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/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +103 -0
- package/build/hardhat.config.cjs +39 -0
- package/build/hardhat.config.cjs.map +1 -0
- package/build/hardhat.config.d.cts +27 -0
- package/build/hardhat.config.d.cts.map +1 -0
- package/build/scripts/generateKeypair.d.ts +2 -0
- package/build/scripts/generateKeypair.d.ts.map +1 -0
- package/build/scripts/generateKeypair.js +25 -0
- package/build/scripts/generateKeypair.js.map +1 -0
- package/build/scripts/generateMaciKeyPair.d.ts +2 -0
- package/build/scripts/generateMaciKeyPair.d.ts.map +1 -0
- package/build/scripts/generateMaciKeyPair.js +3 -0
- package/build/scripts/generateMaciKeyPair.js.map +1 -0
- package/build/scripts/getAuthHeader.d.ts +2 -0
- package/build/scripts/getAuthHeader.d.ts.map +1 -0
- package/build/scripts/getAuthHeader.js +31 -0
- package/build/scripts/getAuthHeader.js.map +1 -0
- package/build/tests/constants.d.ts +7 -0
- package/build/tests/constants.d.ts.map +1 -0
- package/build/tests/constants.js +11 -0
- package/build/tests/constants.js.map +1 -0
- package/build/tests/e2e.deploy.test.d.ts +2 -0
- package/build/tests/e2e.deploy.test.d.ts.map +1 -0
- package/build/tests/e2e.deploy.test.js +264 -0
- package/build/tests/e2e.deploy.test.js.map +1 -0
- 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 +118 -0
- package/build/tests/e2e.redis.test.js.map +1 -0
- package/build/tests/utils.d.ts +20 -0
- package/build/tests/utils.d.ts.map +1 -0
- package/build/tests/utils.js +55 -0
- package/build/tests/utils.js.map +1 -0
- package/build/ts/app.module.d.ts +3 -0
- package/build/ts/app.module.d.ts.map +1 -0
- package/build/ts/app.module.js +42 -0
- package/build/ts/app.module.js.map +1 -0
- package/build/ts/auth/AccountSignatureGuard.service.d.ts +44 -0
- package/build/ts/auth/AccountSignatureGuard.service.d.ts.map +1 -0
- package/build/ts/auth/AccountSignatureGuard.service.js +96 -0
- package/build/ts/auth/AccountSignatureGuard.service.js.map +1 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts +2 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts.map +1 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.js +113 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.js.map +1 -0
- package/build/ts/common/__tests__/common.test.d.ts +2 -0
- package/build/ts/common/__tests__/common.test.d.ts.map +1 -0
- package/build/ts/common/__tests__/common.test.js +77 -0
- package/build/ts/common/__tests__/common.test.js.map +1 -0
- package/build/ts/common/accountAbstraction.d.ts +38 -0
- package/build/ts/common/accountAbstraction.d.ts.map +1 -0
- package/build/ts/common/accountAbstraction.js +83 -0
- package/build/ts/common/accountAbstraction.js.map +1 -0
- package/build/ts/common/chain.d.ts +22 -0
- package/build/ts/common/chain.d.ts.map +1 -0
- package/build/ts/common/chain.js +37 -0
- package/build/ts/common/chain.js.map +1 -0
- package/build/ts/common/coordinatorKeypair.d.ts +7 -0
- package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
- package/build/ts/common/coordinatorKeypair.js +14 -0
- package/build/ts/common/coordinatorKeypair.js.map +1 -0
- package/build/ts/common/errors.d.ts +36 -0
- package/build/ts/common/errors.d.ts.map +1 -0
- package/build/ts/common/errors.js +37 -0
- package/build/ts/common/errors.js.map +1 -0
- package/build/ts/common/http.d.ts +6 -0
- package/build/ts/common/http.d.ts.map +1 -0
- package/build/ts/common/http.js +49 -0
- package/build/ts/common/http.js.map +1 -0
- package/build/ts/common/index.d.ts +6 -0
- package/build/ts/common/index.d.ts.map +1 -0
- package/build/ts/common/index.js +6 -0
- package/build/ts/common/index.js.map +1 -0
- package/build/ts/common/networks.d.ts +10 -0
- package/build/ts/common/networks.d.ts.map +1 -0
- package/build/ts/common/networks.js +61 -0
- package/build/ts/common/networks.js.map +1 -0
- package/build/ts/common/types.d.ts +8 -0
- package/build/ts/common/types.d.ts.map +1 -0
- package/build/ts/common/types.js +2 -0
- package/build/ts/common/types.js.map +1 -0
- package/build/ts/crypto/__tests__/crypto.service.test.d.ts +2 -0
- package/build/ts/crypto/__tests__/crypto.service.test.d.ts.map +1 -0
- package/build/ts/crypto/__tests__/crypto.service.test.js +26 -0
- package/build/ts/crypto/__tests__/crypto.service.test.js.map +1 -0
- package/build/ts/crypto/crypto.module.d.ts +3 -0
- package/build/ts/crypto/crypto.module.d.ts.map +1 -0
- package/build/ts/crypto/crypto.module.js +18 -0
- package/build/ts/crypto/crypto.module.js.map +1 -0
- package/build/ts/crypto/crypto.service.d.ts +31 -0
- package/build/ts/crypto/crypto.service.d.ts.map +1 -0
- package/build/ts/crypto/crypto.service.js +68 -0
- package/build/ts/crypto/crypto.service.js.map +1 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.d.ts +2 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.js +82 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -0
- package/build/ts/deployer/__tests__/deployer.service.test.d.ts +2 -0
- package/build/ts/deployer/__tests__/deployer.service.test.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/deployer.service.test.js +272 -0
- package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -0
- package/build/ts/deployer/__tests__/utils.d.ts +61 -0
- package/build/ts/deployer/__tests__/utils.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/utils.js +122 -0
- package/build/ts/deployer/__tests__/utils.js.map +1 -0
- package/build/ts/deployer/constants.d.ts +13 -0
- package/build/ts/deployer/constants.d.ts.map +1 -0
- package/build/ts/deployer/constants.js +13 -0
- package/build/ts/deployer/constants.js.map +1 -0
- package/build/ts/deployer/deployer.controller.d.ts +34 -0
- package/build/ts/deployer/deployer.controller.d.ts.map +1 -0
- package/build/ts/deployer/deployer.controller.js +102 -0
- package/build/ts/deployer/deployer.controller.js.map +1 -0
- package/build/ts/deployer/deployer.module.d.ts +3 -0
- package/build/ts/deployer/deployer.module.d.ts.map +1 -0
- package/build/ts/deployer/deployer.module.js +23 -0
- package/build/ts/deployer/deployer.module.js.map +1 -0
- package/build/ts/deployer/deployer.service.d.ts +85 -0
- package/build/ts/deployer/deployer.service.d.ts.map +1 -0
- package/build/ts/deployer/deployer.service.js +505 -0
- package/build/ts/deployer/deployer.service.js.map +1 -0
- package/build/ts/deployer/dto.d.ts +46 -0
- package/build/ts/deployer/dto.d.ts.map +1 -0
- package/build/ts/deployer/dto.js +125 -0
- package/build/ts/deployer/dto.js.map +1 -0
- package/build/ts/deployer/types.d.ts +351 -0
- package/build/ts/deployer/types.d.ts.map +1 -0
- package/build/ts/deployer/types.js +2 -0
- package/build/ts/deployer/types.js.map +1 -0
- package/build/ts/file/__tests__/file.service.test.d.ts +2 -0
- package/build/ts/file/__tests__/file.service.test.d.ts.map +1 -0
- package/build/ts/file/__tests__/file.service.test.js +77 -0
- package/build/ts/file/__tests__/file.service.test.js.map +1 -0
- package/build/ts/file/file.module.d.ts +3 -0
- package/build/ts/file/file.module.d.ts.map +1 -0
- package/build/ts/file/file.module.js +18 -0
- package/build/ts/file/file.module.js.map +1 -0
- package/build/ts/file/file.service.d.ts +63 -0
- package/build/ts/file/file.service.d.ts.map +1 -0
- package/build/ts/file/file.service.js +121 -0
- package/build/ts/file/file.service.js.map +1 -0
- package/build/ts/file/types.d.ts +36 -0
- package/build/ts/file/types.d.ts.map +1 -0
- package/build/ts/file/types.js +2 -0
- package/build/ts/file/types.js.map +1 -0
- 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 +52 -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 +101 -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 +176 -0
- package/build/ts/health/health.service.js.map +1 -0
- package/build/ts/health/types.d.ts +87 -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/jest/__mocks__/@openzeppelin/merkle-tree.d.ts +11 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts.map +1 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js +12 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js.map +1 -0
- package/build/ts/jest/setup.d.ts +8 -0
- package/build/ts/jest/setup.d.ts.map +1 -0
- package/build/ts/jest/setup.js +2 -0
- package/build/ts/jest/setup.js.map +1 -0
- package/build/ts/jest/transform.d.ts +8 -0
- package/build/ts/jest/transform.d.ts.map +1 -0
- package/build/ts/jest/transform.js +10 -0
- package/build/ts/jest/transform.js.map +1 -0
- package/build/ts/main.d.ts +2 -0
- package/build/ts/main.d.ts.map +1 -0
- package/build/ts/main.js +46 -0
- package/build/ts/main.js.map +1 -0
- package/build/ts/proof/__tests__/proof.controller.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.controller.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.controller.test.js +90 -0
- package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -0
- package/build/ts/proof/__tests__/proof.gateway.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.gateway.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.gateway.test.js +63 -0
- package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -0
- package/build/ts/proof/__tests__/proof.service.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.service.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.service.test.js +84 -0
- package/build/ts/proof/__tests__/proof.service.test.js.map +1 -0
- package/build/ts/proof/dto.d.ts +70 -0
- package/build/ts/proof/dto.d.ts.map +1 -0
- package/build/ts/proof/dto.js +261 -0
- package/build/ts/proof/dto.js.map +1 -0
- package/build/ts/proof/proof.controller.d.ts +47 -0
- package/build/ts/proof/proof.controller.d.ts.map +1 -0
- package/build/ts/proof/proof.controller.js +158 -0
- package/build/ts/proof/proof.controller.js.map +1 -0
- package/build/ts/proof/proof.gateway.d.ts +35 -0
- package/build/ts/proof/proof.gateway.d.ts.map +1 -0
- package/build/ts/proof/proof.gateway.js +93 -0
- package/build/ts/proof/proof.gateway.js.map +1 -0
- package/build/ts/proof/proof.module.d.ts +3 -0
- package/build/ts/proof/proof.module.d.ts.map +1 -0
- package/build/ts/proof/proof.module.js +25 -0
- package/build/ts/proof/proof.module.js.map +1 -0
- package/build/ts/proof/proof.service.d.ts +52 -0
- package/build/ts/proof/proof.service.d.ts.map +1 -0
- package/build/ts/proof/proof.service.js +164 -0
- package/build/ts/proof/proof.service.js.map +1 -0
- package/build/ts/proof/types.d.ts +144 -0
- package/build/ts/proof/types.d.ts.map +1 -0
- package/build/ts/proof/types.js +11 -0
- package/build/ts/proof/types.js.map +1 -0
- 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 +148 -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 +53 -0
- package/build/ts/redis/redis.service.d.ts.map +1 -0
- package/build/ts/redis/redis.service.js +99 -0
- package/build/ts/redis/redis.service.js.map +1 -0
- package/build/ts/redis/types.d.ts +66 -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/scheduler/__tests__/scheduler.controller.test.d.ts +2 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.js +62 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.js.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts +2 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.js +369 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.js.map +1 -0
- package/build/ts/scheduler/dto.d.ts +41 -0
- package/build/ts/scheduler/dto.d.ts.map +1 -0
- package/build/ts/scheduler/dto.js +115 -0
- package/build/ts/scheduler/dto.js.map +1 -0
- package/build/ts/scheduler/scheduler.controller.d.ts +32 -0
- package/build/ts/scheduler/scheduler.controller.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.controller.js +118 -0
- package/build/ts/scheduler/scheduler.controller.js.map +1 -0
- package/build/ts/scheduler/scheduler.module.d.ts +3 -0
- package/build/ts/scheduler/scheduler.module.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.module.js +24 -0
- package/build/ts/scheduler/scheduler.module.js.map +1 -0
- package/build/ts/scheduler/scheduler.service.d.ts +71 -0
- package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.service.js +297 -0
- package/build/ts/scheduler/scheduler.service.js.map +1 -0
- package/build/ts/scheduler/types.d.ts +65 -0
- package/build/ts/scheduler/types.d.ts.map +1 -0
- package/build/ts/scheduler/types.js +2 -0
- package/build/ts/scheduler/types.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts +2 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +44 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts +2 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +76 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/utils.d.ts +25 -0
- package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/utils.js +65 -0
- package/build/ts/sessionKeys/__tests__/utils.js.map +1 -0
- package/build/ts/sessionKeys/dto.d.ts +11 -0
- package/build/ts/sessionKeys/dto.d.ts.map +1 -0
- package/build/ts/sessionKeys/dto.js +29 -0
- package/build/ts/sessionKeys/dto.js.map +1 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.controller.d.ts +26 -0
- package/build/ts/sessionKeys/sessionKeys.controller.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.controller.js +74 -0
- package/build/ts/sessionKeys/sessionKeys.controller.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.module.d.ts +3 -0
- package/build/ts/sessionKeys/sessionKeys.module.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.module.js +23 -0
- package/build/ts/sessionKeys/sessionKeys.module.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.service.d.ts +62 -0
- package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.service.js +121 -0
- package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -0
- package/build/ts/sessionKeys/types.d.ts +11 -0
- package/build/ts/sessionKeys/types.d.ts.map +1 -0
- package/build/ts/sessionKeys/types.js +2 -0
- package/build/ts/sessionKeys/types.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.js +50 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +83 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.js +58 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -0
- package/build/ts/subgraph/dto.d.ts +27 -0
- package/build/ts/subgraph/dto.d.ts.map +1 -0
- package/build/ts/subgraph/dto.js +83 -0
- package/build/ts/subgraph/dto.js.map +1 -0
- package/build/ts/subgraph/subgraph.controller.d.ts +24 -0
- package/build/ts/subgraph/subgraph.controller.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.controller.js +71 -0
- package/build/ts/subgraph/subgraph.controller.js.map +1 -0
- package/build/ts/subgraph/subgraph.gateway.d.ts +35 -0
- package/build/ts/subgraph/subgraph.gateway.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.gateway.js +93 -0
- package/build/ts/subgraph/subgraph.gateway.js.map +1 -0
- package/build/ts/subgraph/subgraph.module.d.ts +3 -0
- package/build/ts/subgraph/subgraph.module.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.module.js +23 -0
- package/build/ts/subgraph/subgraph.module.js.map +1 -0
- package/build/ts/subgraph/subgraph.service.d.ts +24 -0
- package/build/ts/subgraph/subgraph.service.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.service.js +119 -0
- package/build/ts/subgraph/subgraph.service.js.map +1 -0
- package/build/ts/subgraph/types.d.ts +93 -0
- package/build/ts/subgraph/types.d.ts.map +1 -0
- package/build/ts/subgraph/types.js +24 -0
- package/build/ts/subgraph/types.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +131 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Keypair, PrivateKey } from "@maci-protocol/domainobjs";
|
|
2
|
+
import { Deployment, EMode, ESupportedChains } from "@maci-protocol/sdk";
|
|
3
|
+
import dotenv from "dotenv";
|
|
4
|
+
import { zeroAddress } from "viem";
|
|
5
|
+
import { ErrorCodes } from "../../common";
|
|
6
|
+
import { getCoordinatorKeypair } from "../../common/coordinatorKeypair";
|
|
7
|
+
import { FileService } from "../../file/file.service";
|
|
8
|
+
import { SessionKeysService } from "../../sessionKeys/sessionKeys.service";
|
|
9
|
+
import { ProofGeneratorService } from "../proof.service";
|
|
10
|
+
dotenv.config();
|
|
11
|
+
jest.mock("@maci-protocol/sdk", () => ({
|
|
12
|
+
...jest.requireActual("@maci-protocol/sdk"),
|
|
13
|
+
Deployment: {
|
|
14
|
+
getInstance: jest.fn(),
|
|
15
|
+
},
|
|
16
|
+
getPoll: jest.fn().mockResolvedValue({
|
|
17
|
+
address: "0x123",
|
|
18
|
+
}),
|
|
19
|
+
generateProofs: jest.fn().mockResolvedValue({
|
|
20
|
+
processProofs: [1],
|
|
21
|
+
tallyProofs: [1],
|
|
22
|
+
tallyData: {},
|
|
23
|
+
}),
|
|
24
|
+
}));
|
|
25
|
+
describe("ProofGeneratorService", () => {
|
|
26
|
+
let defaultProofArgs;
|
|
27
|
+
let mockContract = {
|
|
28
|
+
polls: jest.fn(),
|
|
29
|
+
getMainRoot: jest.fn(),
|
|
30
|
+
treeDepths: jest.fn(),
|
|
31
|
+
extContracts: jest.fn(),
|
|
32
|
+
stateMerged: jest.fn(),
|
|
33
|
+
coordinatorPublicKey: jest.fn(),
|
|
34
|
+
};
|
|
35
|
+
const defaultDeploymentService = {
|
|
36
|
+
setHre: jest.fn(),
|
|
37
|
+
getDeployer: jest.fn(() => Promise.resolve({})),
|
|
38
|
+
getContract: jest.fn(() => Promise.resolve(mockContract)),
|
|
39
|
+
};
|
|
40
|
+
const coordinatorPublicKey = getCoordinatorKeypair().publicKey.asContractParam();
|
|
41
|
+
const fileService = new FileService();
|
|
42
|
+
const sessionKeysService = new SessionKeysService(fileService);
|
|
43
|
+
beforeAll(() => {
|
|
44
|
+
defaultProofArgs = {
|
|
45
|
+
poll: 1,
|
|
46
|
+
maciContractAddress: zeroAddress,
|
|
47
|
+
mode: EMode.NON_QV,
|
|
48
|
+
chain: ESupportedChains.OptimismSepolia,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
mockContract = {
|
|
53
|
+
polls: jest.fn(() => Promise.resolve({ poll: zeroAddress.replace("0x0", "0x1"), messageProcessor: zeroAddress, tally: zeroAddress })),
|
|
54
|
+
getMainRoot: jest.fn(() => Promise.resolve(1n)),
|
|
55
|
+
treeDepths: jest.fn(() => Promise.resolve([1, 2, 3])),
|
|
56
|
+
extContracts: jest.fn(() => Promise.resolve({ messageAq: zeroAddress })),
|
|
57
|
+
stateMerged: jest.fn(() => Promise.resolve(true)),
|
|
58
|
+
coordinatorPublicKey: jest.fn(() => Promise.resolve(coordinatorPublicKey)),
|
|
59
|
+
};
|
|
60
|
+
Deployment.getInstance.mockReturnValue(defaultDeploymentService);
|
|
61
|
+
});
|
|
62
|
+
afterEach(() => {
|
|
63
|
+
jest.clearAllMocks();
|
|
64
|
+
});
|
|
65
|
+
test("should throw error if private key is wrong", async () => {
|
|
66
|
+
const keypair = new Keypair(new PrivateKey(0n));
|
|
67
|
+
mockContract.coordinatorPublicKey.mockResolvedValue(keypair.publicKey.asContractParam());
|
|
68
|
+
const service = new ProofGeneratorService(fileService, sessionKeysService);
|
|
69
|
+
await expect(service.generate(defaultProofArgs)).rejects.toThrow(ErrorCodes.PRIVATE_KEY_MISMATCH.toString());
|
|
70
|
+
});
|
|
71
|
+
test("should generate proofs properly for NonQv", async () => {
|
|
72
|
+
const service = new ProofGeneratorService(fileService, sessionKeysService);
|
|
73
|
+
const data = await service.generate(defaultProofArgs);
|
|
74
|
+
expect(data.processProofs).toHaveLength(1);
|
|
75
|
+
expect(data.tallyProofs).toHaveLength(1);
|
|
76
|
+
});
|
|
77
|
+
test("should generate proofs properly for Qv", async () => {
|
|
78
|
+
const service = new ProofGeneratorService(fileService, sessionKeysService);
|
|
79
|
+
const data = await service.generate({ ...defaultProofArgs, mode: EMode.QV });
|
|
80
|
+
expect(data.processProofs).toHaveLength(1);
|
|
81
|
+
expect(data.tallyProofs).toHaveLength(1);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=proof.service.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.service.test.js","sourceRoot":"","sources":["../../../../ts/proof/__tests__/proof.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,UAA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AEtD,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,OAAO,GAAG,IAAI,qBAAqB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAE3E,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,EAAE,GAAG,gBAAgB,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7E,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ESupportedChains, EMode } from "@maci-protocol/sdk";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
/**
|
|
4
|
+
* Data transfer object for generate proof
|
|
5
|
+
*/
|
|
6
|
+
export declare class GenerateProofDto {
|
|
7
|
+
/**
|
|
8
|
+
* Poll id
|
|
9
|
+
*/
|
|
10
|
+
poll: number;
|
|
11
|
+
/**
|
|
12
|
+
* Maci contract address
|
|
13
|
+
*/
|
|
14
|
+
maciContractAddress: string;
|
|
15
|
+
/**
|
|
16
|
+
* Voting mode
|
|
17
|
+
*/
|
|
18
|
+
mode: EMode;
|
|
19
|
+
/**
|
|
20
|
+
* Start block for event processing
|
|
21
|
+
*/
|
|
22
|
+
startBlock?: number;
|
|
23
|
+
/**
|
|
24
|
+
* End block for event processing
|
|
25
|
+
*/
|
|
26
|
+
endBlock?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Blocks per batch for event processing
|
|
29
|
+
*/
|
|
30
|
+
blocksPerBatch?: number;
|
|
31
|
+
sessionKeyAddress?: Hex;
|
|
32
|
+
approval?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Chain Name
|
|
35
|
+
*/
|
|
36
|
+
chain: ESupportedChains;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Data transfer object for merge trees
|
|
40
|
+
*/
|
|
41
|
+
export declare class MergeTreesDto {
|
|
42
|
+
/**
|
|
43
|
+
* Poll id
|
|
44
|
+
*/
|
|
45
|
+
poll: number;
|
|
46
|
+
maciContractAddress: string;
|
|
47
|
+
sessionKeyAddress?: string;
|
|
48
|
+
approval?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Chain Name
|
|
51
|
+
*/
|
|
52
|
+
chain: ESupportedChains;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Data transfer object for submit proofs on-chain
|
|
56
|
+
*/
|
|
57
|
+
export declare class SubmitProofsDto {
|
|
58
|
+
/**
|
|
59
|
+
* Poll id
|
|
60
|
+
*/
|
|
61
|
+
pollId: number;
|
|
62
|
+
maciContractAddress: Hex;
|
|
63
|
+
sessionKeyAddress?: Hex;
|
|
64
|
+
approval?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Chain Name
|
|
67
|
+
*/
|
|
68
|
+
chain: ESupportedChains;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../../../ts/proof/dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IAQH,IAAI,EAAG,MAAM,CAAC;IAEd;;OAEG;IAMH,mBAAmB,EAAG,MAAM,CAAC;IAE7B;;OAEG;IAMH,IAAI,EAAG,KAAK,CAAC;IAEb;;OAEG;IASH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IASH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IAWH,cAAc,CAAC,EAAE,MAAM,CAAC;IASxB,iBAAiB,CAAC,EAAE,GAAG,CAAC;IASxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IAMH,KAAK,EAAG,gBAAgB,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IAQH,IAAI,EAAG,MAAM,CAAC;IAOd,mBAAmB,EAAG,MAAM,CAAC;IAS7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAS3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IAMH,KAAK,EAAG,gBAAgB,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IAQH,MAAM,EAAG,MAAM,CAAC;IAOhB,mBAAmB,EAAG,GAAG,CAAC;IAS1B,iBAAiB,CAAC,EAAE,GAAG,CAAC;IASxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IAMH,KAAK,EAAG,gBAAgB,CAAC;CAC1B"}
|
|
@@ -0,0 +1,261 @@
|
|
|
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 { ESupportedChains, EMode } from "@maci-protocol/sdk";
|
|
11
|
+
import { ApiProperty } from "@nestjs/swagger";
|
|
12
|
+
import { IsEnum, IsEthereumAddress, IsInt, IsOptional, IsString, Max, Min } from "class-validator";
|
|
13
|
+
/**
|
|
14
|
+
* Data transfer object for generate proof
|
|
15
|
+
*/
|
|
16
|
+
export class GenerateProofDto {
|
|
17
|
+
/**
|
|
18
|
+
* Poll id
|
|
19
|
+
*/
|
|
20
|
+
poll;
|
|
21
|
+
/**
|
|
22
|
+
* Maci contract address
|
|
23
|
+
*/
|
|
24
|
+
maciContractAddress;
|
|
25
|
+
/**
|
|
26
|
+
* Voting mode
|
|
27
|
+
*/
|
|
28
|
+
mode;
|
|
29
|
+
/**
|
|
30
|
+
* Start block for event processing
|
|
31
|
+
*/
|
|
32
|
+
startBlock;
|
|
33
|
+
/**
|
|
34
|
+
* End block for event processing
|
|
35
|
+
*/
|
|
36
|
+
endBlock;
|
|
37
|
+
/**
|
|
38
|
+
* Blocks per batch for event processing
|
|
39
|
+
*/
|
|
40
|
+
blocksPerBatch;
|
|
41
|
+
sessionKeyAddress;
|
|
42
|
+
approval;
|
|
43
|
+
/**
|
|
44
|
+
* Chain Name
|
|
45
|
+
*/
|
|
46
|
+
chain;
|
|
47
|
+
}
|
|
48
|
+
__decorate([
|
|
49
|
+
ApiProperty({
|
|
50
|
+
description: "Poll id",
|
|
51
|
+
minimum: 0,
|
|
52
|
+
type: Number,
|
|
53
|
+
}),
|
|
54
|
+
IsInt(),
|
|
55
|
+
Min(0),
|
|
56
|
+
__metadata("design:type", Number)
|
|
57
|
+
], GenerateProofDto.prototype, "poll", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
ApiProperty({
|
|
60
|
+
description: "MACI contract address",
|
|
61
|
+
type: String,
|
|
62
|
+
}),
|
|
63
|
+
IsEthereumAddress(),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], GenerateProofDto.prototype, "maciContractAddress", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
ApiProperty({
|
|
68
|
+
description: "Voting mode (qv: 0, non-qv: 1, full: 2)",
|
|
69
|
+
type: Number,
|
|
70
|
+
}),
|
|
71
|
+
IsEnum(EMode),
|
|
72
|
+
__metadata("design:type", Number)
|
|
73
|
+
], GenerateProofDto.prototype, "mode", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
ApiProperty({
|
|
76
|
+
description: "Start block for event parsing",
|
|
77
|
+
minimum: 0,
|
|
78
|
+
type: Number,
|
|
79
|
+
}),
|
|
80
|
+
IsInt(),
|
|
81
|
+
Min(0),
|
|
82
|
+
IsOptional(),
|
|
83
|
+
__metadata("design:type", Number)
|
|
84
|
+
], GenerateProofDto.prototype, "startBlock", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
ApiProperty({
|
|
87
|
+
description: "End block for event parsing",
|
|
88
|
+
minimum: 0,
|
|
89
|
+
type: Number,
|
|
90
|
+
}),
|
|
91
|
+
IsInt(),
|
|
92
|
+
Min(0),
|
|
93
|
+
IsOptional(),
|
|
94
|
+
__metadata("design:type", Number)
|
|
95
|
+
], GenerateProofDto.prototype, "endBlock", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
ApiProperty({
|
|
98
|
+
description: "Blocks per batch for event parsing",
|
|
99
|
+
minimum: 1,
|
|
100
|
+
maximum: 1000,
|
|
101
|
+
type: Number,
|
|
102
|
+
}),
|
|
103
|
+
IsInt(),
|
|
104
|
+
Min(1),
|
|
105
|
+
Max(1000),
|
|
106
|
+
IsOptional(),
|
|
107
|
+
__metadata("design:type", Number)
|
|
108
|
+
], GenerateProofDto.prototype, "blocksPerBatch", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
ApiProperty({
|
|
111
|
+
description: "Session key address",
|
|
112
|
+
type: String,
|
|
113
|
+
required: false,
|
|
114
|
+
}),
|
|
115
|
+
IsOptional(),
|
|
116
|
+
IsEthereumAddress(),
|
|
117
|
+
__metadata("design:type", String)
|
|
118
|
+
], GenerateProofDto.prototype, "sessionKeyAddress", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
ApiProperty({
|
|
121
|
+
description: "Approval",
|
|
122
|
+
type: String,
|
|
123
|
+
required: false,
|
|
124
|
+
}),
|
|
125
|
+
IsOptional(),
|
|
126
|
+
IsString(),
|
|
127
|
+
__metadata("design:type", String)
|
|
128
|
+
], GenerateProofDto.prototype, "approval", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
ApiProperty({
|
|
131
|
+
description: "Chain to which to deploy the contract(s)",
|
|
132
|
+
enum: ESupportedChains,
|
|
133
|
+
}),
|
|
134
|
+
IsEnum(ESupportedChains),
|
|
135
|
+
__metadata("design:type", String)
|
|
136
|
+
], GenerateProofDto.prototype, "chain", void 0);
|
|
137
|
+
/**
|
|
138
|
+
* Data transfer object for merge trees
|
|
139
|
+
*/
|
|
140
|
+
export class MergeTreesDto {
|
|
141
|
+
/**
|
|
142
|
+
* Poll id
|
|
143
|
+
*/
|
|
144
|
+
poll;
|
|
145
|
+
maciContractAddress;
|
|
146
|
+
sessionKeyAddress;
|
|
147
|
+
approval;
|
|
148
|
+
/**
|
|
149
|
+
* Chain Name
|
|
150
|
+
*/
|
|
151
|
+
chain;
|
|
152
|
+
}
|
|
153
|
+
__decorate([
|
|
154
|
+
ApiProperty({
|
|
155
|
+
description: "Poll id",
|
|
156
|
+
minimum: 0,
|
|
157
|
+
type: Number,
|
|
158
|
+
}),
|
|
159
|
+
IsInt(),
|
|
160
|
+
Min(0),
|
|
161
|
+
__metadata("design:type", Number)
|
|
162
|
+
], MergeTreesDto.prototype, "poll", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
ApiProperty({
|
|
165
|
+
description: "MACI contract address",
|
|
166
|
+
type: String,
|
|
167
|
+
}),
|
|
168
|
+
IsEthereumAddress(),
|
|
169
|
+
__metadata("design:type", String)
|
|
170
|
+
], MergeTreesDto.prototype, "maciContractAddress", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
ApiProperty({
|
|
173
|
+
description: "Session key address",
|
|
174
|
+
type: String,
|
|
175
|
+
required: false,
|
|
176
|
+
}),
|
|
177
|
+
IsOptional(),
|
|
178
|
+
IsEthereumAddress(),
|
|
179
|
+
__metadata("design:type", String)
|
|
180
|
+
], MergeTreesDto.prototype, "sessionKeyAddress", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
ApiProperty({
|
|
183
|
+
description: "Approval",
|
|
184
|
+
type: String,
|
|
185
|
+
required: false,
|
|
186
|
+
}),
|
|
187
|
+
IsOptional(),
|
|
188
|
+
IsString(),
|
|
189
|
+
__metadata("design:type", String)
|
|
190
|
+
], MergeTreesDto.prototype, "approval", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
ApiProperty({
|
|
193
|
+
description: "Chain to which to deploy the contract(s)",
|
|
194
|
+
enum: ESupportedChains,
|
|
195
|
+
}),
|
|
196
|
+
IsEnum(ESupportedChains),
|
|
197
|
+
__metadata("design:type", String)
|
|
198
|
+
], MergeTreesDto.prototype, "chain", void 0);
|
|
199
|
+
/**
|
|
200
|
+
* Data transfer object for submit proofs on-chain
|
|
201
|
+
*/
|
|
202
|
+
export class SubmitProofsDto {
|
|
203
|
+
/**
|
|
204
|
+
* Poll id
|
|
205
|
+
*/
|
|
206
|
+
pollId;
|
|
207
|
+
maciContractAddress;
|
|
208
|
+
sessionKeyAddress;
|
|
209
|
+
approval;
|
|
210
|
+
/**
|
|
211
|
+
* Chain Name
|
|
212
|
+
*/
|
|
213
|
+
chain;
|
|
214
|
+
}
|
|
215
|
+
__decorate([
|
|
216
|
+
ApiProperty({
|
|
217
|
+
description: "Poll id",
|
|
218
|
+
minimum: 0,
|
|
219
|
+
type: Number,
|
|
220
|
+
}),
|
|
221
|
+
IsInt(),
|
|
222
|
+
Min(0),
|
|
223
|
+
__metadata("design:type", Number)
|
|
224
|
+
], SubmitProofsDto.prototype, "pollId", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
ApiProperty({
|
|
227
|
+
description: "MACI contract address",
|
|
228
|
+
type: String,
|
|
229
|
+
}),
|
|
230
|
+
IsEthereumAddress(),
|
|
231
|
+
__metadata("design:type", String)
|
|
232
|
+
], SubmitProofsDto.prototype, "maciContractAddress", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
ApiProperty({
|
|
235
|
+
description: "Session key address",
|
|
236
|
+
type: String,
|
|
237
|
+
required: false,
|
|
238
|
+
}),
|
|
239
|
+
IsOptional(),
|
|
240
|
+
IsEthereumAddress(),
|
|
241
|
+
__metadata("design:type", String)
|
|
242
|
+
], SubmitProofsDto.prototype, "sessionKeyAddress", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
ApiProperty({
|
|
245
|
+
description: "Approval",
|
|
246
|
+
type: String,
|
|
247
|
+
required: false,
|
|
248
|
+
}),
|
|
249
|
+
IsOptional(),
|
|
250
|
+
IsString(),
|
|
251
|
+
__metadata("design:type", String)
|
|
252
|
+
], SubmitProofsDto.prototype, "approval", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
ApiProperty({
|
|
255
|
+
description: "Chain to which to deploy the contract(s)",
|
|
256
|
+
enum: ESupportedChains,
|
|
257
|
+
}),
|
|
258
|
+
IsEnum(ESupportedChains),
|
|
259
|
+
__metadata("design:type", String)
|
|
260
|
+
], SubmitProofsDto.prototype, "chain", void 0);
|
|
261
|
+
//# sourceMappingURL=dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto.js","sourceRoot":"","sources":["../../../ts/proof/dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,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QACvB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,UAAU,EAAE;IACZ,QAAQ,EAAE;;+CACO;AAUlB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,0CAA0C;QACvD,IAAI,EAAE,gBAAgB;KACvB,CAAC;IACD,MAAM,CAAC,gBAAgB,CAAC;;4CACA;AAG3B;;GAEG;AACH,MAAM,OAAO,eAAe;IAC1B;;OAEG;IAQH,MAAM,CAAU;IAOhB,mBAAmB,CAAO;IAS1B,iBAAiB,CAAO;IASxB,QAAQ,CAAU;IAElB;;OAEG;IAMH,KAAK,CAAoB;CAC1B;AApCC;IAPC,WAAW,CAAC;QACX,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,MAAM;KACb,CAAC;IACD,KAAK,EAAE;IACP,GAAG,CAAC,CAAC,CAAC;;+CACS;AAOhB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,MAAM;KACb,CAAC;IACD,iBAAiB,EAAE;;4DACM;AAS1B;IAPC,WAAW,CAAC;QACX,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,UAAU,EAAE;IACZ,iBAAiB,EAAE;;0DACI;AASxB;IAPC,WAAW,CAAC;QACX,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,UAAU,EAAE;IACZ,QAAQ,EAAE;;iDACO;AAUlB;IALC,WAAW,CAAC;QACX,WAAW,EAAE,0CAA0C;QACvD,IAAI,EAAE,gBAAgB;KACvB,CAAC;IACD,MAAM,CAAC,gBAAgB,CAAC;;8CACA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IGenerateData, IMergeArgs } from "./types";
|
|
2
|
+
import type { ITallyData } from "@maci-protocol/sdk";
|
|
3
|
+
import { FileService } from "../file/file.service";
|
|
4
|
+
import { IGetPublicKeyData } from "../file/types";
|
|
5
|
+
import { GenerateProofDto, SubmitProofsDto } from "./dto";
|
|
6
|
+
import { ProofGeneratorService } from "./proof.service";
|
|
7
|
+
export declare class ProofController {
|
|
8
|
+
private readonly proofGeneratorService;
|
|
9
|
+
private readonly fileService;
|
|
10
|
+
/**
|
|
11
|
+
* Logger
|
|
12
|
+
*/
|
|
13
|
+
private readonly logger;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize ProofController
|
|
16
|
+
*
|
|
17
|
+
* @param proofGeneratorService - proof generator service
|
|
18
|
+
* @param fileService - file service
|
|
19
|
+
*/
|
|
20
|
+
constructor(proofGeneratorService: ProofGeneratorService, fileService: FileService);
|
|
21
|
+
/**
|
|
22
|
+
* Generate proofs api method
|
|
23
|
+
*
|
|
24
|
+
* @param args - generate proof dto
|
|
25
|
+
* @returns generated proofs and tally data
|
|
26
|
+
*/
|
|
27
|
+
generate(args: GenerateProofDto): Promise<IGenerateData>;
|
|
28
|
+
/**
|
|
29
|
+
* Merge trees api method
|
|
30
|
+
*
|
|
31
|
+
* @param args - merge args
|
|
32
|
+
* @returns whether the trees were successfully merged
|
|
33
|
+
*/
|
|
34
|
+
merge(args: IMergeArgs): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Submit proofs on-chain api method
|
|
37
|
+
* @param args - submit proofs on-chain args
|
|
38
|
+
*/
|
|
39
|
+
submit(args: SubmitProofsDto): Promise<ITallyData>;
|
|
40
|
+
/**
|
|
41
|
+
* Get RSA public key for authorization setup
|
|
42
|
+
*
|
|
43
|
+
* @returns RSA public key
|
|
44
|
+
*/
|
|
45
|
+
getPublicKey(): Promise<IGetPublicKeyData>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=proof.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.controller.d.ts","sourceRoot":"","sources":["../../../ts/proof/proof.controller.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAiB,eAAe,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,qBAGa,eAAe;IAaxB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAb9B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE3D;;;;;OAKG;gBAEgB,qBAAqB,EAAE,qBAAqB,EAC5C,WAAW,EAAE,WAAW;IAG3C;;;;;OAKG;IAcG,QAAQ,CAAS,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAOtE;;;;;OAKG;IAcG,KAAK,CAAS,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAOvD;;;OAGG;IAcG,MAAM,CAAS,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAOhE;;;;OAIG;IAKG,YAAY,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAMjD"}
|
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var ProofController_1;
|
|
14
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
15
|
+
import { Body, Controller, Get, HttpException, HttpStatus, Logger, Post } from "@nestjs/common";
|
|
16
|
+
import { ApiBearerAuth, ApiBody, ApiResponse, ApiTags } from "@nestjs/swagger";
|
|
17
|
+
import { mapErrorToHttpStatus } from "../common/http";
|
|
18
|
+
import { FileService } from "../file/file.service";
|
|
19
|
+
import { GenerateProofDto, MergeTreesDto, SubmitProofsDto } from "./dto";
|
|
20
|
+
import { ProofGeneratorService } from "./proof.service";
|
|
21
|
+
let ProofController = ProofController_1 = class ProofController {
|
|
22
|
+
proofGeneratorService;
|
|
23
|
+
fileService;
|
|
24
|
+
/**
|
|
25
|
+
* Logger
|
|
26
|
+
*/
|
|
27
|
+
logger = new Logger(ProofController_1.name);
|
|
28
|
+
/**
|
|
29
|
+
* Initialize ProofController
|
|
30
|
+
*
|
|
31
|
+
* @param proofGeneratorService - proof generator service
|
|
32
|
+
* @param fileService - file service
|
|
33
|
+
*/
|
|
34
|
+
constructor(proofGeneratorService, fileService) {
|
|
35
|
+
this.proofGeneratorService = proofGeneratorService;
|
|
36
|
+
this.fileService = fileService;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generate proofs api method
|
|
40
|
+
*
|
|
41
|
+
* @param args - generate proof dto
|
|
42
|
+
* @returns generated proofs and tally data
|
|
43
|
+
*/
|
|
44
|
+
async generate(args) {
|
|
45
|
+
return this.proofGeneratorService.generate(args).catch((error) => {
|
|
46
|
+
this.logger.error(`Error:`, error);
|
|
47
|
+
throw new HttpException(error.message, mapErrorToHttpStatus(error));
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Merge trees api method
|
|
52
|
+
*
|
|
53
|
+
* @param args - merge args
|
|
54
|
+
* @returns whether the trees were successfully merged
|
|
55
|
+
*/
|
|
56
|
+
async merge(args) {
|
|
57
|
+
return this.proofGeneratorService.merge(args).catch((error) => {
|
|
58
|
+
this.logger.error(`Error:`, error);
|
|
59
|
+
throw new HttpException(error.message, mapErrorToHttpStatus(error));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Submit proofs on-chain api method
|
|
64
|
+
* @param args - submit proofs on-chain args
|
|
65
|
+
*/
|
|
66
|
+
async submit(args) {
|
|
67
|
+
return this.proofGeneratorService.submit(args).catch((error) => {
|
|
68
|
+
this.logger.error(`Error:`, error);
|
|
69
|
+
throw new HttpException(error.message, mapErrorToHttpStatus(error));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get RSA public key for authorization setup
|
|
74
|
+
*
|
|
75
|
+
* @returns RSA public key
|
|
76
|
+
*/
|
|
77
|
+
async getPublicKey() {
|
|
78
|
+
return this.fileService.getPublicKey().catch((error) => {
|
|
79
|
+
this.logger.error(`Error:`, error);
|
|
80
|
+
throw new HttpException(error.message, mapErrorToHttpStatus(error));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
__decorate([
|
|
85
|
+
ApiBody({ type: GenerateProofDto }),
|
|
86
|
+
ApiResponse({ status: HttpStatus.CREATED, description: "The proofs have been successfully generated" }),
|
|
87
|
+
ApiResponse({ status: HttpStatus.FORBIDDEN, description: "Invalid approval signature" }),
|
|
88
|
+
ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "Unsupported input (network/policy/voice credit proxy)" }),
|
|
89
|
+
ApiResponse({
|
|
90
|
+
status: HttpStatus.CONFLICT,
|
|
91
|
+
description: "Operation cannot proceed due to state conflict (e.g., poll already tallied or trees not merged)",
|
|
92
|
+
}),
|
|
93
|
+
ApiResponse({
|
|
94
|
+
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
95
|
+
description: "Proof generation failed (encryption/decryption or merge failure)",
|
|
96
|
+
}),
|
|
97
|
+
Post("generate"),
|
|
98
|
+
__param(0, Body()),
|
|
99
|
+
__metadata("design:type", Function),
|
|
100
|
+
__metadata("design:paramtypes", [GenerateProofDto]),
|
|
101
|
+
__metadata("design:returntype", Promise)
|
|
102
|
+
], ProofController.prototype, "generate", null);
|
|
103
|
+
__decorate([
|
|
104
|
+
ApiBody({ type: MergeTreesDto }),
|
|
105
|
+
ApiResponse({ status: HttpStatus.CREATED, description: "The proofs have been successfully merged" }),
|
|
106
|
+
ApiResponse({ status: HttpStatus.FORBIDDEN, description: "Invalid approval signature" }),
|
|
107
|
+
ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "Invalid input" }),
|
|
108
|
+
ApiResponse({
|
|
109
|
+
status: HttpStatus.CONFLICT,
|
|
110
|
+
description: "Operation cannot proceed due to state conflict (e.g., trees not ready/merged)",
|
|
111
|
+
}),
|
|
112
|
+
ApiResponse({
|
|
113
|
+
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
114
|
+
description: "Merge failed (failed to merge state or message trees)",
|
|
115
|
+
}),
|
|
116
|
+
Post("merge"),
|
|
117
|
+
__param(0, Body()),
|
|
118
|
+
__metadata("design:type", Function),
|
|
119
|
+
__metadata("design:paramtypes", [Object]),
|
|
120
|
+
__metadata("design:returntype", Promise)
|
|
121
|
+
], ProofController.prototype, "merge", null);
|
|
122
|
+
__decorate([
|
|
123
|
+
ApiBody({ type: SubmitProofsDto }),
|
|
124
|
+
ApiResponse({ status: HttpStatus.CREATED, description: "The proofs have been successfully submitted" }),
|
|
125
|
+
ApiResponse({ status: HttpStatus.FORBIDDEN, description: "Invalid approval signature" }),
|
|
126
|
+
ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "Invalid input" }),
|
|
127
|
+
ApiResponse({
|
|
128
|
+
status: HttpStatus.CONFLICT,
|
|
129
|
+
description: "Operation cannot proceed due to state conflict (e.g., poll already tallied)",
|
|
130
|
+
}),
|
|
131
|
+
ApiResponse({
|
|
132
|
+
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
133
|
+
description: "On-chain submission failed (verifying keys/contract interaction errors)",
|
|
134
|
+
}),
|
|
135
|
+
Post("submit"),
|
|
136
|
+
__param(0, Body()),
|
|
137
|
+
__metadata("design:type", Function),
|
|
138
|
+
__metadata("design:paramtypes", [SubmitProofsDto]),
|
|
139
|
+
__metadata("design:returntype", Promise)
|
|
140
|
+
], ProofController.prototype, "submit", null);
|
|
141
|
+
__decorate([
|
|
142
|
+
ApiResponse({ status: HttpStatus.OK, description: "Public key was successfully returned" }),
|
|
143
|
+
ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "Invalid request" }),
|
|
144
|
+
ApiResponse({ status: HttpStatus.INTERNAL_SERVER_ERROR, description: "Failed to read or generate public key" }),
|
|
145
|
+
Get("publicKey"),
|
|
146
|
+
__metadata("design:type", Function),
|
|
147
|
+
__metadata("design:paramtypes", []),
|
|
148
|
+
__metadata("design:returntype", Promise)
|
|
149
|
+
], ProofController.prototype, "getPublicKey", null);
|
|
150
|
+
ProofController = ProofController_1 = __decorate([
|
|
151
|
+
ApiTags("v1/proof"),
|
|
152
|
+
ApiBearerAuth(),
|
|
153
|
+
Controller("v1/proof"),
|
|
154
|
+
__metadata("design:paramtypes", [ProofGeneratorService,
|
|
155
|
+
FileService])
|
|
156
|
+
], ProofController);
|
|
157
|
+
export { ProofController };
|
|
158
|
+
//# sourceMappingURL=proof.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.controller.js","sourceRoot":"","sources":["../../../ts/proof/proof.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iD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