@maci-protocol/coordinator 0.0.0-ci.71ed5ba → 0.0.0-ci.75198a9
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/LICENSE +1 -2
- package/README.md +31 -6
- package/build/hardhat.config.cjs +5 -3
- package/build/hardhat.config.cjs.map +1 -1
- package/build/hardhat.config.d.cts +5 -4
- package/build/scripts/generateKeypair.js +2 -2
- package/build/scripts/generateKeypair.js.map +1 -1
- package/build/scripts/generateMaciKeyPair.js +2 -2
- package/build/scripts/generateMaciKeyPair.js.map +1 -1
- package/build/tests/constants.d.ts +0 -1
- package/build/tests/constants.d.ts.map +1 -1
- package/build/tests/constants.js +0 -1
- package/build/tests/constants.js.map +1 -1
- package/build/tests/e2e.deploy.test.js +145 -89
- package/build/tests/e2e.deploy.test.js.map +1 -1
- package/build/tests/e2e.redis.test.d.ts +2 -0
- package/build/tests/e2e.redis.test.d.ts.map +1 -0
- package/build/tests/e2e.redis.test.js +118 -0
- package/build/tests/e2e.redis.test.js.map +1 -0
- package/build/tests/utils.d.ts +6 -0
- package/build/tests/utils.d.ts.map +1 -1
- package/build/tests/utils.js +15 -6
- package/build/tests/utils.js.map +1 -1
- package/build/ts/app.module.d.ts.map +1 -1
- package/build/ts/app.module.js +6 -0
- package/build/ts/app.module.js.map +1 -1
- package/build/ts/common/__tests__/common.test.js +42 -46
- package/build/ts/common/__tests__/common.test.js.map +1 -1
- package/build/ts/common/accountAbstraction.d.ts +7 -24
- package/build/ts/common/accountAbstraction.d.ts.map +1 -1
- package/build/ts/common/accountAbstraction.js +20 -49
- package/build/ts/common/accountAbstraction.js.map +1 -1
- package/build/ts/common/chain.d.ts +16 -0
- package/build/ts/common/chain.d.ts.map +1 -0
- package/build/ts/common/chain.js +33 -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 +13 -10
- package/build/ts/common/errors.d.ts.map +1 -1
- package/build/ts/common/errors.js +12 -9
- package/build/ts/common/errors.js.map +1 -1
- package/build/ts/common/index.d.ts +2 -1
- package/build/ts/common/index.d.ts.map +1 -1
- package/build/ts/common/index.js +2 -1
- package/build/ts/common/index.js.map +1 -1
- package/build/ts/common/networks.d.ts +2 -21
- package/build/ts/common/networks.d.ts.map +1 -1
- package/build/ts/common/networks.js +39 -48
- package/build/ts/common/networks.js.map +1 -1
- package/build/ts/common/types.d.ts +2 -3
- package/build/ts/common/types.d.ts.map +1 -1
- package/build/ts/deployer/__tests__/deployer.controller.test.js +23 -25
- package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -1
- package/build/ts/deployer/__tests__/deployer.service.test.js +166 -343
- package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -1
- package/build/ts/deployer/__tests__/utils.d.ts +26 -1
- package/build/ts/deployer/__tests__/utils.d.ts.map +1 -1
- package/build/ts/deployer/__tests__/utils.js +40 -11
- package/build/ts/deployer/__tests__/utils.js.map +1 -1
- package/build/ts/deployer/deployer.service.d.ts +26 -53
- package/build/ts/deployer/deployer.service.d.ts.map +1 -1
- package/build/ts/deployer/deployer.service.js +336 -469
- package/build/ts/deployer/deployer.service.js.map +1 -1
- package/build/ts/deployer/dto.d.ts +7 -7
- package/build/ts/deployer/dto.d.ts.map +1 -1
- package/build/ts/deployer/dto.js +14 -6
- package/build/ts/deployer/dto.js.map +1 -1
- package/build/ts/deployer/types.d.ts +71 -38
- package/build/ts/deployer/types.d.ts.map +1 -1
- package/build/ts/file/__tests__/file.service.test.js +12 -11
- package/build/ts/file/__tests__/file.service.test.js.map +1 -1
- package/build/ts/file/file.service.d.ts +4 -3
- package/build/ts/file/file.service.d.ts.map +1 -1
- package/build/ts/file/file.service.js +16 -10
- package/build/ts/file/file.service.js.map +1 -1
- package/build/ts/file/types.d.ts +2 -2
- package/build/ts/file/types.d.ts.map +1 -1
- package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
- package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
- package/build/ts/health/__tests__/health.controller.test.js +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__/@excubiae/contracts.d.ts +3 -0
- package/build/ts/jest/__mocks__/@excubiae/contracts.d.ts.map +1 -0
- package/build/ts/jest/__mocks__/@excubiae/contracts.js +4 -0
- package/build/ts/jest/__mocks__/@excubiae/contracts.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/proof/__tests__/proof.controller.test.js +6 -5
- package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -1
- package/build/ts/proof/__tests__/proof.gateway.test.js +5 -3
- package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -1
- package/build/ts/proof/__tests__/proof.service.test.js +27 -71
- package/build/ts/proof/__tests__/proof.service.test.js.map +1 -1
- package/build/ts/proof/dto.d.ts +15 -18
- package/build/ts/proof/dto.d.ts.map +1 -1
- package/build/ts/proof/dto.js +55 -49
- package/build/ts/proof/dto.js.map +1 -1
- package/build/ts/proof/proof.controller.d.ts +3 -2
- package/build/ts/proof/proof.controller.d.ts.map +1 -1
- package/build/ts/proof/proof.controller.js +1 -4
- package/build/ts/proof/proof.controller.js.map +1 -1
- package/build/ts/proof/proof.service.d.ts +4 -6
- package/build/ts/proof/proof.service.d.ts.map +1 -1
- package/build/ts/proof/proof.service.js +48 -130
- package/build/ts/proof/proof.service.js.map +1 -1
- package/build/ts/proof/types.d.ts +21 -17
- package/build/ts/proof/types.d.ts.map +1 -1
- package/build/ts/proof/types.js.map +1 -1
- package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
- package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
- package/build/ts/redis/__tests__/redis.service.test.js +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 +52 -0
- package/build/ts/redis/redis.service.d.ts.map +1 -0
- package/build/ts/redis/redis.service.js +97 -0
- package/build/ts/redis/redis.service.js.map +1 -0
- package/build/ts/redis/types.d.ts +53 -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 +264 -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 +111 -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 +23 -0
- package/build/ts/scheduler/scheduler.module.js.map +1 -0
- package/build/ts/scheduler/scheduler.service.d.ts +63 -0
- package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.service.js +239 -0
- package/build/ts/scheduler/scheduler.service.js.map +1 -0
- package/build/ts/scheduler/types.d.ts +61 -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.js +2 -2
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -1
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +34 -19
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -1
- package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -1
- package/build/ts/sessionKeys/__tests__/utils.js +5 -6
- package/build/ts/sessionKeys/__tests__/utils.js.map +1 -1
- 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.service.d.ts +16 -4
- package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -1
- package/build/ts/sessionKeys/sessionKeys.service.js +23 -6
- package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -1
- package/build/ts/subgraph/__tests__/subgraph.controller.test.js +2 -2
- package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -1
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +2 -2
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -1
- package/build/ts/subgraph/__tests__/subgraph.service.test.js +5 -5
- package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -1
- package/build/ts/subgraph/dto.d.ts +2 -2
- package/build/ts/subgraph/dto.d.ts.map +1 -1
- package/build/ts/subgraph/dto.js +3 -3
- package/build/ts/subgraph/dto.js.map +1 -1
- package/build/ts/subgraph/subgraph.service.d.ts +4 -0
- package/build/ts/subgraph/subgraph.service.d.ts.map +1 -1
- package/build/ts/subgraph/subgraph.service.js +19 -7
- package/build/ts/subgraph/subgraph.service.js.map +1 -1
- package/build/ts/subgraph/types.d.ts +2 -2
- package/build/ts/subgraph/types.d.ts.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +45 -37
- package/build/tests/e2e.aa.test.d.ts +0 -2
- package/build/tests/e2e.aa.test.d.ts.map +0 -1
- package/build/tests/e2e.aa.test.js +0 -103
- package/build/tests/e2e.aa.test.js.map +0 -1
- package/build/ts/deployer/utils.d.ts +0 -8
- package/build/ts/deployer/utils.d.ts.map +0 -1
- package/build/ts/deployer/utils.js +0 -9
- package/build/ts/deployer/utils.js.map +0 -1
|
@@ -1,321 +1,162 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContractStorage, deployFreeForAllSignUpPolicy, deployPoll, deployVerifier, deployVerifyingKeysRegistryContract, deployMaci, deployConstantInitialVoiceCreditProxyFactory, deployConstantInitialVoiceCreditProxy, getDeployedPolicyProxyFactories, ECheckerFactories, EContracts, EInitialVoiceCreditProxies, EInitialVoiceCreditProxiesFactories, EPolicies, EPolicyFactories, ESupportedChains, } from "@maci-protocol/sdk";
|
|
2
2
|
import dotenv from "dotenv";
|
|
3
|
-
import { BaseContract, zeroPadBytes } from "ethers";
|
|
4
3
|
import { zeroAddress } from "viem";
|
|
5
|
-
import
|
|
6
|
-
import { ErrorCodes, ESupportedNetworks } from "../../common";
|
|
7
|
-
import { FileService } from "../../file/file.service";
|
|
8
|
-
import { generateApproval } from "../../sessionKeys/__tests__/utils";
|
|
9
|
-
import { SessionKeysService } from "../../sessionKeys/sessionKeys.service";
|
|
4
|
+
import { ErrorCodes } from "../../common";
|
|
10
5
|
import { DeployerService } from "../deployer.service";
|
|
11
|
-
import { estimateExtraGasLimit } from "../utils";
|
|
12
6
|
import { testMaciDeploymentConfig, testPollDeploymentConfig } from "./utils";
|
|
13
7
|
dotenv.config();
|
|
8
|
+
jest.mock("@maci-protocol/sdk", () => ({
|
|
9
|
+
...jest.requireActual("@maci-protocol/sdk"),
|
|
10
|
+
ContractStorage: {
|
|
11
|
+
getInstance: jest.fn(),
|
|
12
|
+
},
|
|
13
|
+
deployFreeForAllSignUpPolicy: jest.fn(),
|
|
14
|
+
deployPoll: jest.fn(),
|
|
15
|
+
deployVerifyingKeysRegistryContract: jest.fn(),
|
|
16
|
+
deployVerifier: jest.fn(),
|
|
17
|
+
getDeployedPolicyProxyFactories: jest.fn(),
|
|
18
|
+
setVerifyingKeys: jest.fn(),
|
|
19
|
+
deployMaci: jest.fn(),
|
|
20
|
+
deployConstantInitialVoiceCreditProxyFactory: jest.fn(),
|
|
21
|
+
deployConstantInitialVoiceCreditProxy: jest.fn(),
|
|
22
|
+
}));
|
|
14
23
|
describe("DeployerService", () => {
|
|
24
|
+
const chain = ESupportedChains.OptimismSepolia;
|
|
25
|
+
const signer = {
|
|
26
|
+
getAddress: jest.fn().mockResolvedValue(zeroAddress),
|
|
27
|
+
};
|
|
28
|
+
const approval = "approval";
|
|
29
|
+
const sessionKeyAddress = zeroAddress;
|
|
30
|
+
const mockStorage = {
|
|
31
|
+
register: jest.fn(),
|
|
32
|
+
getAddress: jest.fn(),
|
|
33
|
+
};
|
|
34
|
+
const mockContract = {
|
|
35
|
+
deploymentTransaction: jest.fn(),
|
|
36
|
+
getAddress: jest.fn().mockResolvedValue(zeroAddress.replace("0x0", "0x1")),
|
|
37
|
+
};
|
|
38
|
+
const fileService = {
|
|
39
|
+
getZkeyFilePaths: jest.fn(),
|
|
40
|
+
};
|
|
41
|
+
const sessionKeyService = {
|
|
42
|
+
getCoordinatorSigner: jest.fn().mockResolvedValue(signer),
|
|
43
|
+
};
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
mockStorage.getAddress = jest.fn().mockReturnValue(zeroAddress);
|
|
46
|
+
sessionKeyService.getCoordinatorSigner = jest.fn().mockResolvedValue(signer);
|
|
47
|
+
fileService.getZkeyFilePaths = jest.fn().mockReturnValue({ zkey: "" });
|
|
48
|
+
ContractStorage.getInstance.mockReturnValue(mockStorage);
|
|
49
|
+
deployFreeForAllSignUpPolicy.mockResolvedValue([
|
|
50
|
+
mockContract,
|
|
51
|
+
mockContract,
|
|
52
|
+
mockContract,
|
|
53
|
+
mockContract,
|
|
54
|
+
]);
|
|
55
|
+
deployVerifier.mockResolvedValue(mockContract);
|
|
56
|
+
deployVerifyingKeysRegistryContract.mockResolvedValue(mockContract);
|
|
57
|
+
deployConstantInitialVoiceCreditProxyFactory.mockResolvedValue(mockContract);
|
|
58
|
+
deployConstantInitialVoiceCreditProxy.mockResolvedValue(mockContract);
|
|
59
|
+
deployPoll.mockResolvedValue({
|
|
60
|
+
pollContractAddress: zeroAddress,
|
|
61
|
+
messageProcessorContractAddress: zeroAddress,
|
|
62
|
+
tallyContractAddress: zeroAddress,
|
|
63
|
+
pollId: 0n,
|
|
64
|
+
});
|
|
65
|
+
deployMaci.mockResolvedValue({
|
|
66
|
+
maciContractAddress: zeroAddress.replace("0x0", "0x1"),
|
|
67
|
+
pollFactoryContractAddress: zeroAddress,
|
|
68
|
+
messageProcessorFactoryContractAddress: zeroAddress,
|
|
69
|
+
tallyFactoryContractAddress: zeroAddress,
|
|
70
|
+
poseidonAddresses: {
|
|
71
|
+
poseidonT3: zeroAddress,
|
|
72
|
+
poseidonT4: zeroAddress,
|
|
73
|
+
poseidonT5: zeroAddress,
|
|
74
|
+
poseidonT6: zeroAddress,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
getDeployedPolicyProxyFactories.mockResolvedValue({ checker: undefined, policy: undefined });
|
|
78
|
+
});
|
|
15
79
|
afterEach(() => {
|
|
16
80
|
jest.clearAllMocks();
|
|
17
81
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
test("should return the voice credit proxy data and that the voice credit proxy is already deployed", async () => {
|
|
40
|
-
await storageInstance.register({
|
|
41
|
-
id: EInitialVoiceCreditProxies.Constant,
|
|
42
|
-
contract: new BaseContract("0x", VoiceCreditProxyFactory.abi),
|
|
82
|
+
describe("deployAndSavePolicy", () => {
|
|
83
|
+
test("should throw when the policy is not existent", async () => {
|
|
84
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
85
|
+
await expect(deployerService.deployAndSavePolicy(signer, chain, { type: "NonExistent" })).rejects.toThrow(ErrorCodes.UNSUPPORTED_POLICY.toString());
|
|
86
|
+
});
|
|
87
|
+
test("should deploy policy if none is stored", async () => {
|
|
88
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
89
|
+
const policy = await deployerService.deployAndSavePolicy(signer, chain, { type: EPolicies.FreeForAll });
|
|
90
|
+
expect(policy).toBeDefined();
|
|
91
|
+
expect(await policy.getAddress()).not.toBe(zeroAddress);
|
|
92
|
+
});
|
|
93
|
+
test("should save factories (policy and checker) after deploying policy", async () => {
|
|
94
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
95
|
+
await deployerService.deployAndSavePolicy(signer, chain, { type: EPolicies.FreeForAll });
|
|
96
|
+
expect(mockStorage.register).toHaveBeenCalledTimes(3);
|
|
97
|
+
expect(mockStorage.register).toHaveBeenNthCalledWith(1, {
|
|
98
|
+
id: EPolicies.FreeForAll,
|
|
99
|
+
name: EPolicies.FreeForAll,
|
|
100
|
+
contract: mockContract,
|
|
101
|
+
args: [],
|
|
43
102
|
network: chain,
|
|
44
|
-
args: ["50"],
|
|
45
|
-
});
|
|
46
|
-
const voiceCreditProxyData = deployerService.getVoiceCreditProxyData(EInitialVoiceCreditProxies.Constant, chain, {
|
|
47
|
-
amount: "50",
|
|
48
|
-
});
|
|
49
|
-
expect(voiceCreditProxyData).toBeDefined();
|
|
50
|
-
expect(voiceCreditProxyData.alreadyDeployed).toBe(true);
|
|
51
|
-
expect(voiceCreditProxyData.abi).toBeDefined();
|
|
52
|
-
expect(voiceCreditProxyData.bytecode).toBeDefined();
|
|
53
|
-
storageInstance.cleanup(chain);
|
|
54
|
-
});
|
|
55
|
-
it("should throw when the voice credits proxy is not existent", () => {
|
|
56
|
-
expect(() => deployerService.getVoiceCreditProxyData("NotExistent", chain, {
|
|
57
|
-
amount: "50",
|
|
58
|
-
})).toThrow(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY.toString());
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe("getPolicyData", () => {
|
|
62
|
-
// we cleanup after each test so we don't have leftover saved contracts
|
|
63
|
-
afterEach(() => {
|
|
64
|
-
storageInstance.cleanup(chain);
|
|
65
|
-
});
|
|
66
|
-
it("should throw when the policy is not existent", () => {
|
|
67
|
-
expect(() => deployerService.getPolicyData("NotExistent", chain)).toThrow(ErrorCodes.UNSUPPORTED_POLICY.toString());
|
|
68
|
-
});
|
|
69
|
-
describe("FreeForAllPolicy", () => {
|
|
70
|
-
it("should return the policy data and that the policy is not deployed", () => {
|
|
71
|
-
const policyData = deployerService.getPolicyData(EPolicies.FreeForAll, chain);
|
|
72
|
-
expect(policyData).toBeDefined();
|
|
73
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
74
|
-
expect(policyData.abi).toBeDefined();
|
|
75
|
-
expect(policyData.bytecode).toBeDefined();
|
|
76
103
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
args: [],
|
|
83
|
-
});
|
|
84
|
-
const policyData = deployerService.getPolicyData(EPolicies.FreeForAll, chain);
|
|
85
|
-
expect(policyData).toBeDefined();
|
|
86
|
-
expect(policyData.alreadyDeployed).toBe(true);
|
|
87
|
-
expect(policyData.abi).toBeDefined();
|
|
88
|
-
expect(policyData.bytecode).toBeDefined();
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
describe("EASPolicy", () => {
|
|
92
|
-
it("should return the policy data and that the policy is not deployed", () => {
|
|
93
|
-
const policyData = deployerService.getPolicyData(EPolicies.EAS, chain);
|
|
94
|
-
expect(policyData).toBeDefined();
|
|
95
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
96
|
-
expect(policyData.abi).toBeDefined();
|
|
97
|
-
expect(policyData.bytecode).toBeDefined();
|
|
98
|
-
});
|
|
99
|
-
it("should return the policy data and that the policy is already deployed", async () => {
|
|
100
|
-
await storageInstance.register({
|
|
101
|
-
id: EPolicies.EAS,
|
|
102
|
-
contract: new BaseContract("0x", EASPolicyFactory.abi),
|
|
103
|
-
network: chain,
|
|
104
|
-
args: [zeroAddress, zeroPadBytes("0x", 32), zeroAddress],
|
|
105
|
-
});
|
|
106
|
-
const policyData = deployerService.getPolicyData(EPolicies.EAS, chain, {
|
|
107
|
-
easAddress: zeroAddress,
|
|
108
|
-
schema: zeroPadBytes("0x", 32),
|
|
109
|
-
attester: zeroAddress,
|
|
110
|
-
});
|
|
111
|
-
expect(policyData).toBeDefined();
|
|
112
|
-
expect(policyData.alreadyDeployed).toBe(true);
|
|
113
|
-
expect(policyData.abi).toBeDefined();
|
|
114
|
-
expect(policyData.bytecode).toBeDefined();
|
|
104
|
+
expect(mockStorage.register).toHaveBeenNthCalledWith(2, {
|
|
105
|
+
id: EPolicyFactories.FreeForAll,
|
|
106
|
+
name: EPolicyFactories.FreeForAll,
|
|
107
|
+
contract: mockContract,
|
|
108
|
+
network: chain,
|
|
115
109
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
args: [zeroAddress, zeroPadBytes("0x", 32), zeroAddress.replace("0x0", "0x1")],
|
|
122
|
-
});
|
|
123
|
-
const policyData = deployerService.getPolicyData(EPolicies.EAS, chain, {
|
|
124
|
-
easAddress: zeroAddress,
|
|
125
|
-
schema: zeroPadBytes("0x", 32),
|
|
126
|
-
attester: zeroAddress,
|
|
127
|
-
});
|
|
128
|
-
expect(policyData).toBeDefined();
|
|
129
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
130
|
-
expect(policyData.abi).toBeDefined();
|
|
131
|
-
expect(policyData.bytecode).toBeDefined();
|
|
110
|
+
expect(mockStorage.register).toHaveBeenNthCalledWith(3, {
|
|
111
|
+
id: ECheckerFactories.FreeForAll,
|
|
112
|
+
name: ECheckerFactories.FreeForAll,
|
|
113
|
+
contract: mockContract,
|
|
114
|
+
network: chain,
|
|
132
115
|
});
|
|
133
116
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
signer2: zeroAddress,
|
|
139
|
-
eventId: "0x",
|
|
140
|
-
zupassVerifier: zeroAddress,
|
|
141
|
-
});
|
|
142
|
-
expect(policyData).toBeDefined();
|
|
143
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
144
|
-
expect(policyData.abi).toBeDefined();
|
|
145
|
-
expect(policyData.bytecode).toBeDefined();
|
|
146
|
-
});
|
|
147
|
-
it("should return the policy data and that the policy is already deployed", async () => {
|
|
148
|
-
await storageInstance.register({
|
|
149
|
-
id: EPolicies.Zupass,
|
|
150
|
-
contract: new BaseContract("0x", ZupassPolicyFactory.abi),
|
|
151
|
-
network: chain,
|
|
152
|
-
args: [zeroAddress, zeroAddress, "0x", zeroAddress],
|
|
153
|
-
});
|
|
154
|
-
const policyData = deployerService.getPolicyData(EPolicies.Zupass, chain, {
|
|
155
|
-
signer1: zeroAddress,
|
|
156
|
-
signer2: zeroAddress,
|
|
157
|
-
eventId: "0x",
|
|
158
|
-
zupassVerifier: zeroAddress,
|
|
159
|
-
});
|
|
160
|
-
expect(policyData).toBeDefined();
|
|
161
|
-
expect(policyData.alreadyDeployed).toBe(true);
|
|
162
|
-
expect(policyData.abi).toBeDefined();
|
|
163
|
-
expect(policyData.bytecode).toBeDefined();
|
|
164
|
-
});
|
|
165
|
-
it("should return that the policy is not deployed when the args are different", async () => {
|
|
166
|
-
await storageInstance.register({
|
|
167
|
-
id: EPolicies.Zupass,
|
|
168
|
-
contract: new BaseContract("0x", ZupassPolicyFactory.abi),
|
|
169
|
-
network: chain,
|
|
170
|
-
args: [zeroAddress, zeroAddress, "0x", zeroAddress.replace("0x0", "0x1")],
|
|
171
|
-
});
|
|
172
|
-
const policyData = deployerService.getPolicyData(EPolicies.Zupass, chain, {
|
|
173
|
-
signer1: zeroAddress,
|
|
174
|
-
signer2: zeroAddress,
|
|
175
|
-
eventId: "0x",
|
|
176
|
-
zupassVerifier: zeroAddress,
|
|
177
|
-
});
|
|
178
|
-
expect(policyData).toBeDefined();
|
|
179
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
180
|
-
expect(policyData.abi).toBeDefined();
|
|
181
|
-
expect(policyData.bytecode).toBeDefined();
|
|
117
|
+
test("should reuse policy factories if already stored", async () => {
|
|
118
|
+
getDeployedPolicyProxyFactories.mockResolvedValue({
|
|
119
|
+
checker: mockContract,
|
|
120
|
+
policy: mockContract,
|
|
182
121
|
});
|
|
122
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
123
|
+
await deployerService.deployAndSavePolicy(signer, chain, { type: EPolicies.FreeForAll });
|
|
124
|
+
await deployerService.deployAndSavePolicy(signer, chain, { type: EPolicies.FreeForAll });
|
|
125
|
+
expect(mockStorage.register).toHaveBeenCalledTimes(2);
|
|
183
126
|
});
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
});
|
|
190
|
-
expect(policyData).toBeDefined();
|
|
191
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
192
|
-
expect(policyData.abi).toBeDefined();
|
|
193
|
-
expect(policyData.bytecode).toBeDefined();
|
|
194
|
-
});
|
|
195
|
-
it("should return the policy data and that the policy is already deployed", async () => {
|
|
196
|
-
await storageInstance.register({
|
|
197
|
-
id: EPolicies.Semaphore,
|
|
198
|
-
contract: new BaseContract("0x", SemaphorePolicyFactory.abi),
|
|
199
|
-
network: chain,
|
|
200
|
-
args: [zeroAddress, "0"],
|
|
201
|
-
});
|
|
202
|
-
const policyData = deployerService.getPolicyData(EPolicies.Semaphore, chain, {
|
|
203
|
-
semaphoreContract: zeroAddress,
|
|
204
|
-
groupId: "0",
|
|
205
|
-
});
|
|
206
|
-
expect(policyData).toBeDefined();
|
|
207
|
-
expect(policyData.alreadyDeployed).toBe(true);
|
|
208
|
-
expect(policyData.abi).toBeDefined();
|
|
209
|
-
expect(policyData.bytecode).toBeDefined();
|
|
210
|
-
});
|
|
211
|
-
it("should return that the policy is not deployed when the args are different", async () => {
|
|
212
|
-
await storageInstance.register({
|
|
213
|
-
id: EPolicies.Semaphore,
|
|
214
|
-
contract: new BaseContract("0x", SemaphorePolicyFactory.abi),
|
|
215
|
-
network: chain,
|
|
216
|
-
args: [zeroAddress, "0"],
|
|
217
|
-
});
|
|
218
|
-
const policyData = deployerService.getPolicyData(EPolicies.Semaphore, chain, {
|
|
219
|
-
semaphoreContract: zeroAddress,
|
|
220
|
-
groupId: "1",
|
|
221
|
-
});
|
|
222
|
-
expect(policyData).toBeDefined();
|
|
223
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
224
|
-
expect(policyData.abi).toBeDefined();
|
|
225
|
-
expect(policyData.bytecode).toBeDefined();
|
|
226
|
-
});
|
|
127
|
+
});
|
|
128
|
+
describe("deployAndSaveVoiceCreditProxyFactory", () => {
|
|
129
|
+
test("should throw when the voice credit proxy factory is not existent", async () => {
|
|
130
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
131
|
+
await expect(deployerService.deployAndSaveVoiceCreditProxyFactory(signer, "NonExistent", chain)).rejects.toThrow(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY.toString());
|
|
227
132
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
});
|
|
234
|
-
expect(policyData).toBeDefined();
|
|
235
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
236
|
-
expect(policyData.abi).toBeDefined();
|
|
237
|
-
expect(policyData.bytecode).toBeDefined();
|
|
238
|
-
});
|
|
239
|
-
it("should return the policy data and that the policy is already deployed", async () => {
|
|
240
|
-
await storageInstance.register({
|
|
241
|
-
id: EPolicies.Hats,
|
|
242
|
-
contract: new BaseContract("0x", HatsPolicyFactory.abi),
|
|
243
|
-
network: chain,
|
|
244
|
-
args: [zeroAddress, [zeroAddress]],
|
|
245
|
-
});
|
|
246
|
-
const policyData = deployerService.getPolicyData(EPolicies.Hats, chain, {
|
|
247
|
-
hatsProtocolAddress: zeroAddress,
|
|
248
|
-
critrionHats: [zeroAddress],
|
|
249
|
-
});
|
|
250
|
-
expect(policyData).toBeDefined();
|
|
251
|
-
expect(policyData.alreadyDeployed).toBe(true);
|
|
252
|
-
expect(policyData.abi).toBeDefined();
|
|
253
|
-
expect(policyData.bytecode).toBeDefined();
|
|
254
|
-
});
|
|
255
|
-
it("should return that the policy is not deployed when the args are different", async () => {
|
|
256
|
-
await storageInstance.register({
|
|
257
|
-
id: EPolicies.Hats,
|
|
258
|
-
contract: new BaseContract("0x", HatsPolicyFactory.abi),
|
|
259
|
-
network: chain,
|
|
260
|
-
args: [zeroAddress, ["0x"]],
|
|
261
|
-
});
|
|
262
|
-
const policyData = deployerService.getPolicyData(EPolicies.Hats, chain, {
|
|
263
|
-
hatsProtocolAddress: zeroAddress,
|
|
264
|
-
critrionHats: ["0x1"],
|
|
265
|
-
});
|
|
266
|
-
expect(policyData).toBeDefined();
|
|
267
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
268
|
-
expect(policyData.abi).toBeDefined();
|
|
269
|
-
expect(policyData.bytecode).toBeDefined();
|
|
270
|
-
});
|
|
133
|
+
test("should deploy voice credit proxy factory if none is stored", async () => {
|
|
134
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
135
|
+
const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
|
|
136
|
+
expect(constantInitialVoiceCreditProxyFactory).toBeDefined();
|
|
137
|
+
expect(await constantInitialVoiceCreditProxyFactory.getAddress()).not.toBe(zeroAddress);
|
|
271
138
|
});
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
id: EPolicies.GitcoinPassport,
|
|
286
|
-
contract: new BaseContract("0x", GitcoinPassportPolicyFactory.abi),
|
|
287
|
-
network: chain,
|
|
288
|
-
args: [zeroAddress, "0"],
|
|
289
|
-
});
|
|
290
|
-
const policyData = deployerService.getPolicyData(EPolicies.GitcoinPassport, chain, {
|
|
291
|
-
decoderAddress: zeroAddress,
|
|
292
|
-
passingScore: "0",
|
|
293
|
-
});
|
|
294
|
-
expect(policyData).toBeDefined();
|
|
295
|
-
expect(policyData.alreadyDeployed).toBe(true);
|
|
296
|
-
expect(policyData.abi).toBeDefined();
|
|
297
|
-
expect(policyData.bytecode).toBeDefined();
|
|
298
|
-
});
|
|
299
|
-
it("should return that the policy is not deployed when the args are different", async () => {
|
|
300
|
-
await storageInstance.register({
|
|
301
|
-
id: EPolicies.GitcoinPassport,
|
|
302
|
-
contract: new BaseContract("0x", GitcoinPassportPolicyFactory.abi),
|
|
303
|
-
network: chain,
|
|
304
|
-
args: [zeroAddress, "0"],
|
|
305
|
-
});
|
|
306
|
-
const policyData = deployerService.getPolicyData(EPolicies.GitcoinPassport, chain, {
|
|
307
|
-
decoderAddress: zeroAddress,
|
|
308
|
-
passingScore: "1",
|
|
309
|
-
});
|
|
310
|
-
expect(policyData).toBeDefined();
|
|
311
|
-
expect(policyData.alreadyDeployed).toBe(false);
|
|
312
|
-
expect(policyData.abi).toBeDefined();
|
|
313
|
-
expect(policyData.bytecode).toBeDefined();
|
|
314
|
-
});
|
|
139
|
+
});
|
|
140
|
+
describe("deployAndSaveVoiceCreditProxy", () => {
|
|
141
|
+
test("should throw when the voice credit proxy is not existent", async () => {
|
|
142
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
143
|
+
const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
|
|
144
|
+
await expect(deployerService.deployAndSaveVoiceCreditProxy(signer, "NonExistent", chain, constantInitialVoiceCreditProxyFactory)).rejects.toThrow(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY.toString());
|
|
145
|
+
});
|
|
146
|
+
test("should deploy voice credit proxy if none is stored", async () => {
|
|
147
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
148
|
+
const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
|
|
149
|
+
const voiceCreditProxy = await deployerService.deployAndSaveVoiceCreditProxy(signer, EInitialVoiceCreditProxies.Constant, chain, constantInitialVoiceCreditProxyFactory, { amount: 100 });
|
|
150
|
+
expect(voiceCreditProxy).toBeDefined();
|
|
151
|
+
expect(await voiceCreditProxy.getAddress()).not.toBe(zeroAddress);
|
|
315
152
|
});
|
|
316
153
|
});
|
|
317
154
|
describe("deployMaci", () => {
|
|
318
155
|
test("should throw when passing a non existent session key address", async () => {
|
|
156
|
+
sessionKeyService.getCoordinatorSigner = jest
|
|
157
|
+
.fn()
|
|
158
|
+
.mockRejectedValue(new Error(ErrorCodes.SESSION_KEY_NOT_FOUND.toString()));
|
|
159
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
319
160
|
await expect(deployerService.deployMaci({
|
|
320
161
|
config: testMaciDeploymentConfig,
|
|
321
162
|
chain,
|
|
@@ -324,44 +165,37 @@ describe("DeployerService", () => {
|
|
|
324
165
|
})).rejects.toThrow(ErrorCodes.SESSION_KEY_NOT_FOUND.toString());
|
|
325
166
|
});
|
|
326
167
|
test("should throw when the approval is not valid", async () => {
|
|
168
|
+
sessionKeyService.getCoordinatorSigner = jest
|
|
169
|
+
.fn()
|
|
170
|
+
.mockRejectedValue(new Error(ErrorCodes.INVALID_APPROVAL.toString()));
|
|
171
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
327
172
|
await expect(deployerService.deployMaci({
|
|
328
173
|
config: testMaciDeploymentConfig,
|
|
329
174
|
chain,
|
|
330
|
-
approval: "
|
|
175
|
+
approval: "0x123",
|
|
331
176
|
sessionKeyAddress,
|
|
332
177
|
})).rejects.toThrow(ErrorCodes.INVALID_APPROVAL.toString());
|
|
333
178
|
});
|
|
334
179
|
test("should deploy all new contracts", async () => {
|
|
335
|
-
const
|
|
336
|
-
jest.spyOn(DeployerService.prototype, "deployMaci").mockImplementation(mockDeployMaci);
|
|
180
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
337
181
|
const { address: maciAddress } = await deployerService.deployMaci({
|
|
338
182
|
config: testMaciDeploymentConfig,
|
|
339
183
|
chain,
|
|
340
184
|
approval,
|
|
341
185
|
sessionKeyAddress,
|
|
342
186
|
});
|
|
343
|
-
expect(maciAddress).toBe(zeroAddress);
|
|
187
|
+
expect(maciAddress).toBe(zeroAddress.replace("0x0", "0x1"));
|
|
344
188
|
});
|
|
345
189
|
});
|
|
346
190
|
describe("deployPoll", () => {
|
|
347
|
-
afterEach(() => {
|
|
348
|
-
storageInstance.cleanup(chain);
|
|
349
|
-
});
|
|
350
191
|
test("should throw when there is no maci contract deployed", async () => {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
})).rejects.toThrow(ErrorCodes.MACI_NOT_DEPLOYED.toString());
|
|
357
|
-
});
|
|
358
|
-
test("should throw when there is no maci contract deployed to this specific chain", async () => {
|
|
359
|
-
await storageInstance.register({
|
|
360
|
-
id: EContracts.MACI,
|
|
361
|
-
contract: new BaseContract("0x", MACIFactory.abi),
|
|
362
|
-
network: ESupportedNetworks.ARBITRUM_ONE,
|
|
363
|
-
args: [],
|
|
192
|
+
ContractStorage.getInstance.mockReturnValue({
|
|
193
|
+
...mockStorage,
|
|
194
|
+
getAddress: jest
|
|
195
|
+
.fn()
|
|
196
|
+
.mockImplementation((key) => (key !== EContracts.MACI ? zeroAddress : undefined)),
|
|
364
197
|
});
|
|
198
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
365
199
|
await expect(deployerService.deployPoll({
|
|
366
200
|
approval,
|
|
367
201
|
sessionKeyAddress,
|
|
@@ -369,13 +203,14 @@ describe("DeployerService", () => {
|
|
|
369
203
|
config: testPollDeploymentConfig,
|
|
370
204
|
})).rejects.toThrow(ErrorCodes.MACI_NOT_DEPLOYED.toString());
|
|
371
205
|
});
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
206
|
+
test("should throw when there is no verifier deployed", async () => {
|
|
207
|
+
ContractStorage.getInstance.mockReturnValue({
|
|
208
|
+
...mockStorage,
|
|
209
|
+
getAddress: jest
|
|
210
|
+
.fn()
|
|
211
|
+
.mockImplementation((key) => (key !== EContracts.Verifier ? zeroAddress : undefined)),
|
|
378
212
|
});
|
|
213
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
379
214
|
await expect(deployerService.deployPoll({
|
|
380
215
|
approval,
|
|
381
216
|
sessionKeyAddress,
|
|
@@ -383,29 +218,23 @@ describe("DeployerService", () => {
|
|
|
383
218
|
config: testPollDeploymentConfig,
|
|
384
219
|
})).rejects.toThrow(ErrorCodes.VERIFIER_NOT_DEPLOYED.toString());
|
|
385
220
|
});
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
});
|
|
393
|
-
await storageInstance.register({
|
|
394
|
-
id: EContracts.Verifier,
|
|
395
|
-
contract: new BaseContract("0x", VerifierFactory.abi),
|
|
396
|
-
network: chain,
|
|
397
|
-
args: [],
|
|
221
|
+
test("should throw when there is no verifying keys registry deployed", async () => {
|
|
222
|
+
ContractStorage.getInstance.mockReturnValue({
|
|
223
|
+
...mockStorage,
|
|
224
|
+
getAddress: jest
|
|
225
|
+
.fn()
|
|
226
|
+
.mockImplementation((key) => key !== EContracts.VerifyingKeysRegistry ? zeroAddress : undefined),
|
|
398
227
|
});
|
|
228
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
399
229
|
await expect(deployerService.deployPoll({
|
|
400
230
|
approval,
|
|
401
231
|
sessionKeyAddress,
|
|
402
232
|
chain,
|
|
403
233
|
config: testPollDeploymentConfig,
|
|
404
|
-
})).rejects.toThrow(ErrorCodes.
|
|
234
|
+
})).rejects.toThrow(ErrorCodes.VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED.toString());
|
|
405
235
|
});
|
|
406
236
|
test("should deploy a poll", async () => {
|
|
407
|
-
const
|
|
408
|
-
jest.spyOn(DeployerService.prototype, "deployPoll").mockImplementation(mockDeployPoll);
|
|
237
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
409
238
|
const { pollId } = await deployerService.deployPoll({
|
|
410
239
|
config: testPollDeploymentConfig,
|
|
411
240
|
chain,
|
|
@@ -415,11 +244,5 @@ describe("DeployerService", () => {
|
|
|
415
244
|
expect(pollId).toBe("0");
|
|
416
245
|
});
|
|
417
246
|
});
|
|
418
|
-
describe("estimateExtraGasLimit", () => {
|
|
419
|
-
it("should return the extra gas limit", () => {
|
|
420
|
-
const extraGasLimit = estimateExtraGasLimit(100n);
|
|
421
|
-
expect(extraGasLimit.toString()).toBe("5");
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
247
|
});
|
|
425
248
|
//# sourceMappingURL=deployer.service.test.js.map
|