@maci-protocol/coordinator 0.0.0-ci.533e19d
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 +22 -0
- package/README.md +42 -0
- package/build/hardhat.config.cjs +31 -0
- package/build/hardhat.config.cjs.map +1 -0
- package/build/hardhat.config.d.cts +24 -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 +8 -0
- package/build/tests/constants.d.ts.map +1 -0
- package/build/tests/constants.js +10 -0
- package/build/tests/constants.js.map +1 -0
- package/build/tests/e2e.aa.test.d.ts +2 -0
- package/build/tests/e2e.aa.test.d.ts.map +1 -0
- package/build/tests/e2e.aa.test.js +103 -0
- package/build/tests/e2e.aa.test.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 +234 -0
- package/build/tests/e2e.deploy.test.js.map +1 -0
- package/build/tests/utils.d.ts +14 -0
- package/build/tests/utils.d.ts.map +1 -0
- package/build/tests/utils.js +44 -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 +36 -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 +79 -0
- package/build/ts/common/__tests__/common.test.js.map +1 -0
- package/build/ts/common/accountAbstraction.d.ts +55 -0
- package/build/ts/common/accountAbstraction.d.ts.map +1 -0
- package/build/ts/common/accountAbstraction.js +110 -0
- package/build/ts/common/accountAbstraction.js.map +1 -0
- package/build/ts/common/errors.d.ts +33 -0
- package/build/ts/common/errors.d.ts.map +1 -0
- package/build/ts/common/errors.js +34 -0
- package/build/ts/common/errors.js.map +1 -0
- package/build/ts/common/index.d.ts +4 -0
- package/build/ts/common/index.d.ts.map +1 -0
- package/build/ts/common/index.js +4 -0
- package/build/ts/common/index.js.map +1 -0
- package/build/ts/common/networks.d.ts +29 -0
- package/build/ts/common/networks.d.ts.map +1 -0
- package/build/ts/common/networks.js +70 -0
- package/build/ts/common/networks.js.map +1 -0
- package/build/ts/common/types.d.ts +9 -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 +84 -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 +425 -0
- package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -0
- package/build/ts/deployer/__tests__/utils.d.ts +36 -0
- package/build/ts/deployer/__tests__/utils.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/utils.js +96 -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 +89 -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 +112 -0
- package/build/ts/deployer/deployer.service.d.ts.map +1 -0
- package/build/ts/deployer/deployer.service.js +614 -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 +117 -0
- package/build/ts/deployer/dto.js.map +1 -0
- package/build/ts/deployer/types.d.ts +293 -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/deployer/utils.d.ts +8 -0
- package/build/ts/deployer/utils.d.ts.map +1 -0
- package/build/ts/deployer/utils.js +9 -0
- package/build/ts/deployer/utils.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 +76 -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 +62 -0
- package/build/ts/file/file.service.d.ts.map +1 -0
- package/build/ts/file/file.service.js +115 -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/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 +89 -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 +61 -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 +128 -0
- package/build/ts/proof/__tests__/proof.service.test.js.map +1 -0
- package/build/ts/proof/dto.d.ts +73 -0
- package/build/ts/proof/dto.d.ts.map +1 -0
- package/build/ts/proof/dto.js +255 -0
- package/build/ts/proof/dto.js.map +1 -0
- package/build/ts/proof/proof.controller.d.ts +46 -0
- package/build/ts/proof/proof.controller.d.ts.map +1 -0
- package/build/ts/proof/proof.controller.js +135 -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 +24 -0
- package/build/ts/proof/proof.module.js.map +1 -0
- package/build/ts/proof/proof.service.d.ts +54 -0
- package/build/ts/proof/proof.service.d.ts.map +1 -0
- package/build/ts/proof/proof.service.js +246 -0
- package/build/ts/proof/proof.service.js.map +1 -0
- package/build/ts/proof/types.d.ts +140 -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/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 +61 -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 +64 -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/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 +50 -0
- package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.service.js +104 -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 +66 -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 +20 -0
- package/build/ts/subgraph/subgraph.service.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.service.js +106 -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 +124 -0
|
@@ -0,0 +1,614 @@
|
|
|
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 DeployerService_1;
|
|
11
|
+
import { PubKey, VerifyingKey } from "@maci-protocol/domainobjs";
|
|
12
|
+
import { ConstantInitialVoiceCreditProxy__factory as ConstantInitialVoiceCreditProxyFactory, ContractStorage, EPolicies, FreeForAllPolicy__factory as FreeForAllPolicyFactory, EASPolicy__factory as EASPolicyFactory, ZupassPolicy__factory as ZupassPolicyFactory, HatsPolicy__factory as HatsPolicyFactory, SemaphorePolicy__factory as SemaphorePolicyFactory, GitcoinPassportPolicy__factory as GitcoinPassportPolicyFactory, Verifier__factory as VerifierFactory, PoseidonT3__factory as PoseidonT3Factory, PoseidonT4__factory as PoseidonT4Factory, PoseidonT5__factory as PoseidonT5Factory, PoseidonT6__factory as PoseidonT6Factory, VkRegistry__factory as VkRegistryFactory, TallyFactory__factory as TallyFactoryFactory, PollFactory__factory as PollFactoryFactory, MessageProcessorFactory__factory as MessageProcessorFactoryFactory, MessageProcessor__factory as MessageProcessorFactory, ERC20VotesPolicy__factory as ERC20VotesPolicyFactory, Tally__factory as TallyFactory, Poll__factory as PollFactory, MACI__factory as MACIFactory, EContracts, EInitialVoiceCreditProxies, EMode, deployPoll, extractAllVks, extractVk, genEmptyBallotRoots, } from "@maci-protocol/sdk";
|
|
13
|
+
import { Injectable, Logger } from "@nestjs/common";
|
|
14
|
+
import { BaseContract } from "ethers";
|
|
15
|
+
import { encodeFunctionData } from "viem";
|
|
16
|
+
import path from "path";
|
|
17
|
+
import { ErrorCodes } from "../common";
|
|
18
|
+
import { getBundlerClient, getDeployedContractAddress, getPublicClient } from "../common/accountAbstraction";
|
|
19
|
+
import { FileService } from "../file/file.service";
|
|
20
|
+
import { SessionKeysService } from "../sessionKeys/sessionKeys.service";
|
|
21
|
+
import { MAX_GAS_LIMIT } from "./constants";
|
|
22
|
+
import { estimateExtraGasLimit } from "./utils";
|
|
23
|
+
/**
|
|
24
|
+
* DeployerService is responsible for deploying contracts.
|
|
25
|
+
*/
|
|
26
|
+
let DeployerService = DeployerService_1 = class DeployerService {
|
|
27
|
+
sessionKeysService;
|
|
28
|
+
fileService;
|
|
29
|
+
/**
|
|
30
|
+
* Logger
|
|
31
|
+
*/
|
|
32
|
+
logger = new Logger(DeployerService_1.name);
|
|
33
|
+
/**
|
|
34
|
+
* Contract storage instance
|
|
35
|
+
*/
|
|
36
|
+
storage;
|
|
37
|
+
/**
|
|
38
|
+
* Create a new instance of DeployerService
|
|
39
|
+
*
|
|
40
|
+
* @param fileService - file service
|
|
41
|
+
*/
|
|
42
|
+
constructor(sessionKeysService, fileService) {
|
|
43
|
+
this.sessionKeysService = sessionKeysService;
|
|
44
|
+
this.fileService = fileService;
|
|
45
|
+
this.logger = new Logger(DeployerService_1.name);
|
|
46
|
+
this.storage = ContractStorage.getInstance(path.join(process.cwd(), "deployed-contracts.json"));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the policy abi and bytecode based on the policy type
|
|
50
|
+
* and also check if there is already an instance deployed
|
|
51
|
+
*
|
|
52
|
+
* @param policyType - the policy type
|
|
53
|
+
* @param network - the network
|
|
54
|
+
* @param args - the policy args
|
|
55
|
+
* @returns - the policy abi and bytecode
|
|
56
|
+
*/
|
|
57
|
+
getPolicyData(policyType, network, args) {
|
|
58
|
+
const address = this.storage.getAddress(policyType, network);
|
|
59
|
+
let storedArgs;
|
|
60
|
+
let isAlreadyDeployed;
|
|
61
|
+
// based on the policy type, we need to deploy the correct policy
|
|
62
|
+
switch (policyType) {
|
|
63
|
+
case EPolicies.FreeForAll: {
|
|
64
|
+
return {
|
|
65
|
+
address,
|
|
66
|
+
abi: FreeForAllPolicyFactory.abi,
|
|
67
|
+
bytecode: FreeForAllPolicyFactory.bytecode,
|
|
68
|
+
alreadyDeployed: !!address,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
case EPolicies.EAS: {
|
|
72
|
+
storedArgs = this.storage.getContractArgs(policyType, network);
|
|
73
|
+
isAlreadyDeployed =
|
|
74
|
+
!!storedArgs &&
|
|
75
|
+
storedArgs.length === 3 &&
|
|
76
|
+
storedArgs[0] === args.easAddress &&
|
|
77
|
+
storedArgs[1] === args.schema &&
|
|
78
|
+
storedArgs[2] === args.attester;
|
|
79
|
+
return {
|
|
80
|
+
address: isAlreadyDeployed ? address : undefined,
|
|
81
|
+
abi: EASPolicyFactory.abi,
|
|
82
|
+
bytecode: EASPolicyFactory.bytecode,
|
|
83
|
+
alreadyDeployed: isAlreadyDeployed,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
case EPolicies.Zupass: {
|
|
87
|
+
storedArgs = this.storage.getContractArgs(policyType, network);
|
|
88
|
+
isAlreadyDeployed =
|
|
89
|
+
!!storedArgs &&
|
|
90
|
+
storedArgs.length === 4 &&
|
|
91
|
+
storedArgs[0] === args.signer1 &&
|
|
92
|
+
storedArgs[1] === args.signer2 &&
|
|
93
|
+
storedArgs[2] === args.eventId &&
|
|
94
|
+
storedArgs[3] === args.zupassVerifier;
|
|
95
|
+
return {
|
|
96
|
+
address: isAlreadyDeployed ? address : undefined,
|
|
97
|
+
abi: ZupassPolicyFactory.abi,
|
|
98
|
+
bytecode: ZupassPolicyFactory.bytecode,
|
|
99
|
+
alreadyDeployed: isAlreadyDeployed,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
case EPolicies.Hats: {
|
|
103
|
+
storedArgs = this.storage.getContractArgs(policyType, network);
|
|
104
|
+
isAlreadyDeployed =
|
|
105
|
+
!!storedArgs &&
|
|
106
|
+
storedArgs.length === 2 &&
|
|
107
|
+
storedArgs[0] === args.hatsProtocolAddress &&
|
|
108
|
+
JSON.stringify(storedArgs[1]) === JSON.stringify(args.critrionHats);
|
|
109
|
+
return {
|
|
110
|
+
address: isAlreadyDeployed ? address : undefined,
|
|
111
|
+
abi: HatsPolicyFactory.abi,
|
|
112
|
+
bytecode: HatsPolicyFactory.bytecode,
|
|
113
|
+
alreadyDeployed: isAlreadyDeployed,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
case EPolicies.Semaphore: {
|
|
117
|
+
storedArgs = this.storage.getContractArgs(policyType, network);
|
|
118
|
+
isAlreadyDeployed =
|
|
119
|
+
!!storedArgs &&
|
|
120
|
+
storedArgs.length === 2 &&
|
|
121
|
+
storedArgs[0] === args.semaphoreContract &&
|
|
122
|
+
storedArgs[1] === args.groupId;
|
|
123
|
+
return {
|
|
124
|
+
address: isAlreadyDeployed ? address : undefined,
|
|
125
|
+
abi: SemaphorePolicyFactory.abi,
|
|
126
|
+
bytecode: SemaphorePolicyFactory.bytecode,
|
|
127
|
+
alreadyDeployed: isAlreadyDeployed,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
case EPolicies.GitcoinPassport: {
|
|
131
|
+
storedArgs = this.storage.getContractArgs(policyType, network);
|
|
132
|
+
isAlreadyDeployed =
|
|
133
|
+
!!storedArgs &&
|
|
134
|
+
storedArgs.length === 2 &&
|
|
135
|
+
storedArgs[0] === args.decoderAddress &&
|
|
136
|
+
storedArgs[1] === args.passingScore;
|
|
137
|
+
return {
|
|
138
|
+
address: isAlreadyDeployed ? address : undefined,
|
|
139
|
+
abi: GitcoinPassportPolicyFactory.abi,
|
|
140
|
+
bytecode: GitcoinPassportPolicyFactory.bytecode,
|
|
141
|
+
alreadyDeployed: isAlreadyDeployed,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
case EPolicies.ERC20Votes: {
|
|
145
|
+
storedArgs = this.storage.getContractArgs(policyType, network);
|
|
146
|
+
isAlreadyDeployed =
|
|
147
|
+
!!storedArgs &&
|
|
148
|
+
storedArgs.length === 3 &&
|
|
149
|
+
storedArgs[0] === args.token &&
|
|
150
|
+
storedArgs[1] === args.factor &&
|
|
151
|
+
storedArgs[2] === args.snapshotBlock;
|
|
152
|
+
return {
|
|
153
|
+
address: isAlreadyDeployed ? address : undefined,
|
|
154
|
+
abi: ERC20VotesPolicyFactory.abi,
|
|
155
|
+
bytecode: ERC20VotesPolicyFactory.bytecode,
|
|
156
|
+
alreadyDeployed: isAlreadyDeployed,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
default:
|
|
160
|
+
throw new Error(ErrorCodes.UNSUPPORTED_POLICY.toString());
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get the voice credit proxy abi and bytecode based on the voice credit proxy type
|
|
165
|
+
* and also check if there is already an instance deployed
|
|
166
|
+
*
|
|
167
|
+
* @param voiceCreditProxyType - the voice credit proxy type
|
|
168
|
+
* @param network - the network
|
|
169
|
+
* @param args - the voice credit proxy args
|
|
170
|
+
* @returns - the voice credit proxy abi and bytecode
|
|
171
|
+
*/
|
|
172
|
+
getVoiceCreditProxyData(voiceCreditProxyType, network, args) {
|
|
173
|
+
let storedArgs;
|
|
174
|
+
let isAlreadyDeployed;
|
|
175
|
+
const address = this.storage.getAddress(voiceCreditProxyType, network);
|
|
176
|
+
switch (voiceCreditProxyType) {
|
|
177
|
+
case EInitialVoiceCreditProxies.Constant: {
|
|
178
|
+
storedArgs = this.storage.getContractArgs(voiceCreditProxyType, network);
|
|
179
|
+
isAlreadyDeployed = !!storedArgs && storedArgs[0] === args.amount;
|
|
180
|
+
return {
|
|
181
|
+
address: isAlreadyDeployed ? address : undefined,
|
|
182
|
+
abi: ConstantInitialVoiceCreditProxyFactory.abi,
|
|
183
|
+
bytecode: ConstantInitialVoiceCreditProxyFactory.bytecode,
|
|
184
|
+
alreadyDeployed: isAlreadyDeployed,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
default:
|
|
188
|
+
throw new Error(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY.toString());
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @param abi - the abi
|
|
193
|
+
* @param bytecode - the bytecode
|
|
194
|
+
* @param args - the args
|
|
195
|
+
* @param publicClient - the public client
|
|
196
|
+
* @returns - the address
|
|
197
|
+
*/
|
|
198
|
+
async deployAndGetAddress(kernelClient, abi, bytecode, args, bundlerClient, publicClient) {
|
|
199
|
+
const deployCallData = await kernelClient.account.encodeDeployCallData({
|
|
200
|
+
abi,
|
|
201
|
+
args,
|
|
202
|
+
bytecode,
|
|
203
|
+
});
|
|
204
|
+
const gasPrice = await kernelClient.getUserOperationGasPrice();
|
|
205
|
+
const opEstimate = await kernelClient.prepareUserOperation({
|
|
206
|
+
callData: deployCallData,
|
|
207
|
+
sender: kernelClient.account.address,
|
|
208
|
+
maxFeePerGas: gasPrice.maxFeePerGas,
|
|
209
|
+
maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas,
|
|
210
|
+
});
|
|
211
|
+
const callGasLimitMultiplier = estimateExtraGasLimit(opEstimate.callGasLimit);
|
|
212
|
+
const tx = await kernelClient.sendUserOperation({
|
|
213
|
+
callData: deployCallData,
|
|
214
|
+
sender: kernelClient.account.address,
|
|
215
|
+
maxFeePerGas: gasPrice.maxFeePerGas,
|
|
216
|
+
maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas,
|
|
217
|
+
callGasLimit: opEstimate.callGasLimit + callGasLimitMultiplier < MAX_GAS_LIMIT
|
|
218
|
+
? opEstimate.callGasLimit + callGasLimitMultiplier
|
|
219
|
+
: MAX_GAS_LIMIT,
|
|
220
|
+
});
|
|
221
|
+
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
222
|
+
hash: tx,
|
|
223
|
+
});
|
|
224
|
+
const txReceipt = await publicClient.getTransactionReceipt({
|
|
225
|
+
hash: receipt.receipt.transactionHash,
|
|
226
|
+
});
|
|
227
|
+
return getDeployedContractAddress(txReceipt);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Deploy a contract and store the address
|
|
231
|
+
*
|
|
232
|
+
* @param contract - the contract to deploy
|
|
233
|
+
* @param args - the args
|
|
234
|
+
* @param abi - the abi
|
|
235
|
+
* @param bytecode - the bytecode
|
|
236
|
+
* @param kernelClient - the kernel client
|
|
237
|
+
* @param publicClient - the public client
|
|
238
|
+
* @param chain - the chain
|
|
239
|
+
* @returns - the address of the deployed contract
|
|
240
|
+
*/
|
|
241
|
+
async deployAndStore(contract, args, abi, bytecode, kernelClient, bundlerClient, publicClient, chain) {
|
|
242
|
+
let address = this.storage.getAddress(contract, chain);
|
|
243
|
+
if (!address) {
|
|
244
|
+
address = await this.deployAndGetAddress(kernelClient, abi, bytecode, args, bundlerClient, publicClient);
|
|
245
|
+
if (!address) {
|
|
246
|
+
this.logger.error(`Failed to deploy contract: ${contract}`);
|
|
247
|
+
throw new Error(`${ErrorCodes.FAILED_TO_DEPLOY_CONTRACT} ${contract}`);
|
|
248
|
+
}
|
|
249
|
+
await this.storage.register({
|
|
250
|
+
id: contract,
|
|
251
|
+
contract: new BaseContract(address, abi),
|
|
252
|
+
args: args.map((arg) => {
|
|
253
|
+
if (Array.isArray(arg)) {
|
|
254
|
+
return arg.map((a) => String(a));
|
|
255
|
+
}
|
|
256
|
+
return String(arg);
|
|
257
|
+
}),
|
|
258
|
+
network: chain,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
return address;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Estimate gas, add a bit extra and send the user operation (aka. transaction)
|
|
265
|
+
* @param to - the to address of the user operation
|
|
266
|
+
* @param value - the value of the user operation
|
|
267
|
+
* @param abi - the abi
|
|
268
|
+
* @param functionName - the function name
|
|
269
|
+
* @param args - the args
|
|
270
|
+
* @param errorMessage - the error message
|
|
271
|
+
* @param kernelClient - the kernel client
|
|
272
|
+
* @param bundlerClient - the bundler client
|
|
273
|
+
*/
|
|
274
|
+
async estimateGasAndSend(to, value, abi, functionName, args, errorMessage, kernelClient, bundlerClient) {
|
|
275
|
+
const gasEstimates = await kernelClient.getUserOperationGasPrice();
|
|
276
|
+
const userOperation = {
|
|
277
|
+
sender: kernelClient.account.address,
|
|
278
|
+
maxFeePerGas: gasEstimates.maxFeePerGas,
|
|
279
|
+
maxPriorityFeePerGas: gasEstimates.maxPriorityFeePerGas,
|
|
280
|
+
callData: await kernelClient.account.encodeCalls([
|
|
281
|
+
{
|
|
282
|
+
to,
|
|
283
|
+
value,
|
|
284
|
+
data: encodeFunctionData({
|
|
285
|
+
abi,
|
|
286
|
+
functionName,
|
|
287
|
+
args,
|
|
288
|
+
}),
|
|
289
|
+
},
|
|
290
|
+
]),
|
|
291
|
+
};
|
|
292
|
+
const opEstimate = await kernelClient.prepareUserOperation(userOperation);
|
|
293
|
+
const callGasLimitMultiplier = estimateExtraGasLimit(opEstimate.callGasLimit);
|
|
294
|
+
const userOperationHash = await kernelClient.sendUserOperation({
|
|
295
|
+
...userOperation,
|
|
296
|
+
callGasLimit: opEstimate.callGasLimit + callGasLimitMultiplier < MAX_GAS_LIMIT
|
|
297
|
+
? opEstimate.callGasLimit + callGasLimitMultiplier
|
|
298
|
+
: MAX_GAS_LIMIT,
|
|
299
|
+
});
|
|
300
|
+
const receipt = await bundlerClient.waitForUserOperationReceipt({ hash: userOperationHash });
|
|
301
|
+
if (!receipt.success) {
|
|
302
|
+
throw new Error(errorMessage);
|
|
303
|
+
}
|
|
304
|
+
return receipt;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Get verifying keys arguments (specially zkey paths)
|
|
308
|
+
* @param signer - the signer
|
|
309
|
+
* @param vkRegistryContract - the deployed vk registry contract
|
|
310
|
+
* @param vkRegistryArgs - the arguments send to the endpoint
|
|
311
|
+
* @param mode - use QV or NON_QV
|
|
312
|
+
* @returns SetVerifyingKeysArgs
|
|
313
|
+
*/
|
|
314
|
+
async getVerifyingKeysArgs(signer, vkRegistryContract, vkRegistryArgs, mode) {
|
|
315
|
+
const pollJoiningZkeyPath = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_POLL_JOINING_ZKEY_NAME, true).zkey;
|
|
316
|
+
const pollJoinedZkeyPath = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_POLL_JOINED_ZKEY_NAME, true).zkey;
|
|
317
|
+
const processMessagesZkeyPath = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, mode === EMode.QV).zkey;
|
|
318
|
+
const tallyVotesZkeyPath = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_TALLY_ZKEY_NAME, mode === EMode.QV).zkey;
|
|
319
|
+
const { pollJoiningVk, pollJoinedVk, processVk, tallyVk } = await extractAllVks({
|
|
320
|
+
pollJoiningZkeyPath,
|
|
321
|
+
pollJoinedZkeyPath,
|
|
322
|
+
processMessagesZkeyPath,
|
|
323
|
+
tallyVotesZkeyPath,
|
|
324
|
+
});
|
|
325
|
+
const { stateTreeDepth, intStateTreeDepth, voteOptionTreeDepth, messageBatchSize } = vkRegistryArgs;
|
|
326
|
+
return {
|
|
327
|
+
pollJoiningVk: pollJoiningVk,
|
|
328
|
+
pollJoinedVk: pollJoinedVk,
|
|
329
|
+
processMessagesVk: processVk,
|
|
330
|
+
tallyVotesVk: tallyVk,
|
|
331
|
+
stateTreeDepth: Number(stateTreeDepth),
|
|
332
|
+
intStateTreeDepth: Number(intStateTreeDepth),
|
|
333
|
+
voteOptionTreeDepth: Number(voteOptionTreeDepth),
|
|
334
|
+
messageBatchSize: Number(messageBatchSize),
|
|
335
|
+
signer,
|
|
336
|
+
mode,
|
|
337
|
+
vkRegistryAddress: await vkRegistryContract.getAddress(),
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Deploy MACI contracts
|
|
342
|
+
*
|
|
343
|
+
* @param args - deploy maci arguments
|
|
344
|
+
* @param options - ws hooks
|
|
345
|
+
* @returns - deployed maci contract
|
|
346
|
+
* @returns the address of the deployed maci contract
|
|
347
|
+
*/
|
|
348
|
+
async deployMaci({ approval, sessionKeyAddress, chain, config }) {
|
|
349
|
+
const publicClient = getPublicClient(chain);
|
|
350
|
+
const bundlerClient = getBundlerClient(chain);
|
|
351
|
+
const kernelClient = await this.sessionKeysService.generateClientFromSessionKey(sessionKeyAddress, approval, chain);
|
|
352
|
+
let policyAddress = this.storage.getAddress(config.policy.type, chain);
|
|
353
|
+
const policyData = this.getPolicyData(config.policy.type, chain, config.policy.args);
|
|
354
|
+
// if the policy is not already deployed, we need to deploy it
|
|
355
|
+
if (!policyData.alreadyDeployed) {
|
|
356
|
+
policyAddress = await this.deployAndStore(config.policy.type, config.policy.args ? Object.values(config.policy.args) : [], policyData.abi, policyData.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
357
|
+
}
|
|
358
|
+
// deploy all maci contracts
|
|
359
|
+
// (we are not using Promise.all because the write tx nonce should be sequential)
|
|
360
|
+
// 1. verifier
|
|
361
|
+
await this.deployAndStore(EContracts.Verifier, [], VerifierFactory.abi, VerifierFactory.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
362
|
+
// 2. poseidon
|
|
363
|
+
let poseidonT3Address;
|
|
364
|
+
let poseidonT4Address;
|
|
365
|
+
let poseidonT5Address;
|
|
366
|
+
let poseidonT6Address;
|
|
367
|
+
if (config.Poseidon) {
|
|
368
|
+
// Some times the poseidon contracts are already deployed so we don't need to deploy them again
|
|
369
|
+
poseidonT3Address = config.Poseidon.poseidonT3;
|
|
370
|
+
poseidonT4Address = config.Poseidon.poseidonT4;
|
|
371
|
+
poseidonT5Address = config.Poseidon.poseidonT5;
|
|
372
|
+
poseidonT6Address = config.Poseidon.poseidonT6;
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
poseidonT3Address = await this.deployAndStore(EContracts.PoseidonT3, [], PoseidonT3Factory.abi, PoseidonT3Factory.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
376
|
+
poseidonT4Address = await this.deployAndStore(EContracts.PoseidonT4, [], PoseidonT4Factory.abi, PoseidonT4Factory.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
377
|
+
poseidonT5Address = await this.deployAndStore(EContracts.PoseidonT5, [], PoseidonT5Factory.abi, PoseidonT5Factory.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
378
|
+
poseidonT6Address = await this.deployAndStore(EContracts.PoseidonT6, [], PoseidonT6Factory.abi, PoseidonT6Factory.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
379
|
+
}
|
|
380
|
+
// 3. factories
|
|
381
|
+
const pollFactoryAddress = await this.deployAndStore(EContracts.PollFactory, [], PollFactoryFactory.abi, PollFactoryFactory.linkBytecode({
|
|
382
|
+
"contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonT3Address,
|
|
383
|
+
"contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonT4Address,
|
|
384
|
+
"contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonT5Address,
|
|
385
|
+
"contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonT6Address,
|
|
386
|
+
}), kernelClient, bundlerClient, publicClient, chain);
|
|
387
|
+
const tallyFactoryAddress = await this.deployAndStore(EContracts.TallyFactory, [], TallyFactoryFactory.abi, TallyFactoryFactory.linkBytecode({
|
|
388
|
+
"contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonT3Address,
|
|
389
|
+
"contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonT4Address,
|
|
390
|
+
"contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonT5Address,
|
|
391
|
+
"contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonT6Address,
|
|
392
|
+
}), kernelClient, bundlerClient, publicClient, chain);
|
|
393
|
+
const messageProcessorFactoryAddress = await this.deployAndStore(EContracts.MessageProcessorFactory, [], MessageProcessorFactoryFactory.abi, MessageProcessorFactoryFactory.linkBytecode({
|
|
394
|
+
"contracts/crypto/PoseidonT3.sol:PoseidonT3": poseidonT3Address,
|
|
395
|
+
"contracts/crypto/PoseidonT4.sol:PoseidonT4": poseidonT4Address,
|
|
396
|
+
"contracts/crypto/PoseidonT5.sol:PoseidonT5": poseidonT5Address,
|
|
397
|
+
"contracts/crypto/PoseidonT6.sol:PoseidonT6": poseidonT6Address,
|
|
398
|
+
}), kernelClient, bundlerClient, publicClient, chain);
|
|
399
|
+
// 4. VkRegistry
|
|
400
|
+
const vkRegistryAddress = await this.deployAndStore(EContracts.VkRegistry, [], VkRegistryFactory.abi, VkRegistryFactory.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
401
|
+
try {
|
|
402
|
+
const processMessagesZkeyPathQv = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, true);
|
|
403
|
+
const tallyVotesZkeyPathQv = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_TALLY_ZKEY_NAME, true);
|
|
404
|
+
const processMessagesZkeyPathNonQv = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, false);
|
|
405
|
+
const tallyVotesZkeyPathNonQv = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_TALLY_ZKEY_NAME, false);
|
|
406
|
+
const pollJoiningZkeyPath = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_POLL_JOINING_ZKEY_NAME, true);
|
|
407
|
+
const pollJoinedZkeyPath = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_POLL_JOINED_ZKEY_NAME, true);
|
|
408
|
+
const [qvProcessVk, qvTallyVk, nonQvProcessVk, nonQvTallyVk, pollJoiningVk, pollJoinedVk] = await Promise.all([
|
|
409
|
+
extractVk(processMessagesZkeyPathQv.zkey),
|
|
410
|
+
extractVk(tallyVotesZkeyPathQv.zkey),
|
|
411
|
+
extractVk(processMessagesZkeyPathNonQv.zkey),
|
|
412
|
+
extractVk(tallyVotesZkeyPathNonQv.zkey),
|
|
413
|
+
extractVk(pollJoiningZkeyPath.zkey),
|
|
414
|
+
extractVk(pollJoinedZkeyPath.zkey),
|
|
415
|
+
]).then((vks) => vks.map((vk) => vk && VerifyingKey.fromObj(vk).asContractParam()));
|
|
416
|
+
const processZkeys = [qvProcessVk, nonQvProcessVk].filter(Boolean);
|
|
417
|
+
const tallyZkeys = [qvTallyVk, nonQvTallyVk].filter(Boolean);
|
|
418
|
+
// check if the keys are already set
|
|
419
|
+
const [isProcessVkSet, isProcessNonQvVkSet, isTallyVkSet, isTallyNonQvVkSet] = await Promise.all([
|
|
420
|
+
publicClient.readContract({
|
|
421
|
+
address: vkRegistryAddress,
|
|
422
|
+
abi: VkRegistryFactory.abi,
|
|
423
|
+
functionName: "hasProcessVk",
|
|
424
|
+
args: [
|
|
425
|
+
config.VkRegistry.args.stateTreeDepth,
|
|
426
|
+
config.VkRegistry.args.voteOptionTreeDepth,
|
|
427
|
+
config.VkRegistry.args.messageBatchSize,
|
|
428
|
+
EMode.QV,
|
|
429
|
+
],
|
|
430
|
+
}),
|
|
431
|
+
publicClient.readContract({
|
|
432
|
+
address: vkRegistryAddress,
|
|
433
|
+
abi: VkRegistryFactory.abi,
|
|
434
|
+
functionName: "hasProcessVk",
|
|
435
|
+
args: [
|
|
436
|
+
config.VkRegistry.args.stateTreeDepth,
|
|
437
|
+
config.VkRegistry.args.voteOptionTreeDepth,
|
|
438
|
+
config.VkRegistry.args.messageBatchSize,
|
|
439
|
+
EMode.NON_QV,
|
|
440
|
+
],
|
|
441
|
+
}),
|
|
442
|
+
publicClient.readContract({
|
|
443
|
+
address: vkRegistryAddress,
|
|
444
|
+
abi: VkRegistryFactory.abi,
|
|
445
|
+
functionName: "hasTallyVk",
|
|
446
|
+
args: [
|
|
447
|
+
config.VkRegistry.args.stateTreeDepth,
|
|
448
|
+
config.VkRegistry.args.intStateTreeDepth,
|
|
449
|
+
config.VkRegistry.args.voteOptionTreeDepth,
|
|
450
|
+
EMode.QV,
|
|
451
|
+
],
|
|
452
|
+
}),
|
|
453
|
+
publicClient.readContract({
|
|
454
|
+
address: vkRegistryAddress,
|
|
455
|
+
abi: VkRegistryFactory.abi,
|
|
456
|
+
functionName: "hasTallyVk",
|
|
457
|
+
args: [
|
|
458
|
+
config.VkRegistry.args.stateTreeDepth,
|
|
459
|
+
config.VkRegistry.args.intStateTreeDepth,
|
|
460
|
+
config.VkRegistry.args.voteOptionTreeDepth,
|
|
461
|
+
EMode.NON_QV,
|
|
462
|
+
],
|
|
463
|
+
}),
|
|
464
|
+
]);
|
|
465
|
+
if (isProcessVkSet && isProcessNonQvVkSet && isTallyVkSet && isTallyNonQvVkSet) {
|
|
466
|
+
this.logger.debug("Verifying keys are already set on the vk registry");
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
await this.estimateGasAndSend(vkRegistryAddress, 0n, VkRegistryFactory.abi, "setVerifyingKeysBatch", [
|
|
470
|
+
config.VkRegistry.args.stateTreeDepth,
|
|
471
|
+
config.VkRegistry.args.intStateTreeDepth,
|
|
472
|
+
config.VkRegistry.args.voteOptionTreeDepth,
|
|
473
|
+
config.VkRegistry.args.messageBatchSize,
|
|
474
|
+
[EMode.QV, EMode.NON_QV],
|
|
475
|
+
pollJoiningVk,
|
|
476
|
+
pollJoinedVk,
|
|
477
|
+
processZkeys,
|
|
478
|
+
tallyZkeys,
|
|
479
|
+
], ErrorCodes.FAILED_TO_SET_VERIFYING_KEYS_ON_VK_REGISTRY.toString(), kernelClient, bundlerClient);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
catch (error) {
|
|
483
|
+
this.logger.error("Failed to set verifying keys on vk registry: ", error);
|
|
484
|
+
throw error;
|
|
485
|
+
}
|
|
486
|
+
// 5. maci (here we don't check whether one is already deployed, we just deploy it)
|
|
487
|
+
const emptyBallotRoots = genEmptyBallotRoots(config.MACI.stateTreeDepth);
|
|
488
|
+
const maciAddress = await this.deployAndStore(EContracts.MACI, [
|
|
489
|
+
pollFactoryAddress,
|
|
490
|
+
messageProcessorFactoryAddress,
|
|
491
|
+
tallyFactoryAddress,
|
|
492
|
+
policyAddress,
|
|
493
|
+
config.MACI.stateTreeDepth,
|
|
494
|
+
emptyBallotRoots,
|
|
495
|
+
], MACIFactory.abi, MACIFactory.linkBytecode({
|
|
496
|
+
"contracts/crypto/PoseidonT3.sol:PoseidonT3": "0x07490eba00dc4ACA6721D052Fa4C5002Aa077233",
|
|
497
|
+
"contracts/crypto/PoseidonT4.sol:PoseidonT4": "0xbb0e724CE02e5E7eDd31e632dc6e59F229a1126d",
|
|
498
|
+
"contracts/crypto/PoseidonT5.sol:PoseidonT5": "0xE0398F7DFAC494c530F6404AfEaC8669ABeD2679",
|
|
499
|
+
"contracts/crypto/PoseidonT6.sol:PoseidonT6": "0xfD77833F10a29c76A6a0ede235Eb651D744d0E2F",
|
|
500
|
+
}), kernelClient, bundlerClient, publicClient, chain);
|
|
501
|
+
// set the gate on the policy
|
|
502
|
+
await this.estimateGasAndSend(policyAddress, 0n, policyData.abi, "setTarget", [maciAddress], ErrorCodes.FAILED_TO_SET_MACI_INSTANCE_ON_POLICY.toString(), kernelClient, bundlerClient);
|
|
503
|
+
return { address: maciAddress };
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Deploy a poll
|
|
507
|
+
*
|
|
508
|
+
* @param args - deploy poll dto
|
|
509
|
+
* @returns poll id
|
|
510
|
+
*/
|
|
511
|
+
async deployPoll({ approval, sessionKeyAddress, chain, config }) {
|
|
512
|
+
const publicClient = getPublicClient(chain);
|
|
513
|
+
const bundlerClient = getBundlerClient(chain);
|
|
514
|
+
const kernelClient = await this.sessionKeysService.generateClientFromSessionKey(sessionKeyAddress, approval, chain);
|
|
515
|
+
const signer = await this.sessionKeysService.getKernelClientSigner(kernelClient);
|
|
516
|
+
// check if there is a maci contract deployed on this chain
|
|
517
|
+
const maciAddress = this.storage.getAddress(EContracts.MACI, chain);
|
|
518
|
+
if (!maciAddress) {
|
|
519
|
+
throw new Error(ErrorCodes.MACI_NOT_DEPLOYED.toString());
|
|
520
|
+
}
|
|
521
|
+
// check if there is a verifier deployed on this chain
|
|
522
|
+
const verifierAddress = this.storage.getAddress(EContracts.Verifier, chain);
|
|
523
|
+
if (!verifierAddress) {
|
|
524
|
+
throw new Error(ErrorCodes.VERIFIER_NOT_DEPLOYED.toString());
|
|
525
|
+
}
|
|
526
|
+
// check if there is a vk registry deployed on this chain
|
|
527
|
+
const vkRegistryAddress = this.storage.getAddress(EContracts.VkRegistry, chain);
|
|
528
|
+
if (!vkRegistryAddress) {
|
|
529
|
+
throw new Error(ErrorCodes.VK_REGISTRY_NOT_DEPLOYED.toString());
|
|
530
|
+
}
|
|
531
|
+
// check if policy address was given
|
|
532
|
+
let policyAddress = config.policy.address;
|
|
533
|
+
if (!policyAddress) {
|
|
534
|
+
const policyData = this.getPolicyData(config.policy.type, chain, config.policy.args);
|
|
535
|
+
policyAddress = policyData.address;
|
|
536
|
+
// if the policy is not already deployed, we need to deploy it
|
|
537
|
+
if (!policyData.alreadyDeployed) {
|
|
538
|
+
policyAddress = await this.deployAndStore(config.policy.type, config.policy.args ? Object.values(config.policy.args) : [], policyData.abi, policyData.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
// check if initial voice credit proxy address was given
|
|
542
|
+
let initialVoiceCreditProxyAddress = config.initialVoiceCreditsProxy.address;
|
|
543
|
+
if (!initialVoiceCreditProxyAddress) {
|
|
544
|
+
const voiceCreditProxyData = this.getVoiceCreditProxyData(config.initialVoiceCreditsProxy.type, chain, config.initialVoiceCreditsProxy.args);
|
|
545
|
+
initialVoiceCreditProxyAddress = voiceCreditProxyData.address;
|
|
546
|
+
// if the voice credit proxy is not already deployed, we need to deploy it
|
|
547
|
+
if (!voiceCreditProxyData.alreadyDeployed) {
|
|
548
|
+
initialVoiceCreditProxyAddress = await this.deployAndStore(config.initialVoiceCreditsProxy.type, Object.values(config.initialVoiceCreditsProxy.args), voiceCreditProxyData.abi, voiceCreditProxyData.bytecode, kernelClient, bundlerClient, publicClient, chain);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
const mode = config.useQuadraticVoting ? EMode.QV : EMode.NON_QV;
|
|
552
|
+
const deployPollArgs = {
|
|
553
|
+
maciAddress,
|
|
554
|
+
pollStartTimestamp: config.startDate,
|
|
555
|
+
pollEndTimestamp: config.endDate,
|
|
556
|
+
intStateTreeDepth: config.intStateTreeDepth,
|
|
557
|
+
voteOptionTreeDepth: config.voteOptionTreeDepth,
|
|
558
|
+
messageBatchSize: config.messageBatchSize,
|
|
559
|
+
coordinatorPubKey: PubKey.deserialize(config.coordinatorPubkey),
|
|
560
|
+
verifierContractAddress: verifierAddress,
|
|
561
|
+
vkRegistryContractAddress: vkRegistryAddress,
|
|
562
|
+
mode,
|
|
563
|
+
policyContractAddress: policyAddress,
|
|
564
|
+
initialVoiceCreditProxyContractAddress: initialVoiceCreditProxyAddress,
|
|
565
|
+
relayers: config.relayers ? config.relayers.map((address) => address) : [],
|
|
566
|
+
voteOptions: Number(config.voteOptions),
|
|
567
|
+
initialVoiceCredits: Number(config.initialVoiceCreditsProxy.args.amount),
|
|
568
|
+
signer,
|
|
569
|
+
};
|
|
570
|
+
const { pollContractAddress, messageProcessorContractAddress, tallyContractAddress, pollId } = await deployPoll(deployPollArgs);
|
|
571
|
+
const poll = PollFactory.connect(pollContractAddress, signer);
|
|
572
|
+
// read the emptyBallotRoot and extContracts
|
|
573
|
+
const emptyBallotRoot = await poll.emptyBallotRoot();
|
|
574
|
+
const extContracts = await poll.extContracts();
|
|
575
|
+
// store to storage
|
|
576
|
+
await Promise.all([
|
|
577
|
+
this.storage.register({
|
|
578
|
+
id: EContracts.Poll,
|
|
579
|
+
key: `poll-${pollId}`,
|
|
580
|
+
contract: poll,
|
|
581
|
+
args: [
|
|
582
|
+
{
|
|
583
|
+
...deployPollArgs,
|
|
584
|
+
extContracts,
|
|
585
|
+
emptyBallotRoot: emptyBallotRoot.toString(),
|
|
586
|
+
},
|
|
587
|
+
],
|
|
588
|
+
network: chain,
|
|
589
|
+
}),
|
|
590
|
+
this.storage.register({
|
|
591
|
+
id: EContracts.MessageProcessor,
|
|
592
|
+
key: `poll-${pollId}`,
|
|
593
|
+
contract: new BaseContract(messageProcessorContractAddress, MessageProcessorFactory.abi),
|
|
594
|
+
args: [verifierAddress, vkRegistryAddress, pollContractAddress, mode],
|
|
595
|
+
network: chain,
|
|
596
|
+
}),
|
|
597
|
+
this.storage.register({
|
|
598
|
+
id: EContracts.Tally,
|
|
599
|
+
key: `poll-${pollId}`,
|
|
600
|
+
contract: new BaseContract(tallyContractAddress, TallyFactory.abi),
|
|
601
|
+
args: [verifierAddress, vkRegistryAddress, pollContractAddress, messageProcessorContractAddress, mode],
|
|
602
|
+
network: chain,
|
|
603
|
+
}),
|
|
604
|
+
]);
|
|
605
|
+
return { pollId: pollId.toString() };
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
DeployerService = DeployerService_1 = __decorate([
|
|
609
|
+
Injectable(),
|
|
610
|
+
__metadata("design:paramtypes", [SessionKeysService,
|
|
611
|
+
FileService])
|
|
612
|
+
], DeployerService);
|
|
613
|
+
export { DeployerService };
|
|
614
|
+
//# sourceMappingURL=deployer.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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