@maci-protocol/coordinator 0.0.0-ci.35d370f → 0.0.0-ci.35e2fb7

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.
Files changed (194) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +31 -6
  3. package/build/hardhat.config.cjs +3 -0
  4. package/build/hardhat.config.cjs.map +1 -1
  5. package/build/hardhat.config.d.cts +3 -0
  6. package/build/scripts/generateKeypair.js +2 -2
  7. package/build/scripts/generateKeypair.js.map +1 -1
  8. package/build/scripts/generateMaciKeyPair.js +2 -2
  9. package/build/scripts/generateMaciKeyPair.js.map +1 -1
  10. package/build/tests/constants.d.ts +0 -1
  11. package/build/tests/constants.d.ts.map +1 -1
  12. package/build/tests/constants.js +0 -1
  13. package/build/tests/constants.js.map +1 -1
  14. package/build/tests/e2e.deploy.test.js +145 -89
  15. package/build/tests/e2e.deploy.test.js.map +1 -1
  16. package/build/tests/e2e.redis.test.d.ts +2 -0
  17. package/build/tests/e2e.redis.test.d.ts.map +1 -0
  18. package/build/tests/e2e.redis.test.js +119 -0
  19. package/build/tests/e2e.redis.test.js.map +1 -0
  20. package/build/tests/utils.d.ts +6 -0
  21. package/build/tests/utils.d.ts.map +1 -1
  22. package/build/tests/utils.js +12 -3
  23. package/build/tests/utils.js.map +1 -1
  24. package/build/ts/app.module.d.ts.map +1 -1
  25. package/build/ts/app.module.js +6 -0
  26. package/build/ts/app.module.js.map +1 -1
  27. package/build/ts/common/__tests__/common.test.js +7 -21
  28. package/build/ts/common/__tests__/common.test.js.map +1 -1
  29. package/build/ts/common/accountAbstraction.d.ts +2 -19
  30. package/build/ts/common/accountAbstraction.d.ts.map +1 -1
  31. package/build/ts/common/accountAbstraction.js +15 -44
  32. package/build/ts/common/accountAbstraction.js.map +1 -1
  33. package/build/ts/common/chain.d.ts +16 -0
  34. package/build/ts/common/chain.d.ts.map +1 -0
  35. package/build/ts/common/chain.js +33 -0
  36. package/build/ts/common/chain.js.map +1 -0
  37. package/build/ts/common/coordinatorKeypair.d.ts +7 -0
  38. package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
  39. package/build/ts/common/coordinatorKeypair.js +14 -0
  40. package/build/ts/common/coordinatorKeypair.js.map +1 -0
  41. package/build/ts/common/errors.d.ts +13 -10
  42. package/build/ts/common/errors.d.ts.map +1 -1
  43. package/build/ts/common/errors.js +12 -9
  44. package/build/ts/common/errors.js.map +1 -1
  45. package/build/ts/common/index.d.ts +2 -0
  46. package/build/ts/common/index.d.ts.map +1 -1
  47. package/build/ts/common/index.js +2 -0
  48. package/build/ts/common/index.js.map +1 -1
  49. package/build/ts/common/types.d.ts +2 -3
  50. package/build/ts/common/types.d.ts.map +1 -1
  51. package/build/ts/deployer/__tests__/deployer.controller.test.js +7 -7
  52. package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -1
  53. package/build/ts/deployer/__tests__/deployer.service.test.js +87 -286
  54. package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -1
  55. package/build/ts/deployer/__tests__/utils.d.ts +26 -1
  56. package/build/ts/deployer/__tests__/utils.d.ts.map +1 -1
  57. package/build/ts/deployer/__tests__/utils.js +40 -11
  58. package/build/ts/deployer/__tests__/utils.js.map +1 -1
  59. package/build/ts/deployer/deployer.service.d.ts +27 -53
  60. package/build/ts/deployer/deployer.service.d.ts.map +1 -1
  61. package/build/ts/deployer/deployer.service.js +335 -468
  62. package/build/ts/deployer/deployer.service.js.map +1 -1
  63. package/build/ts/deployer/dto.d.ts +4 -4
  64. package/build/ts/deployer/dto.d.ts.map +1 -1
  65. package/build/ts/deployer/dto.js +9 -1
  66. package/build/ts/deployer/dto.js.map +1 -1
  67. package/build/ts/deployer/types.d.ts +69 -35
  68. package/build/ts/deployer/types.d.ts.map +1 -1
  69. package/build/ts/file/__tests__/file.service.test.js +12 -11
  70. package/build/ts/file/__tests__/file.service.test.js.map +1 -1
  71. package/build/ts/file/file.service.d.ts +4 -3
  72. package/build/ts/file/file.service.d.ts.map +1 -1
  73. package/build/ts/file/file.service.js +16 -10
  74. package/build/ts/file/file.service.js.map +1 -1
  75. package/build/ts/file/types.d.ts +2 -2
  76. package/build/ts/file/types.d.ts.map +1 -1
  77. package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
  78. package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
  79. package/build/ts/health/__tests__/health.controller.test.js +28 -0
  80. package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
  81. package/build/ts/health/__tests__/health.service.test.d.ts +2 -0
  82. package/build/ts/health/__tests__/health.service.test.d.ts.map +1 -0
  83. package/build/ts/health/__tests__/health.service.test.js +88 -0
  84. package/build/ts/health/__tests__/health.service.test.js.map +1 -0
  85. package/build/ts/health/health.controller.d.ts +16 -0
  86. package/build/ts/health/health.controller.d.ts.map +1 -0
  87. package/build/ts/health/health.controller.js +43 -0
  88. package/build/ts/health/health.controller.js.map +1 -0
  89. package/build/ts/health/health.module.d.ts +3 -0
  90. package/build/ts/health/health.module.d.ts.map +1 -0
  91. package/build/ts/health/health.module.js +22 -0
  92. package/build/ts/health/health.module.js.map +1 -0
  93. package/build/ts/health/health.service.d.ts +42 -0
  94. package/build/ts/health/health.service.d.ts.map +1 -0
  95. package/build/ts/health/health.service.js +182 -0
  96. package/build/ts/health/health.service.js.map +1 -0
  97. package/build/ts/health/types.d.ts +83 -0
  98. package/build/ts/health/types.d.ts.map +1 -0
  99. package/build/ts/health/types.js +2 -0
  100. package/build/ts/health/types.js.map +1 -0
  101. package/build/ts/proof/__tests__/proof.controller.test.js +5 -3
  102. package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -1
  103. package/build/ts/proof/__tests__/proof.gateway.test.js +6 -3
  104. package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -1
  105. package/build/ts/proof/__tests__/proof.service.test.js +33 -72
  106. package/build/ts/proof/__tests__/proof.service.test.js.map +1 -1
  107. package/build/ts/proof/dto.d.ts +13 -15
  108. package/build/ts/proof/dto.d.ts.map +1 -1
  109. package/build/ts/proof/dto.js +51 -44
  110. package/build/ts/proof/dto.js.map +1 -1
  111. package/build/ts/proof/proof.controller.d.ts +3 -2
  112. package/build/ts/proof/proof.controller.d.ts.map +1 -1
  113. package/build/ts/proof/proof.controller.js +1 -4
  114. package/build/ts/proof/proof.controller.js.map +1 -1
  115. package/build/ts/proof/proof.service.d.ts +4 -6
  116. package/build/ts/proof/proof.service.d.ts.map +1 -1
  117. package/build/ts/proof/proof.service.js +48 -130
  118. package/build/ts/proof/proof.service.js.map +1 -1
  119. package/build/ts/proof/types.d.ts +19 -14
  120. package/build/ts/proof/types.d.ts.map +1 -1
  121. package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
  122. package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
  123. package/build/ts/redis/__tests__/redis.service.test.js +149 -0
  124. package/build/ts/redis/__tests__/redis.service.test.js.map +1 -0
  125. package/build/ts/redis/redis.module.d.ts +3 -0
  126. package/build/ts/redis/redis.module.d.ts.map +1 -0
  127. package/build/ts/redis/redis.module.js +18 -0
  128. package/build/ts/redis/redis.module.js.map +1 -0
  129. package/build/ts/redis/redis.service.d.ts +52 -0
  130. package/build/ts/redis/redis.service.d.ts.map +1 -0
  131. package/build/ts/redis/redis.service.js +97 -0
  132. package/build/ts/redis/redis.service.js.map +1 -0
  133. package/build/ts/redis/types.d.ts +54 -0
  134. package/build/ts/redis/types.d.ts.map +1 -0
  135. package/build/ts/redis/types.js +2 -0
  136. package/build/ts/redis/types.js.map +1 -0
  137. package/build/ts/redis/utils.d.ts +20 -0
  138. package/build/ts/redis/utils.d.ts.map +1 -0
  139. package/build/ts/redis/utils.js +27 -0
  140. package/build/ts/redis/utils.js.map +1 -0
  141. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts +2 -0
  142. package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts.map +1 -0
  143. package/build/ts/scheduler/__tests__/scheduler.controller.test.js +63 -0
  144. package/build/ts/scheduler/__tests__/scheduler.controller.test.js.map +1 -0
  145. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts +2 -0
  146. package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts.map +1 -0
  147. package/build/ts/scheduler/__tests__/scheduler.service.test.js +264 -0
  148. package/build/ts/scheduler/__tests__/scheduler.service.test.js.map +1 -0
  149. package/build/ts/scheduler/dto.d.ts +42 -0
  150. package/build/ts/scheduler/dto.d.ts.map +1 -0
  151. package/build/ts/scheduler/dto.js +116 -0
  152. package/build/ts/scheduler/dto.js.map +1 -0
  153. package/build/ts/scheduler/scheduler.controller.d.ts +32 -0
  154. package/build/ts/scheduler/scheduler.controller.d.ts.map +1 -0
  155. package/build/ts/scheduler/scheduler.controller.js +111 -0
  156. package/build/ts/scheduler/scheduler.controller.js.map +1 -0
  157. package/build/ts/scheduler/scheduler.module.d.ts +3 -0
  158. package/build/ts/scheduler/scheduler.module.d.ts.map +1 -0
  159. package/build/ts/scheduler/scheduler.module.js +23 -0
  160. package/build/ts/scheduler/scheduler.module.js.map +1 -0
  161. package/build/ts/scheduler/scheduler.service.d.ts +63 -0
  162. package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
  163. package/build/ts/scheduler/scheduler.service.js +239 -0
  164. package/build/ts/scheduler/scheduler.service.js.map +1 -0
  165. package/build/ts/scheduler/types.d.ts +61 -0
  166. package/build/ts/scheduler/types.d.ts.map +1 -0
  167. package/build/ts/scheduler/types.js +2 -0
  168. package/build/ts/scheduler/types.js.map +1 -0
  169. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +2 -2
  170. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -1
  171. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
  172. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
  173. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
  174. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
  175. package/build/ts/sessionKeys/sessionKeys.service.d.ts +13 -2
  176. package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -1
  177. package/build/ts/sessionKeys/sessionKeys.service.js +22 -4
  178. package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -1
  179. package/build/ts/subgraph/__tests__/subgraph.service.test.js +2 -3
  180. package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -1
  181. package/build/ts/subgraph/subgraph.service.d.ts +4 -0
  182. package/build/ts/subgraph/subgraph.service.d.ts.map +1 -1
  183. package/build/ts/subgraph/subgraph.service.js +16 -5
  184. package/build/ts/subgraph/subgraph.service.js.map +1 -1
  185. package/build/tsconfig.build.tsbuildinfo +1 -1
  186. package/package.json +38 -36
  187. package/build/tests/e2e.aa.test.d.ts +0 -2
  188. package/build/tests/e2e.aa.test.d.ts.map +0 -1
  189. package/build/tests/e2e.aa.test.js +0 -103
  190. package/build/tests/e2e.aa.test.js.map +0 -1
  191. package/build/ts/deployer/utils.d.ts +0 -8
  192. package/build/ts/deployer/utils.d.ts.map +0 -1
  193. package/build/ts/deployer/utils.js +0 -9
  194. package/build/ts/deployer/utils.js.map +0 -1
@@ -12,23 +12,26 @@ export var ErrorCodes;
12
12
  ErrorCodes[ErrorCodes["SUBGRAPH_DEPLOY"] = 6] = "SUBGRAPH_DEPLOY";
13
13
  ErrorCodes[ErrorCodes["SUBGRAPH_DEPLOY_KEY_NOT_FOUND"] = 7] = "SUBGRAPH_DEPLOY_KEY_NOT_FOUND";
14
14
  ErrorCodes[ErrorCodes["SESSION_KEY_NOT_FOUND"] = 8] = "SESSION_KEY_NOT_FOUND";
15
- ErrorCodes[ErrorCodes["PIMLICO_API_KEY_NOT_SET"] = 9] = "PIMLICO_API_KEY_NOT_SET";
16
- ErrorCodes[ErrorCodes["INVALID_APPROVAL"] = 10] = "INVALID_APPROVAL";
17
- ErrorCodes[ErrorCodes["UNSUPPORTED_NETWORK"] = 11] = "UNSUPPORTED_NETWORK";
18
- ErrorCodes[ErrorCodes["RPC_API_KEY_NOT_SET"] = 12] = "RPC_API_KEY_NOT_SET";
19
- ErrorCodes[ErrorCodes["FAILED_TO_MERGE_STATE_TREE"] = 13] = "FAILED_TO_MERGE_STATE_TREE";
20
- ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_SUBTREES"] = 14] = "FAILED_TO_MERGE_MESSAGE_SUBTREES";
21
- ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_TREE"] = 15] = "FAILED_TO_MERGE_MESSAGE_TREE";
15
+ ErrorCodes[ErrorCodes["INVALID_APPROVAL"] = 9] = "INVALID_APPROVAL";
16
+ ErrorCodes[ErrorCodes["UNSUPPORTED_NETWORK"] = 10] = "UNSUPPORTED_NETWORK";
17
+ ErrorCodes[ErrorCodes["COORDINATOR_RPC_URL_NOT_SET"] = 11] = "COORDINATOR_RPC_URL_NOT_SET";
18
+ ErrorCodes[ErrorCodes["FAILED_TO_MERGE_STATE_TREE"] = 12] = "FAILED_TO_MERGE_STATE_TREE";
19
+ ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_SUBTREES"] = 13] = "FAILED_TO_MERGE_MESSAGE_SUBTREES";
20
+ ErrorCodes[ErrorCodes["FAILED_TO_MERGE_MESSAGE_TREE"] = 14] = "FAILED_TO_MERGE_MESSAGE_TREE";
21
+ ErrorCodes[ErrorCodes["UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY"] = 15] = "UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY";
22
22
  ErrorCodes[ErrorCodes["UNSUPPORTED_VOICE_CREDIT_PROXY"] = 16] = "UNSUPPORTED_VOICE_CREDIT_PROXY";
23
23
  ErrorCodes[ErrorCodes["UNSUPPORTED_POLICY"] = 17] = "UNSUPPORTED_POLICY";
24
24
  ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_CONTRACT"] = 18] = "FAILED_TO_DEPLOY_CONTRACT";
25
25
  ErrorCodes[ErrorCodes["FAILED_TO_SET_MACI_INSTANCE_ON_POLICY"] = 19] = "FAILED_TO_SET_MACI_INSTANCE_ON_POLICY";
26
26
  ErrorCodes[ErrorCodes["MACI_NOT_DEPLOYED"] = 20] = "MACI_NOT_DEPLOYED";
27
27
  ErrorCodes[ErrorCodes["VERIFIER_NOT_DEPLOYED"] = 21] = "VERIFIER_NOT_DEPLOYED";
28
- ErrorCodes[ErrorCodes["VK_REGISTRY_NOT_DEPLOYED"] = 22] = "VK_REGISTRY_NOT_DEPLOYED";
29
- ErrorCodes[ErrorCodes["FAILED_TO_SET_VERIFYING_KEYS_ON_VK_REGISTRY"] = 23] = "FAILED_TO_SET_VERIFYING_KEYS_ON_VK_REGISTRY";
28
+ ErrorCodes[ErrorCodes["VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED"] = 22] = "VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED";
29
+ ErrorCodes[ErrorCodes["FAILED_TO_SET_VERIFYING_KEYS"] = 23] = "FAILED_TO_SET_VERIFYING_KEYS";
30
30
  ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_MACI"] = 24] = "FAILED_TO_DEPLOY_MACI";
31
31
  ErrorCodes[ErrorCodes["FAILED_TO_DEPLOY_POLL"] = 25] = "FAILED_TO_DEPLOY_POLL";
32
32
  ErrorCodes[ErrorCodes["NOT_MERGED_MESSAGE_TREE"] = 26] = "NOT_MERGED_MESSAGE_TREE";
33
+ ErrorCodes[ErrorCodes["FAILED_TO_UPDATE_SCHEDULED_POLL"] = 27] = "FAILED_TO_UPDATE_SCHEDULED_POLL";
34
+ ErrorCodes[ErrorCodes["POLL_ALREADY_SCHEDULED"] = 28] = "POLL_ALREADY_SCHEDULED";
35
+ ErrorCodes[ErrorCodes["POLL_ALREADY_TALLIED"] = 29] = "POLL_ALREADY_TALLIED";
33
36
  })(ErrorCodes || (ErrorCodes = {}));
34
37
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../ts/common/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UA4BX;AA5BD,WAAY,UAAU;IACpB,6EAAqB,CAAA;IACrB,2EAAoB,CAAA;IACpB,+DAAc,CAAA;IACd,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,+DAAc,CAAA;IACd,iEAAe,CAAA;IACf,6FAA6B,CAAA;IAC7B,6EAAqB,CAAA;IACrB,iFAAuB,CAAA;IACvB,oEAAgB,CAAA;IAChB,0EAAmB,CAAA;IACnB,0EAAmB,CAAA;IACnB,wFAA0B,CAAA;IAC1B,oGAAgC,CAAA;IAChC,4FAA4B,CAAA;IAC5B,gGAA8B,CAAA;IAC9B,wEAAkB,CAAA;IAClB,sFAAyB,CAAA;IACzB,8GAAqC,CAAA;IACrC,sEAAiB,CAAA;IACjB,8EAAqB,CAAA;IACrB,oFAAwB,CAAA;IACxB,0HAA2C,CAAA;IAC3C,8EAAqB,CAAA;IACrB,8EAAqB,CAAA;IACrB,kFAAuB,CAAA;AACzB,CAAC,EA5BW,UAAU,KAAV,UAAU,QA4BrB"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../ts/common/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UA+BX;AA/BD,WAAY,UAAU;IACpB,6EAAqB,CAAA;IACrB,2EAAoB,CAAA;IACpB,+DAAc,CAAA;IACd,uDAAU,CAAA;IACV,uDAAU,CAAA;IACV,+DAAc,CAAA;IACd,iEAAe,CAAA;IACf,6FAA6B,CAAA;IAC7B,6EAAqB,CAAA;IACrB,mEAAgB,CAAA;IAChB,0EAAmB,CAAA;IACnB,0FAA2B,CAAA;IAC3B,wFAA0B,CAAA;IAC1B,oGAAgC,CAAA;IAChC,4FAA4B,CAAA;IAC5B,gHAAsC,CAAA;IACtC,gGAA8B,CAAA;IAC9B,wEAAkB,CAAA;IAClB,sFAAyB,CAAA;IACzB,8GAAqC,CAAA;IACrC,sEAAiB,CAAA;IACjB,8EAAqB,CAAA;IACrB,4GAAoC,CAAA;IACpC,4FAA4B,CAAA;IAC5B,8EAAqB,CAAA;IACrB,8EAAqB,CAAA;IACrB,kFAAuB,CAAA;IACvB,kGAA+B,CAAA;IAC/B,gFAAsB,CAAA;IACtB,4EAAoB,CAAA;AACtB,CAAC,EA/BW,UAAU,KAAV,UAAU,QA+BrB"}
@@ -1,4 +1,6 @@
1
1
  export { ErrorCodes } from "./errors";
2
2
  export { ESupportedNetworks } from "./networks";
3
+ export * from "./chain";
4
+ export * from "./accountAbstraction";
3
5
  export * from "./types";
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export { ErrorCodes } from "./errors";
2
2
  export { ESupportedNetworks } from "./networks";
3
+ export * from "./chain";
4
+ export * from "./accountAbstraction";
3
5
  export * from "./types";
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import { CreateKernelAccountReturnType, KernelAccountClient } from "@zerodev/sdk";
2
- import { BundlerClient } from "permissionless";
3
- import { ENTRYPOINT_ADDRESS_V07_TYPE } from "permissionless/types";
2
+ import { BundlerClient } from "viem/account-abstraction";
4
3
  import type { Chain, HttpTransport, PublicClient, Transport } from "viem";
5
4
  export type KernelClientType = KernelAccountClient<Transport, Chain, CreateKernelAccountReturnType>;
6
- export type BundlerClientType = BundlerClient<ENTRYPOINT_ADDRESS_V07_TYPE>;
5
+ export type BundlerClientType = BundlerClient;
7
6
  export type PublicClientType = PublicClient<Transport, Chain>;
8
7
  export type PublicClientHTTPType = PublicClient<HttpTransport, Chain>;
9
8
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1E,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC;AAEpG,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,2BAA2B,CAAC,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../ts/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1E,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC;AAEpG,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC"}
@@ -24,8 +24,8 @@ describe("DeployerController", () => {
24
24
  let approval;
25
25
  let sessionKeyAddress;
26
26
  beforeAll(async () => {
27
- approval = await generateApproval(sessionKeyAddress);
28
27
  sessionKeyAddress = (await sessionKeyService.generateSessionKey()).sessionKeyAddress;
28
+ approval = await generateApproval(sessionKeyAddress);
29
29
  });
30
30
  beforeEach(async () => {
31
31
  const app = await Test.createTestingModule({
@@ -55,8 +55,8 @@ describe("DeployerController", () => {
55
55
  test("should return 400 bad request when the service throws", async () => {
56
56
  await expect(deployerControllerFail.deployMACIContracts({
57
57
  chain: ESupportedNetworks.OPTIMISM_SEPOLIA,
58
- approval: "",
59
- sessionKeyAddress: "0x",
58
+ approval: "0x123",
59
+ sessionKeyAddress: "0x123",
60
60
  config: testMaciDeploymentConfig,
61
61
  })).rejects.toThrow(ErrorCodes.SESSION_KEY_NOT_FOUND.toString());
62
62
  });
@@ -65,8 +65,8 @@ describe("DeployerController", () => {
65
65
  test("should deploy a new poll", async () => {
66
66
  const { pollId } = await deployerController.deployPoll({
67
67
  chain: ESupportedNetworks.OPTIMISM_SEPOLIA,
68
- approval: "",
69
- sessionKeyAddress: "0x",
68
+ approval,
69
+ sessionKeyAddress,
70
70
  config: testPollDeploymentConfig,
71
71
  });
72
72
  expect(pollId).toEqual(defaultDeployPollReturn);
@@ -74,8 +74,8 @@ describe("DeployerController", () => {
74
74
  test("should return 400 bad request when the service throws", async () => {
75
75
  await expect(deployerControllerFail.deployPoll({
76
76
  chain: ESupportedNetworks.OPTIMISM_SEPOLIA,
77
- approval: "",
78
- sessionKeyAddress: "0x",
77
+ approval: "0x123",
78
+ sessionKeyAddress: "0x123",
79
79
  config: testPollDeploymentConfig,
80
80
  })).rejects.toThrow(ErrorCodes.SESSION_KEY_NOT_FOUND.toString());
81
81
  });
@@ -1 +1 @@
1
- {"version":3,"file":"deployer.controller.test.js","sourceRoot":"","sources":["../../../../ts/deployer/__tests__/deployer.controller.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAO,WAAW,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAE7E,QAAQ,CAAC,oBAAoB,EAAE,GAAG,E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E;gBACZ,iBAAiB,EAAE,IAAI;gBACvB,MAAM,EAAE,wBAAwB;aACjC,CAAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;YACvE,MAAM,MAAM,CACV,sBAAsB,CAAC,UAAU,CAAC;gBAChC,KAAK,EAAE,kBAAkB,CAAC,gBAAgB;gBAC1C,QAAQ,EAAE,EAAE;gBACZ,iBAAiB,EAAE,IAAI;gBACvB,MAAM,EAAE,wBAAwB;aACjC,CAAC,CACH,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"deployer.controller.test.js","sourceRoot":"","sources":["../../../../ts/deployer/__tests__/deployer.controller.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAO,WAAW,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAE7E,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,SAAS,CAAC,GAAG,EAAE;QACb,I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AAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;YACvE,MAAM,MAAM,CACV,sBAAsB,CAAC,UAAU,CAAC;gBAChC,KAAK,EAAE,kBAAkB,CAAC,gBAAgB;gBAC1C,QAAQ,EAAE,OAAO;gBACjB,iBAAiB,EAAE,OAAO;gBAC1B,MAAM,EAAE,wBAAwB;aACjC,CAAC,CACH,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
- import { IInitialVoiceCreditProxy__factory as VoiceCreditProxyFactory, ContractStorage, EContracts, EInitialVoiceCreditProxies, EPolicies, FreeForAllPolicy__factory as FreeForAllPolicyFactory, EASPolicy__factory as EASPolicyFactory, ZupassPolicy__factory as ZupassPolicyFactory, SemaphorePolicy__factory as SemaphorePolicyFactory, HatsPolicy__factory as HatsPolicyFactory, GitcoinPassportPolicy__factory as GitcoinPassportPolicyFactory, MACI__factory as MACIFactory, Verifier__factory as VerifierFactory, } from "@maci-protocol/sdk";
1
+ import { ContractStorage, ECheckerFactories, EContracts, EInitialVoiceCreditProxies, EInitialVoiceCreditProxiesFactories, EPolicies, EPolicyFactories, getDeployedPolicyProxyFactories, MACI__factory as MACIFactory, Verifier__factory as VerifierFactory, } from "@maci-protocol/sdk";
2
2
  import dotenv from "dotenv";
3
- import { BaseContract, zeroPadBytes } from "ethers";
3
+ import { BaseContract } from "ethers";
4
4
  import { zeroAddress } from "viem";
5
5
  import path from "path";
6
6
  import { ErrorCodes, ESupportedNetworks } from "../../common";
@@ -8,7 +8,6 @@ import { FileService } from "../../file/file.service";
8
8
  import { generateApproval } from "../../sessionKeys/__tests__/utils";
9
9
  import { SessionKeysService } from "../../sessionKeys/sessionKeys.service";
10
10
  import { DeployerService } from "../deployer.service";
11
- import { estimateExtraGasLimit } from "../utils";
12
11
  import { testMaciDeploymentConfig, testPollDeploymentConfig } from "./utils";
13
12
  dotenv.config();
14
13
  describe("DeployerService", () => {
@@ -22,296 +21,104 @@ describe("DeployerService", () => {
22
21
  const deployerService = new DeployerService(sessionKeyService, fileService);
23
22
  let approval;
24
23
  let sessionKeyAddress;
24
+ let signer;
25
25
  beforeAll(async () => {
26
- approval = await generateApproval(sessionKeyAddress);
27
26
  sessionKeyAddress = (await sessionKeyService.generateSessionKey()).sessionKeyAddress;
27
+ approval = await generateApproval(sessionKeyAddress);
28
+ signer = await sessionKeyService.getCoordinatorSigner(chain);
28
29
  });
29
- describe("getVoiceCreditProxyData", () => {
30
- test("should return the voice credit proxy data", () => {
31
- const voiceCreditProxyData = deployerService.getVoiceCreditProxyData(EInitialVoiceCreditProxies.Constant, chain, {
32
- amount: "50",
33
- });
34
- expect(voiceCreditProxyData).toBeDefined();
35
- expect(voiceCreditProxyData.alreadyDeployed).toBe(false);
36
- expect(voiceCreditProxyData.abi).toBeDefined();
37
- expect(voiceCreditProxyData.bytecode).toBeDefined();
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),
43
- 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
- });
30
+ afterAll(() => {
31
+ storageInstance.cleanup(ESupportedNetworks.OPTIMISM_SEPOLIA);
32
+ storageInstance.cleanup(ESupportedNetworks.ARBITRUM_ONE);
60
33
  });
61
- describe("getPolicyData", () => {
34
+ describe("deployAndSavePolicy", () => {
62
35
  // we cleanup after each test so we don't have leftover saved contracts
63
36
  afterEach(() => {
64
37
  storageInstance.cleanup(chain);
65
38
  });
66
- it("should throw when the policy is not existent", () => {
67
- expect(() => deployerService.getPolicyData("NotExistent", chain)).toThrow(ErrorCodes.UNSUPPORTED_POLICY.toString());
39
+ test("should throw when the policy is not existent", async () => {
40
+ await expect(deployerService.deployAndSavePolicy(signer, chain, { type: "NonExistent" })).rejects.toThrow(ErrorCodes.UNSUPPORTED_POLICY.toString());
68
41
  });
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
- });
77
- it("should return the policy data and that the policy is already deployed", async () => {
78
- await storageInstance.register({
79
- id: EPolicies.FreeForAll,
80
- contract: new BaseContract("0x", FreeForAllPolicyFactory.abi),
81
- network: chain,
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
- });
42
+ test("should deploy policy if none is stored", async () => {
43
+ const policy = await deployerService.deployAndSavePolicy(signer, chain, { type: EPolicies.FreeForAll });
44
+ expect(policy).toBeDefined();
45
+ expect(await policy.getAddress()).not.toBe(zeroAddress);
90
46
  });
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();
115
- });
116
- it("should return that the policy is not deployed when the args are different", async () => {
117
- await storageInstance.register({
118
- id: EPolicies.EAS,
119
- contract: new BaseContract("0x", EASPolicyFactory.abi),
120
- network: chain,
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();
47
+ test("should save factories (policy and checker) after deploying policy", async () => {
48
+ const { checker: initialChecker, policy: initialPolicy } = await getDeployedPolicyProxyFactories({
49
+ policy: EPolicyFactories.FreeForAll,
50
+ checker: ECheckerFactories.FreeForAll,
51
+ network: chain,
52
+ signer,
53
+ });
54
+ expect(initialChecker).not.toBeDefined();
55
+ expect(initialPolicy).not.toBeDefined();
56
+ await deployerService.deployAndSavePolicy(signer, chain, { type: EPolicies.FreeForAll });
57
+ const { checker, policy } = await getDeployedPolicyProxyFactories({
58
+ policy: EPolicyFactories.FreeForAll,
59
+ checker: ECheckerFactories.FreeForAll,
60
+ network: chain,
61
+ signer,
132
62
  });
63
+ expect(checker).toBeDefined();
64
+ expect(policy).toBeDefined();
133
65
  });
134
- describe("ZupassPolicy", () => {
135
- it("should return the policy data and that the policy is not deployed", () => {
136
- const policyData = deployerService.getPolicyData(EPolicies.Zupass, chain, {
137
- signer1: zeroAddress,
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();
66
+ test("should reuse policy factories if already stored", async () => {
67
+ const firstPolicy = await deployerService.deployAndSavePolicy(signer, chain, { type: EPolicies.FreeForAll });
68
+ const { checker: firstCheckerFactory, policy: firstPolicyFactory } = await getDeployedPolicyProxyFactories({
69
+ policy: EPolicyFactories.FreeForAll,
70
+ checker: ECheckerFactories.FreeForAll,
71
+ network: chain,
72
+ signer,
73
+ });
74
+ expect(firstCheckerFactory).toBeDefined();
75
+ expect(firstPolicyFactory).toBeDefined();
76
+ const firstCheckerFactoryAddress = await firstCheckerFactory.getAddress();
77
+ const firstPolicyFactoryAddress = await firstPolicyFactory.getAddress();
78
+ expect(firstCheckerFactoryAddress).not.toBe(zeroAddress);
79
+ expect(firstPolicyFactoryAddress).not.toBe(zeroAddress);
80
+ const secondPolicy = await deployerService.deployAndSavePolicy(signer, chain, {
81
+ type: EPolicies.FreeForAll,
82
+ });
83
+ const { checker: secondCheckerFactory, policy: secondPolicyFactory } = await getDeployedPolicyProxyFactories({
84
+ policy: EPolicyFactories.FreeForAll,
85
+ checker: ECheckerFactories.FreeForAll,
86
+ network: chain,
87
+ signer,
182
88
  });
89
+ expect(secondCheckerFactory).toBeDefined();
90
+ expect(secondPolicyFactory).toBeDefined();
91
+ expect(await secondCheckerFactory.getAddress()).toBe(firstCheckerFactoryAddress);
92
+ expect(await secondPolicyFactory.getAddress()).toBe(firstPolicyFactoryAddress);
93
+ expect(await firstPolicy.getAddress()).not.toBe(await secondPolicy.getAddress());
183
94
  });
184
- describe("SemaphorePolicy", () => {
185
- it("should return the policy data and that the policy is not deployed", () => {
186
- const policyData = deployerService.getPolicyData(EPolicies.Semaphore, chain, {
187
- semaphoreContract: zeroAddress,
188
- groupId: "0",
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
- });
95
+ });
96
+ describe("deployAndSaveVoiceCreditProxyFactory", () => {
97
+ afterEach(() => {
98
+ storageInstance.cleanup(chain);
227
99
  });
228
- describe("HatsPolicy", () => {
229
- it("should return the policy data and that the policy is not deployed", () => {
230
- const policyData = deployerService.getPolicyData(EPolicies.Hats, chain, {
231
- hatsProtocolAddress: zeroAddress,
232
- critrionHats: [zeroAddress],
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
- });
100
+ it("should throw when the voice credit proxy factory is not existent", async () => {
101
+ await expect(deployerService.deployAndSaveVoiceCreditProxyFactory(signer, "NonExistent", chain)).rejects.toThrow(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY.toString());
271
102
  });
272
- describe("GitcoinPassportPolicy", () => {
273
- it("should return the policy data and that the policy is not deployed", () => {
274
- const policyData = deployerService.getPolicyData(EPolicies.GitcoinPassport, chain, {
275
- decoderAddress: zeroAddress,
276
- passingScore: "0",
277
- });
278
- expect(policyData).toBeDefined();
279
- expect(policyData.alreadyDeployed).toBe(false);
280
- expect(policyData.abi).toBeDefined();
281
- expect(policyData.bytecode).toBeDefined();
282
- });
283
- it("should return the policy data and that the policy is already deployed", async () => {
284
- await storageInstance.register({
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
- });
103
+ test("should deploy voice credit proxy factory if none is stored", async () => {
104
+ const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
105
+ expect(constantInitialVoiceCreditProxyFactory).toBeDefined();
106
+ expect(await constantInitialVoiceCreditProxyFactory.getAddress()).not.toBe(zeroAddress);
107
+ });
108
+ });
109
+ describe("deployAndSaveVoiceCreditProxy", () => {
110
+ afterEach(() => {
111
+ storageInstance.cleanup(chain);
112
+ });
113
+ it("should throw when the voice credit proxy is not existent", async () => {
114
+ const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
115
+ await expect(deployerService.deployAndSaveVoiceCreditProxy(signer, "NonExistent", chain, constantInitialVoiceCreditProxyFactory)).rejects.toThrow(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY.toString());
116
+ });
117
+ test("should deploy voice credit proxy if none is stored", async () => {
118
+ const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
119
+ const voiceCreditProxy = await deployerService.deployAndSaveVoiceCreditProxy(signer, EInitialVoiceCreditProxies.Constant, chain, constantInitialVoiceCreditProxyFactory, { amount: 100 });
120
+ expect(voiceCreditProxy).toBeDefined();
121
+ expect(await voiceCreditProxy.getAddress()).not.toBe(zeroAddress);
315
122
  });
316
123
  });
317
124
  describe("deployMaci", () => {
@@ -327,7 +134,7 @@ describe("DeployerService", () => {
327
134
  await expect(deployerService.deployMaci({
328
135
  config: testMaciDeploymentConfig,
329
136
  chain,
330
- approval: "0x",
137
+ approval: "0x123",
331
138
  sessionKeyAddress,
332
139
  })).rejects.toThrow(ErrorCodes.INVALID_APPROVAL.toString());
333
140
  });
@@ -383,7 +190,7 @@ describe("DeployerService", () => {
383
190
  config: testPollDeploymentConfig,
384
191
  })).rejects.toThrow(ErrorCodes.VERIFIER_NOT_DEPLOYED.toString());
385
192
  });
386
- it("should throw when there is no vk registry deployed", async () => {
193
+ it("should throw when there is no verifying keys registry deployed", async () => {
387
194
  await storageInstance.register({
388
195
  id: EContracts.MACI,
389
196
  contract: new BaseContract("0x", MACIFactory.abi),
@@ -401,7 +208,7 @@ describe("DeployerService", () => {
401
208
  sessionKeyAddress,
402
209
  chain,
403
210
  config: testPollDeploymentConfig,
404
- })).rejects.toThrow(ErrorCodes.VK_REGISTRY_NOT_DEPLOYED.toString());
211
+ })).rejects.toThrow(ErrorCodes.VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED.toString());
405
212
  });
406
213
  test("should deploy a poll", async () => {
407
214
  const mockDeployPoll = jest.fn().mockResolvedValue({ pollId: "0" });
@@ -415,11 +222,5 @@ describe("DeployerService", () => {
415
222
  expect(pollId).toBe("0");
416
223
  });
417
224
  });
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
225
  });
425
226
  //# sourceMappingURL=deployer.service.test.js.map