@maci-protocol/relayer 0.0.0-ci.2653bc0
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 +134 -0
- package/LICENSE +22 -0
- package/README.md +149 -0
- package/build/hardhat.config.cjs +31 -0
- package/build/hardhat.config.cjs.map +1 -0
- package/build/hardhat.config.d.cts +22 -0
- package/build/hardhat.config.d.cts.map +1 -0
- package/build/tests/app.test.d.ts +2 -0
- package/build/tests/app.test.d.ts.map +1 -0
- package/build/tests/app.test.js +30 -0
- package/build/tests/app.test.js.map +1 -0
- package/build/tests/constants.d.ts +19 -0
- package/build/tests/constants.d.ts.map +1 -0
- package/build/tests/constants.js +20 -0
- package/build/tests/constants.js.map +1 -0
- package/build/tests/messageBatches.test.d.ts +2 -0
- package/build/tests/messageBatches.test.d.ts.map +1 -0
- package/build/tests/messageBatches.test.js +109 -0
- package/build/tests/messageBatches.test.js.map +1 -0
- package/build/tests/messages.test.d.ts +2 -0
- package/build/tests/messages.test.d.ts.map +1 -0
- package/build/tests/messages.test.js +147 -0
- package/build/tests/messages.test.js.map +1 -0
- package/build/tests/onchain.test.d.ts +2 -0
- package/build/tests/onchain.test.d.ts.map +1 -0
- package/build/tests/onchain.test.js +101 -0
- package/build/tests/onchain.test.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 +51 -0
- package/build/ts/app.module.js.map +1 -0
- package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
- package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
- package/build/ts/health/__tests__/health.controller.test.js +22 -0
- package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
- package/build/ts/health/health.controller.d.ts +10 -0
- package/build/ts/health/health.controller.d.ts.map +1 -0
- package/build/ts/health/health.controller.js +36 -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 +17 -0
- package/build/ts/health/health.module.js.map +1 -0
- package/build/ts/ipfs/__tests__/ipfs.service.test.d.ts +2 -0
- package/build/ts/ipfs/__tests__/ipfs.service.test.d.ts.map +1 -0
- package/build/ts/ipfs/__tests__/ipfs.service.test.js +23 -0
- package/build/ts/ipfs/__tests__/ipfs.service.test.js.map +1 -0
- package/build/ts/ipfs/ipfs.module.d.ts +3 -0
- package/build/ts/ipfs/ipfs.module.d.ts.map +1 -0
- package/build/ts/ipfs/ipfs.module.js +18 -0
- package/build/ts/ipfs/ipfs.module.js.map +1 -0
- package/build/ts/ipfs/ipfs.service.d.ts +50 -0
- package/build/ts/ipfs/ipfs.service.d.ts.map +1 -0
- package/build/ts/ipfs/ipfs.service.js +86 -0
- package/build/ts/ipfs/ipfs.service.js.map +1 -0
- package/build/ts/jest/mongo.d.ts +9 -0
- package/build/ts/jest/mongo.d.ts.map +1 -0
- package/build/ts/jest/mongo.js +16 -0
- package/build/ts/jest/mongo.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 +3 -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/message/__tests__/message.controller.test.d.ts +2 -0
- package/build/ts/message/__tests__/message.controller.test.d.ts.map +1 -0
- package/build/ts/message/__tests__/message.controller.test.js +42 -0
- package/build/ts/message/__tests__/message.controller.test.js.map +1 -0
- package/build/ts/message/__tests__/message.guard.test.d.ts +2 -0
- package/build/ts/message/__tests__/message.guard.test.d.ts.map +1 -0
- package/build/ts/message/__tests__/message.guard.test.js +98 -0
- package/build/ts/message/__tests__/message.guard.test.js.map +1 -0
- package/build/ts/message/__tests__/message.repository.test.d.ts +2 -0
- package/build/ts/message/__tests__/message.repository.test.d.ts.map +1 -0
- package/build/ts/message/__tests__/message.repository.test.js +62 -0
- package/build/ts/message/__tests__/message.repository.test.js.map +1 -0
- package/build/ts/message/__tests__/message.service.test.d.ts +2 -0
- package/build/ts/message/__tests__/message.service.test.d.ts.map +1 -0
- package/build/ts/message/__tests__/message.service.test.js +71 -0
- package/build/ts/message/__tests__/message.service.test.js.map +1 -0
- package/build/ts/message/__tests__/utils.d.ts +6 -0
- package/build/ts/message/__tests__/utils.d.ts.map +1 -0
- package/build/ts/message/__tests__/utils.js +27 -0
- package/build/ts/message/__tests__/utils.js.map +1 -0
- package/build/ts/message/__tests__/validation.test.d.ts +2 -0
- package/build/ts/message/__tests__/validation.test.d.ts.map +1 -0
- package/build/ts/message/__tests__/validation.test.js +21 -0
- package/build/ts/message/__tests__/validation.test.js.map +1 -0
- package/build/ts/message/message.controller.d.ts +25 -0
- package/build/ts/message/message.controller.d.ts.map +1 -0
- package/build/ts/message/message.controller.js +66 -0
- package/build/ts/message/message.controller.js.map +1 -0
- package/build/ts/message/message.dto.d.ts +43 -0
- package/build/ts/message/message.dto.d.ts.map +1 -0
- package/build/ts/message/message.dto.js +132 -0
- package/build/ts/message/message.dto.js.map +1 -0
- package/build/ts/message/message.guard.d.ts +33 -0
- package/build/ts/message/message.guard.d.ts.map +1 -0
- package/build/ts/message/message.guard.js +91 -0
- package/build/ts/message/message.guard.js.map +1 -0
- package/build/ts/message/message.module.d.ts +3 -0
- package/build/ts/message/message.module.d.ts.map +1 -0
- package/build/ts/message/message.module.js +24 -0
- package/build/ts/message/message.module.js.map +1 -0
- package/build/ts/message/message.repository.d.ts +37 -0
- package/build/ts/message/message.repository.d.ts.map +1 -0
- package/build/ts/message/message.repository.js +77 -0
- package/build/ts/message/message.repository.js.map +1 -0
- package/build/ts/message/message.schema.d.ts +52 -0
- package/build/ts/message/message.schema.d.ts.map +1 -0
- package/build/ts/message/message.schema.js +77 -0
- package/build/ts/message/message.schema.js.map +1 -0
- package/build/ts/message/message.service.d.ts +37 -0
- package/build/ts/message/message.service.d.ts.map +1 -0
- package/build/ts/message/message.service.js +85 -0
- package/build/ts/message/message.service.js.map +1 -0
- package/build/ts/message/types.d.ts +35 -0
- package/build/ts/message/types.d.ts.map +1 -0
- package/build/ts/message/types.js +2 -0
- package/build/ts/message/types.js.map +1 -0
- package/build/ts/message/validation.d.ts +20 -0
- package/build/ts/message/validation.d.ts.map +1 -0
- package/build/ts/message/validation.js +41 -0
- package/build/ts/message/validation.js.map +1 -0
- package/build/ts/messageBatch/__tests__/messageBatch.controller.test.d.ts +2 -0
- package/build/ts/messageBatch/__tests__/messageBatch.controller.test.d.ts.map +1 -0
- package/build/ts/messageBatch/__tests__/messageBatch.controller.test.js +41 -0
- package/build/ts/messageBatch/__tests__/messageBatch.controller.test.js.map +1 -0
- package/build/ts/messageBatch/__tests__/messageBatch.repository.test.d.ts +2 -0
- package/build/ts/messageBatch/__tests__/messageBatch.repository.test.d.ts.map +1 -0
- package/build/ts/messageBatch/__tests__/messageBatch.repository.test.js +55 -0
- package/build/ts/messageBatch/__tests__/messageBatch.repository.test.js.map +1 -0
- package/build/ts/messageBatch/__tests__/messageBatch.service.test.d.ts +2 -0
- package/build/ts/messageBatch/__tests__/messageBatch.service.test.d.ts.map +1 -0
- package/build/ts/messageBatch/__tests__/messageBatch.service.test.js +66 -0
- package/build/ts/messageBatch/__tests__/messageBatch.service.test.js.map +1 -0
- package/build/ts/messageBatch/__tests__/utils.d.ts +5 -0
- package/build/ts/messageBatch/__tests__/utils.d.ts.map +1 -0
- package/build/ts/messageBatch/__tests__/utils.js +24 -0
- package/build/ts/messageBatch/__tests__/utils.js.map +1 -0
- package/build/ts/messageBatch/__tests__/validation.test.d.ts +2 -0
- package/build/ts/messageBatch/__tests__/validation.test.d.ts.map +1 -0
- package/build/ts/messageBatch/__tests__/validation.test.js +20 -0
- package/build/ts/messageBatch/__tests__/validation.test.js.map +1 -0
- package/build/ts/messageBatch/messageBatch.controller.d.ts +24 -0
- package/build/ts/messageBatch/messageBatch.controller.d.ts.map +1 -0
- package/build/ts/messageBatch/messageBatch.controller.js +77 -0
- package/build/ts/messageBatch/messageBatch.controller.js.map +1 -0
- package/build/ts/messageBatch/messageBatch.dto.d.ts +52 -0
- package/build/ts/messageBatch/messageBatch.dto.d.ts.map +1 -0
- package/build/ts/messageBatch/messageBatch.dto.js +168 -0
- package/build/ts/messageBatch/messageBatch.dto.js.map +1 -0
- package/build/ts/messageBatch/messageBatch.module.d.ts +3 -0
- package/build/ts/messageBatch/messageBatch.module.d.ts.map +1 -0
- package/build/ts/messageBatch/messageBatch.module.js +25 -0
- package/build/ts/messageBatch/messageBatch.module.js.map +1 -0
- package/build/ts/messageBatch/messageBatch.repository.d.ts +39 -0
- package/build/ts/messageBatch/messageBatch.repository.d.ts.map +1 -0
- package/build/ts/messageBatch/messageBatch.repository.js +72 -0
- package/build/ts/messageBatch/messageBatch.repository.js.map +1 -0
- package/build/ts/messageBatch/messageBatch.schema.d.ts +36 -0
- package/build/ts/messageBatch/messageBatch.schema.d.ts.map +1 -0
- package/build/ts/messageBatch/messageBatch.schema.js +45 -0
- package/build/ts/messageBatch/messageBatch.schema.js.map +1 -0
- package/build/ts/messageBatch/messageBatch.service.d.ts +41 -0
- package/build/ts/messageBatch/messageBatch.service.d.ts.map +1 -0
- package/build/ts/messageBatch/messageBatch.service.js +107 -0
- package/build/ts/messageBatch/messageBatch.service.js.map +1 -0
- package/build/ts/messageBatch/validation.d.ts +20 -0
- package/build/ts/messageBatch/validation.d.ts.map +1 -0
- package/build/ts/messageBatch/validation.js +38 -0
- package/build/ts/messageBatch/validation.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +79 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [3.0.0](https://github.com/privacy-scaling-explorations/maci/compare/v2.5.0...v3.0.0) (2025-03-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add start and end timestmap for poll ([cf67b53](https://github.com/privacy-scaling-explorations/maci/commit/cf67b539d7d5dfd8b83ba3e0becaa20d0292b410))
|
|
12
|
+
* **contracts:** integrate excubiae for gatekeepers ([fae260b](https://github.com/privacy-scaling-explorations/maci/commit/fae260bbdd4d6b7a8749f61c0310526448a6c030))
|
|
13
|
+
* **relayer:** add auth guard for message publishing ([813bfc7](https://github.com/privacy-scaling-explorations/maci/commit/813bfc7b25e403902e6779ef4304ee48bb5640e9))
|
|
14
|
+
* **relayer:** add database integration ([5170627](https://github.com/privacy-scaling-explorations/maci/commit/51706271c6e504c925f07d6a9ae56450e86a2267))
|
|
15
|
+
* **relayer:** add deploy scripts ([39c6119](https://github.com/privacy-scaling-explorations/maci/commit/39c61195b424c45df8f9b2864308e99132c0b369))
|
|
16
|
+
* **relayer:** add ipfs integration ([648414a](https://github.com/privacy-scaling-explorations/maci/commit/648414a2083309b880c806c481a475e4fee4377e))
|
|
17
|
+
* **relayer:** add publish message api method ([b083ec7](https://github.com/privacy-scaling-explorations/maci/commit/b083ec79c81ec81fe284b6120c6213dc1e4997f2))
|
|
18
|
+
* **relayer:** add relayer service boilerplate ([985f572](https://github.com/privacy-scaling-explorations/maci/commit/985f57203b665321cf08bc40a7662ee7d104a173))
|
|
19
|
+
* **relayer:** fetch message batches ([0048939](https://github.com/privacy-scaling-explorations/maci/commit/0048939de90c6ea6ae2c439e807704e0535dee64))
|
|
20
|
+
* **relayer:** relay messages onchain ([1aa4ea3](https://github.com/privacy-scaling-explorations/maci/commit/1aa4ea318c0cc5f6fdadc12c59357cf4bb9b177e))
|
|
21
|
+
* **sdk:** add relayer functions ([6273ef8](https://github.com/privacy-scaling-explorations/maci/commit/6273ef8c07675aaebe6d1d73d2c1e51de1ccfc56))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Code Refactoring
|
|
25
|
+
|
|
26
|
+
* **cli:** cleanup signup command ([601269c](https://github.com/privacy-scaling-explorations/maci/commit/601269c8c5c508289e3f95ac6b55603c73d19779))
|
|
27
|
+
* **cli:** move deploy vk registry and testing commands to sdk ([bcd8d12](https://github.com/privacy-scaling-explorations/maci/commit/bcd8d12980067a5d1618fe43c8d3a9b5c5d5be84))
|
|
28
|
+
* **cli:** move proof generation and poll deploy to sdk ([31922b2](https://github.com/privacy-scaling-explorations/maci/commit/31922b2f816ecdd254d761e49b25081f5c9fa9a3))
|
|
29
|
+
* **cli:** move prove onchain to sdk ([452a68a](https://github.com/privacy-scaling-explorations/maci/commit/452a68a452ac33f9186ecf735e8d5df852a5c5e1))
|
|
30
|
+
* **cli:** move vk commands to sdk ([1f2a81e](https://github.com/privacy-scaling-explorations/maci/commit/1f2a81e67ccdea1ca6136dd71005cb7f91ae02fb))
|
|
31
|
+
* **cli:** use contract storage for cli ([b417ee7](https://github.com/privacy-scaling-explorations/maci/commit/b417ee7de9c54fb875c363ca38c1c41eb34d8e8e))
|
|
32
|
+
* contract imports and proofs ([#2074](https://github.com/privacy-scaling-explorations/maci/issues/2074)) ([66dfab7](https://github.com/privacy-scaling-explorations/maci/commit/66dfab7e0916f5891f47ae1448b89f7b0fd0ed27))
|
|
33
|
+
* deploy maci command ([3eb6915](https://github.com/privacy-scaling-explorations/maci/commit/3eb691568a01e94cbbdb2f4f806efae002b19328))
|
|
34
|
+
* make separate testing package ([#2229](https://github.com/privacy-scaling-explorations/maci/issues/2229)) ([bd07a7f](https://github.com/privacy-scaling-explorations/maci/commit/bd07a7f0783b2efe2659bc18255f8f4ed2e3c0d3))
|
|
35
|
+
* poll deploy sdk ([#2189](https://github.com/privacy-scaling-explorations/maci/issues/2189)) ([da1b785](https://github.com/privacy-scaling-explorations/maci/commit/da1b7852cea94663a97ef7ceef1c3e9b8ca3eda8))
|
|
36
|
+
* setVerifyingKeys ([8ce195b](https://github.com/privacy-scaling-explorations/maci/commit/8ce195baa5191bce63fd807cd75f3f75e2ad0d76))
|
|
37
|
+
* vote sdk ([#2089](https://github.com/privacy-scaling-explorations/maci/issues/2089)) ([fed0e25](https://github.com/privacy-scaling-explorations/maci/commit/fed0e251bf09e1e34ec0a43ba58d89d3a95aa02c))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Miscellaneous
|
|
41
|
+
|
|
42
|
+
* bump nest packages ([cbbaaf4](https://github.com/privacy-scaling-explorations/maci/commit/cbbaaf48acaf7ac5e8963458d43579942d8ea95e))
|
|
43
|
+
* **deps-dev:** bump @nestjs/cli from 10.4.9 to 11.0.0 ([7da263d](https://github.com/privacy-scaling-explorations/maci/commit/7da263d9d7de1fe9805be52663883f8f36cd088e))
|
|
44
|
+
* **deps-dev:** bump @nestjs/cli from 11.0.0 to 11.0.2 ([7498355](https://github.com/privacy-scaling-explorations/maci/commit/749835548962fcf6a00f29098ad47554eaf4b300))
|
|
45
|
+
* **deps-dev:** bump @nestjs/cli from 11.0.2 to 11.0.4 ([bf6331f](https://github.com/privacy-scaling-explorations/maci/commit/bf6331fdfc7105f7bcd9da09e351b85cf3d3b406))
|
|
46
|
+
* **deps-dev:** bump @nestjs/cli from 11.0.4 to 11.0.5 ([159c4d3](https://github.com/privacy-scaling-explorations/maci/commit/159c4d3fa06228710317cc416a3dd8d10cce2f42))
|
|
47
|
+
* **deps-dev:** bump @nestjs/schematics from 10.2.3 to 11.0.0 ([109889f](https://github.com/privacy-scaling-explorations/maci/commit/109889f6aeb2013036f665eb1180bc9cfd4cc43b))
|
|
48
|
+
* **deps-dev:** bump @nestjs/schematics from 11.0.0 to 11.0.1 ([c7a095e](https://github.com/privacy-scaling-explorations/maci/commit/c7a095e7774e55d96ee115c0c9a72f64eb9108a2))
|
|
49
|
+
* **deps-dev:** bump @nestjs/schematics from 11.0.1 to 11.0.2 ([25d7e15](https://github.com/privacy-scaling-explorations/maci/commit/25d7e15b635b2df67c4db6985fffc483e20f80ef))
|
|
50
|
+
* **deps-dev:** bump @nestjs/testing from 10.4.15 to 11.0.11 ([63bb589](https://github.com/privacy-scaling-explorations/maci/commit/63bb5898a9f66c07c32874b532fa9cbdb4ca29de))
|
|
51
|
+
* **deps-dev:** bump @nestjs/testing from 11.0.1 to 11.0.3 ([c2fa817](https://github.com/privacy-scaling-explorations/maci/commit/c2fa8174a9149a1f62f446da9544cde5384f32f9))
|
|
52
|
+
* **deps-dev:** bump @nestjs/testing from 11.0.3 to 11.0.6 ([69ae687](https://github.com/privacy-scaling-explorations/maci/commit/69ae6870d2f6c025b650b534d09fba8af01bdd64))
|
|
53
|
+
* **deps-dev:** bump @nestjs/testing from 11.0.6 to 11.0.7 ([8bfde5e](https://github.com/privacy-scaling-explorations/maci/commit/8bfde5ecd1fcc138c2a9cb34f5c59ce7a4933aa9))
|
|
54
|
+
* **deps-dev:** bump @nestjs/testing from 11.0.7 to 11.0.9 ([8be92cf](https://github.com/privacy-scaling-explorations/maci/commit/8be92cfd319026ee920ed24a06ec0a4ad5560337))
|
|
55
|
+
* **deps-dev:** bump @nestjs/testing from 11.0.9 to 11.0.10 ([df18270](https://github.com/privacy-scaling-explorations/maci/commit/df182709668d766a31f430f29b58e666273b7d71))
|
|
56
|
+
* **deps-dev:** bump @types/lodash from 4.17.14 to 4.17.15 ([3fef01d](https://github.com/privacy-scaling-explorations/maci/commit/3fef01df4c4f5cc253e6c0949deae7e03d097dc2))
|
|
57
|
+
* **deps-dev:** bump @types/lodash from 4.17.15 to 4.17.16 ([3aa1c4e](https://github.com/privacy-scaling-explorations/maci/commit/3aa1c4e3a637fe2f333b91b5eadad6421b4bd5a1))
|
|
58
|
+
* **deps-dev:** bump @types/node from 20.17.19 to 22.13.9 ([aa7c356](https://github.com/privacy-scaling-explorations/maci/commit/aa7c356469592547f3d60c05077268267d7ea186))
|
|
59
|
+
* **deps-dev:** bump @types/node from 22.10.7 to 22.12.0 ([#2073](https://github.com/privacy-scaling-explorations/maci/issues/2073)) ([1dcb28e](https://github.com/privacy-scaling-explorations/maci/commit/1dcb28e33699ee91f9691c1073d4da0293e406c0))
|
|
60
|
+
* **deps-dev:** bump @types/node from 22.12.0 to 22.13.1 ([5f06af0](https://github.com/privacy-scaling-explorations/maci/commit/5f06af0180f522f552519529c07d2bb660fdd586))
|
|
61
|
+
* **deps-dev:** bump @types/node from 22.13.1 to 22.13.4 ([dba94f4](https://github.com/privacy-scaling-explorations/maci/commit/dba94f4fe6d405eaca655dfdc8ca01d57664b99b))
|
|
62
|
+
* **deps-dev:** bump @types/node from 22.13.9 to 22.13.10 ([#2241](https://github.com/privacy-scaling-explorations/maci/issues/2241)) ([3f50bb6](https://github.com/privacy-scaling-explorations/maci/commit/3f50bb65db4cd83b5ebe9d4fb1b7a6d650bb1c51))
|
|
63
|
+
* **deps-dev:** bump @types/node from 22.9.0 to 22.10.7 ([3e4a5ae](https://github.com/privacy-scaling-explorations/maci/commit/3e4a5ae43cc57d6ebaedeb5ce95ca6dd1c968ffe))
|
|
64
|
+
* **deps-dev:** bump fast-check from 3.23.1 to 3.23.2 ([b6c6167](https://github.com/privacy-scaling-explorations/maci/commit/b6c616708ce1b3211c9a2f99511d08597b0123d8))
|
|
65
|
+
* **deps-dev:** bump fast-check from 3.23.2 to 4.0.0 ([266738d](https://github.com/privacy-scaling-explorations/maci/commit/266738ddf289c22f7e16ceba5a2fb09b836d7323))
|
|
66
|
+
* **deps-dev:** bump mongodb-memory-server from 10.1.3 to 10.1.4 ([0fd8e3b](https://github.com/privacy-scaling-explorations/maci/commit/0fd8e3b1365c932c62cd8334189f35df26b75f10))
|
|
67
|
+
* **deps-dev:** bump ts-jest from 29.2.5 to 29.2.6 ([aaf7978](https://github.com/privacy-scaling-explorations/maci/commit/aaf797861177b92cb1395048e32898367cd65bd5))
|
|
68
|
+
* **deps-dev:** bump typescript and typedoc ([4ee5de5](https://github.com/privacy-scaling-explorations/maci/commit/4ee5de5e29c6326b6728dc2ccd97da3bdea42fd7))
|
|
69
|
+
* **deps-dev:** bump typescript from 5.7.3 to 5.8.2 ([e37f1bf](https://github.com/privacy-scaling-explorations/maci/commit/e37f1bffd8193de316e748d0406cfb606455cb46))
|
|
70
|
+
* **deps:** bump @helia/json from 4.0.1 to 4.0.2 ([a423fa1](https://github.com/privacy-scaling-explorations/maci/commit/a423fa14736903f5431f8daaf45b4ec891df1207))
|
|
71
|
+
* **deps:** bump @helia/json from 4.0.2 to 4.0.3 ([74ee87d](https://github.com/privacy-scaling-explorations/maci/commit/74ee87d6e934205fd24fdd49c2499c906068e270))
|
|
72
|
+
* **deps:** bump @nestjs/common from 10.4.15 to 11.0.11 ([1a1256d](https://github.com/privacy-scaling-explorations/maci/commit/1a1256de14fb14ae527eb17ad428cdaa9b11cfee))
|
|
73
|
+
* **deps:** bump @nestjs/common from 11.0.1 to 11.0.3 ([34ac159](https://github.com/privacy-scaling-explorations/maci/commit/34ac1597dccc7c40ed05b3e8792798b327f937b1))
|
|
74
|
+
* **deps:** bump @nestjs/common from 11.0.3 to 11.0.6 ([a80a308](https://github.com/privacy-scaling-explorations/maci/commit/a80a308a2f67cd0998aec3e5a75ef87343a26098))
|
|
75
|
+
* **deps:** bump @nestjs/common from 11.0.6 to 11.0.7 ([81272e6](https://github.com/privacy-scaling-explorations/maci/commit/81272e635c17a285ad1fb8067f73b6fc6e6aa7fb))
|
|
76
|
+
* **deps:** bump @nestjs/common from 11.0.7 to 11.0.9 ([f579ffd](https://github.com/privacy-scaling-explorations/maci/commit/f579ffd24e51533b843be5aaa1e53bafff6fc14d))
|
|
77
|
+
* **deps:** bump @nestjs/common from 11.0.9 to 11.0.10 ([9ff8f7b](https://github.com/privacy-scaling-explorations/maci/commit/9ff8f7ba287796aafe18e7f7adf7f88ec0cf62ab))
|
|
78
|
+
* **deps:** bump @nestjs/core from 10.4.15 to 11.0.1 ([b0490d6](https://github.com/privacy-scaling-explorations/maci/commit/b0490d6cbeae5644f7fce7c75f6b9a8604a3ebda))
|
|
79
|
+
* **deps:** bump @nestjs/core from 10.4.15 to 11.0.11 ([061c778](https://github.com/privacy-scaling-explorations/maci/commit/061c77839f88712f816dfe467e848b52f1d0c566))
|
|
80
|
+
* **deps:** bump @nestjs/core from 11.0.1 to 11.0.3 ([9ca9937](https://github.com/privacy-scaling-explorations/maci/commit/9ca99379124f8e39ad013efe86b92159a1c1c5dd))
|
|
81
|
+
* **deps:** bump @nestjs/core from 11.0.3 to 11.0.6 ([2469a09](https://github.com/privacy-scaling-explorations/maci/commit/2469a0941da49f4654d68ba2a917c1894494ce78))
|
|
82
|
+
* **deps:** bump @nestjs/core from 11.0.6 to 11.0.7 ([643be9f](https://github.com/privacy-scaling-explorations/maci/commit/643be9f7eb0195aa986099d97fbb081070fb0966))
|
|
83
|
+
* **deps:** bump @nestjs/core from 11.0.7 to 11.0.9 ([90314c9](https://github.com/privacy-scaling-explorations/maci/commit/90314c9ca8d03bcf18c0dff255a280f4a3691de2))
|
|
84
|
+
* **deps:** bump @nestjs/core from 11.0.9 to 11.0.10 ([0bde8c3](https://github.com/privacy-scaling-explorations/maci/commit/0bde8c3e4611885f2192327b23a08cfd6479690f))
|
|
85
|
+
* **deps:** bump @nestjs/mongoose from 10.1.0 to 11.0.0 ([c349e9b](https://github.com/privacy-scaling-explorations/maci/commit/c349e9b75b5461eb50be505c37b96008733e056f))
|
|
86
|
+
* **deps:** bump @nestjs/mongoose from 11.0.0 to 11.0.1 ([a07dca5](https://github.com/privacy-scaling-explorations/maci/commit/a07dca534eca75d24eab58ccabea5ad9e5a6e0f4))
|
|
87
|
+
* **deps:** bump @nestjs/platform-express from 10.4.15 to 11.0.11 ([12fb1d4](https://github.com/privacy-scaling-explorations/maci/commit/12fb1d425ba5f141c2d8bbf4d14d11a9d6add000))
|
|
88
|
+
* **deps:** bump @nestjs/platform-express from 11.0.1 to 11.0.3 ([b6351ca](https://github.com/privacy-scaling-explorations/maci/commit/b6351ca9e5504475f250e25ac056175356def669))
|
|
89
|
+
* **deps:** bump @nestjs/platform-express from 11.0.3 to 11.0.6 ([f86f9fc](https://github.com/privacy-scaling-explorations/maci/commit/f86f9fc086ca52a1aee80df470d30399cd608b16))
|
|
90
|
+
* **deps:** bump @nestjs/platform-express from 11.0.6 to 11.0.7 ([2ca5c97](https://github.com/privacy-scaling-explorations/maci/commit/2ca5c97bff962789bdcce91bcd512fdb7e0f0d50))
|
|
91
|
+
* **deps:** bump @nestjs/platform-express from 11.0.7 to 11.0.9 ([54145e7](https://github.com/privacy-scaling-explorations/maci/commit/54145e70bba0965c950d615300aae7a4b57e7c1e))
|
|
92
|
+
* **deps:** bump @nestjs/platform-express from 11.0.9 to 11.0.10 ([0b3634e](https://github.com/privacy-scaling-explorations/maci/commit/0b3634ed5188afd1a650ffb6da8191981a097734))
|
|
93
|
+
* **deps:** bump @nestjs/platform-socket.io from 10.4.15 to 11.0.11 ([23ff1f2](https://github.com/privacy-scaling-explorations/maci/commit/23ff1f23374090d83a221d964149b274dd021e2d))
|
|
94
|
+
* **deps:** bump @nestjs/platform-socket.io from 11.0.1 to 11.0.3 ([04d1d55](https://github.com/privacy-scaling-explorations/maci/commit/04d1d55ffed829bc021480272772493ed1a10a5f))
|
|
95
|
+
* **deps:** bump @nestjs/platform-socket.io from 11.0.3 to 11.0.6 ([#2076](https://github.com/privacy-scaling-explorations/maci/issues/2076)) ([4e37210](https://github.com/privacy-scaling-explorations/maci/commit/4e372100d6c63c64891d1cdff07c222d2d4d3f24))
|
|
96
|
+
* **deps:** bump @nestjs/platform-socket.io from 11.0.6 to 11.0.7 ([3b952a5](https://github.com/privacy-scaling-explorations/maci/commit/3b952a53f9246073e7746563471ae9e5cbeab418))
|
|
97
|
+
* **deps:** bump @nestjs/platform-socket.io from 11.0.7 to 11.0.9 ([6c3c20f](https://github.com/privacy-scaling-explorations/maci/commit/6c3c20f2b6804bf5adedb967b8c4a88a6cdfd899))
|
|
98
|
+
* **deps:** bump @nestjs/platform-socket.io from 11.0.9 to 11.0.10 ([2ece68c](https://github.com/privacy-scaling-explorations/maci/commit/2ece68c361de6af40e08d8ad8654e49db52a4f30))
|
|
99
|
+
* **deps:** bump @nestjs/schedule from 4.1.2 to 5.0.0 ([eeda1e8](https://github.com/privacy-scaling-explorations/maci/commit/eeda1e8283a2ef601f8f526cb08e481573486ac3))
|
|
100
|
+
* **deps:** bump @nestjs/schedule from 5.0.0 to 5.0.1 ([601add3](https://github.com/privacy-scaling-explorations/maci/commit/601add3528c8808f53ef0c484bca592ae858b869))
|
|
101
|
+
* **deps:** bump @nestjs/swagger from 11.0.0 to 11.0.1 ([1d4d296](https://github.com/privacy-scaling-explorations/maci/commit/1d4d2961b802253aeb27cbde5dbb55b9d6ef9dd8))
|
|
102
|
+
* **deps:** bump @nestjs/swagger from 11.0.1 to 11.0.2 ([59d272e](https://github.com/privacy-scaling-explorations/maci/commit/59d272ed1c2702db1599e663fe587e4d73fbdd4f))
|
|
103
|
+
* **deps:** bump @nestjs/swagger from 11.0.2 to 11.0.3 ([#2075](https://github.com/privacy-scaling-explorations/maci/issues/2075)) ([2d6ce6d](https://github.com/privacy-scaling-explorations/maci/commit/2d6ce6d457c9261e41a4f008b08b5c087003687d))
|
|
104
|
+
* **deps:** bump @nestjs/swagger from 11.0.3 to 11.0.4 ([8c9b9ee](https://github.com/privacy-scaling-explorations/maci/commit/8c9b9eeece7c4b12325b9e50cb87847488ad0697))
|
|
105
|
+
* **deps:** bump @nestjs/swagger from 8.1.1 to 11.0.6 ([4e8aca9](https://github.com/privacy-scaling-explorations/maci/commit/4e8aca9fe1b19f299119d070d0de27090652d58e))
|
|
106
|
+
* **deps:** bump @nestjs/throttler from 6.3.0 to 6.4.0 ([f49f730](https://github.com/privacy-scaling-explorations/maci/commit/f49f7309f6abb02544d125952324058015e255e9))
|
|
107
|
+
* **deps:** bump @nestjs/websockets from 10.4.15 to 11.0.1 ([600b1ec](https://github.com/privacy-scaling-explorations/maci/commit/600b1eca4d2345b06611eb92b0bec6a4247c581d))
|
|
108
|
+
* **deps:** bump @nestjs/websockets from 11.0.1 to 11.0.3 ([b29e483](https://github.com/privacy-scaling-explorations/maci/commit/b29e483f1ff261728c8187b0415013f90e503aa1))
|
|
109
|
+
* **deps:** bump @nestjs/websockets from 11.0.3 to 11.0.6 ([f0de52f](https://github.com/privacy-scaling-explorations/maci/commit/f0de52f3b52dd5353b5aa778545ae8ce6f111fa1))
|
|
110
|
+
* **deps:** bump @nestjs/websockets from 11.0.6 to 11.0.7 ([9ed83a0](https://github.com/privacy-scaling-explorations/maci/commit/9ed83a004c276face7602306fb3396a1ee84ba02))
|
|
111
|
+
* **deps:** bump @nestjs/websockets from 11.0.7 to 11.0.9 ([9a09dd4](https://github.com/privacy-scaling-explorations/maci/commit/9a09dd4fddf6564d65d1e1c4ef874086cee7fea3))
|
|
112
|
+
* **deps:** bump @nestjs/websockets from 11.0.9 to 11.0.10 ([11a8d90](https://github.com/privacy-scaling-explorations/maci/commit/11a8d904d69cfcc64d4513072211092becf54d1e))
|
|
113
|
+
* **deps:** bump dotenv from 16.4.5 to 16.4.7 ([#2032](https://github.com/privacy-scaling-explorations/maci/issues/2032)) ([43eec88](https://github.com/privacy-scaling-explorations/maci/commit/43eec880410cc48d2435bc4f531276ffc588bcb3))
|
|
114
|
+
* **deps:** bump ethers from 6.13.4 to 6.13.5 ([5e0256c](https://github.com/privacy-scaling-explorations/maci/commit/5e0256c58ff02921a3eeb58b3478a673140ccdff))
|
|
115
|
+
* **deps:** bump hardhat from 2.22.15 to 2.22.18 ([cd2950f](https://github.com/privacy-scaling-explorations/maci/commit/cd2950ff9397e0a569a2b519bb4f9c84f261ac3a))
|
|
116
|
+
* **deps:** bump hardhat from 2.22.18 to 2.22.19 ([49af291](https://github.com/privacy-scaling-explorations/maci/commit/49af2919e353d322808c12ca0d5a77575c73e044))
|
|
117
|
+
* **deps:** bump helia from 5.1.1 to 5.2.0 ([77a2db2](https://github.com/privacy-scaling-explorations/maci/commit/77a2db2854f8878c7f7f4b79b877a01caf24fba9))
|
|
118
|
+
* **deps:** bump helia from 5.2.0 to 5.2.1 ([3ba8ce5](https://github.com/privacy-scaling-explorations/maci/commit/3ba8ce5a17ab1a6d539e6c5354b92dde281732c7))
|
|
119
|
+
* **deps:** bump helia from 5.2.1 to 5.3.0 ([7ea38ee](https://github.com/privacy-scaling-explorations/maci/commit/7ea38ee09d6bad975be82b6d171198cafe9f17b1))
|
|
120
|
+
* **deps:** bump helmet from 8.0.0 to 8.1.0 ([9e544e2](https://github.com/privacy-scaling-explorations/maci/commit/9e544e2eec454fd0423d517ef8358e7edd9ae3fd))
|
|
121
|
+
* **deps:** bump mongoose from 8.10.0 to 8.10.1 ([660bfe5](https://github.com/privacy-scaling-explorations/maci/commit/660bfe5051401478387f9de552806fb68b186933))
|
|
122
|
+
* **deps:** bump mongoose from 8.10.1 to 8.12.0 ([f5587a8](https://github.com/privacy-scaling-explorations/maci/commit/f5587a8809bd2f971b487b7d3900aa3f3cb15661))
|
|
123
|
+
* **deps:** bump mongoose from 8.12.0 to 8.12.1 ([4a6d6e0](https://github.com/privacy-scaling-explorations/maci/commit/4a6d6e037fe265754d901d2e53fde0db47a06a13))
|
|
124
|
+
* **deps:** bump mongoose from 8.9.3 to 8.9.5 ([79c44dd](https://github.com/privacy-scaling-explorations/maci/commit/79c44ddf302a59e6b05b652b40fe777886caa114))
|
|
125
|
+
* **deps:** bump mongoose from 8.9.5 to 8.9.7 ([d0aedca](https://github.com/privacy-scaling-explorations/maci/commit/d0aedca0a3815321f97ba92cd6e3210a445f73bc))
|
|
126
|
+
* **deps:** bump mongoose from 8.9.7 to 8.10.0 ([a2815e8](https://github.com/privacy-scaling-explorations/maci/commit/a2815e82d394b03b4f223dcc0c586f81f733116e))
|
|
127
|
+
* **deps:** bump multiformats from 13.3.1 to 13.3.2 ([#2146](https://github.com/privacy-scaling-explorations/maci/issues/2146)) ([56a05a0](https://github.com/privacy-scaling-explorations/maci/commit/56a05a09ae4fb3c0c0d66fe49649ae1174965b14))
|
|
128
|
+
* **deps:** bump rxjs from 7.8.1 to 7.8.2 ([e683e9e](https://github.com/privacy-scaling-explorations/maci/commit/e683e9ef81afe88c215c1767f4f34f7364a558b0))
|
|
129
|
+
* **relayer:** add checks for onchain publishing ([a25f4bd](https://github.com/privacy-scaling-explorations/maci/commit/a25f4bdd4c106920f429a4dc0deb09fb3275b57e))
|
|
130
|
+
* **relayer:** add general documentation for service ([84e8c16](https://github.com/privacy-scaling-explorations/maci/commit/84e8c165f737c5947029de0e055a549964187307))
|
|
131
|
+
* **relayer:** add more e2e tests ([0cbfc40](https://github.com/privacy-scaling-explorations/maci/commit/0cbfc40b2915924cdc6b6fc7db4392868f6f8845))
|
|
132
|
+
* **relayer:** disable typescript type import error for jest setup ([b823c59](https://github.com/privacy-scaling-explorations/maci/commit/b823c593c29fba9b64db864cb9486e0d841d1836))
|
|
133
|
+
* sync nestjs dependencies versions ([9c66b33](https://github.com/privacy-scaling-explorations/maci/commit/9c66b330664598cf9c0377d2078a946e34ad0004))
|
|
134
|
+
* update the readme ([#2242](https://github.com/privacy-scaling-explorations/maci/issues/2242)) ([ffdceee](https://github.com/privacy-scaling-explorations/maci/commit/ffdceee3074446f81deae5ef4e3df67f98aaada7))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Barry WhiteHat, Kendrick Tan, Kobi Gurkan, Kirill Goncharov
|
|
4
|
+
Cory Dickson, Han Jian, Chih-Cheng Liang, and Koh Wei Jie
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# MACI Relayer Service
|
|
2
|
+
|
|
3
|
+
This repository contains the setup and instructions to run the MACI Relayer service along with MongoDB using Docker.
|
|
4
|
+
|
|
5
|
+
For more details on how to use and integrate the offchain relayer service into your application, please refer to this [guide](/docs/category/offchain-relayer).
|
|
6
|
+
|
|
7
|
+
## Flow Diagram
|
|
8
|
+
|
|
9
|
+
Below is a high-level diagram illustrating the flow of the Relayer Service:
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## High-Level Overview of the Relayer:
|
|
14
|
+
|
|
15
|
+
### Functionality
|
|
16
|
+
|
|
17
|
+
The Relayer serves as an intermediary between users and the MACI system. It performs the following tasks:
|
|
18
|
+
|
|
19
|
+
- Allows users to send messages without having to pay gas fees by processing these messages off-chain.
|
|
20
|
+
- Receives user messages.
|
|
21
|
+
- Prepare messages batches and upload it to IPFS
|
|
22
|
+
- Submits the message hashes to the Poll contract with IPFS hash of the batch.
|
|
23
|
+
|
|
24
|
+
This process ensures that user actions are recorded on-chain without compromising their privacy.
|
|
25
|
+
|
|
26
|
+
### Privacy Preservation
|
|
27
|
+
|
|
28
|
+
By verifying the zero-knowledge proofs, the Relayer ensures that only authorized users can send messages.
|
|
29
|
+
Users must know the pre-image to a state leaf in the poll state tree.
|
|
30
|
+
|
|
31
|
+
### Decentralization and Trust
|
|
32
|
+
|
|
33
|
+
It's recommended that the coordinator only runs this service for now. That is because if the service malfunctions and batch hashes are pushed on chain without the messages actually being stored on ipfs, then polls can't be finalized.
|
|
34
|
+
|
|
35
|
+
### Integration with MACI Components
|
|
36
|
+
|
|
37
|
+
The Relayer interacts with other components of the MACI system, such as the **Coordinator** and the on-chain smart contracts:
|
|
38
|
+
|
|
39
|
+
- The **Coordinator** fetches all the messages stored in IPFS and uses them as regular on-chain messages.
|
|
40
|
+
- This ensures that user messages are properly processed and recorded, contributing to the overall functionality and security of the voting protocol.
|
|
41
|
+
|
|
42
|
+
## Prerequisites
|
|
43
|
+
|
|
44
|
+
Make sure you have the following tools installed on your system:
|
|
45
|
+
|
|
46
|
+
- **Docker**: [Install Docker](https://www.docker.com/products/docker-desktop)
|
|
47
|
+
- **Docker Compose**: [Install Docker Compose](https://docs.docker.com/compose/install/)
|
|
48
|
+
|
|
49
|
+
## Getting Started
|
|
50
|
+
|
|
51
|
+
Follow these steps to run the MACI Relayer service using Docker.
|
|
52
|
+
|
|
53
|
+
### 1. Clone the Repository
|
|
54
|
+
|
|
55
|
+
First, clone the repository to your local machine.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
git clone https://github.com/privacy-scaling-explorations/maci
|
|
59
|
+
cd maci
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 2. Configure Environment Variables
|
|
63
|
+
|
|
64
|
+
The `.env` file contains sensitive configuration values that will be injected into the Docker containers at runtime. To set them up:
|
|
65
|
+
|
|
66
|
+
1. Copy the `.env.example` file to `.env`.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cp .env.example .env
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
2. Edit the `.env` file and configure the variables.
|
|
73
|
+
|
|
74
|
+
## 3. Build and Run the Docker Containers
|
|
75
|
+
|
|
76
|
+
Now that your environment is set up, it's time to build and run the Docker containers.
|
|
77
|
+
|
|
78
|
+
Run the following command from the root directory of your project:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
docker-compose up --build
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This command does the following:
|
|
85
|
+
|
|
86
|
+
- Builds the Docker images based on the Dockerfile and `docker-compose.yml` files.
|
|
87
|
+
- Starts the service container (the MACI relayer application) and the mongodb container.
|
|
88
|
+
|
|
89
|
+
The MACI Relayer service will be available on port 3000 by default (you can modify this in the `.env` file).
|
|
90
|
+
|
|
91
|
+
## 4. Access the Service
|
|
92
|
+
|
|
93
|
+
Once the containers are up and running, you can access the relayer service at:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
http://localhost:3000
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Additionally, the Swagger UI documentation for the Relayer service API can be accessed at:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
http://localhost:3000/api
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
You can interact with the API through the Swagger interface, which provides a convenient way to test endpoints and view the API methods.
|
|
106
|
+
|
|
107
|
+
## 5. Check Logs
|
|
108
|
+
|
|
109
|
+
To view the logs from the containers and troubleshoot any issues, run:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
docker-compose logs
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
This will display logs from both the service (relayer) and mongodb containers.
|
|
116
|
+
|
|
117
|
+
## 6. Stop the Services
|
|
118
|
+
|
|
119
|
+
To stop the containers and remove the containers (but keep the volumes), use the following command:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
docker-compose down
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This will stop and remove the containers but retain the volumes (like MongoDB data). To also remove the volumes, run:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
docker-compose down --volumes
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 7. MongoDB Persistence
|
|
132
|
+
|
|
133
|
+
MongoDB data is persisted using Docker volumes (`mongodb-data`). Even if you remove and recreate the MongoDB container, the data will persist.
|
|
134
|
+
|
|
135
|
+
This ensures that any data stored in the MongoDB database is not lost even if the container is restarted or removed.
|
|
136
|
+
|
|
137
|
+
If you'd like to remove the persisted data as well, you can remove the volume by running:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
docker volume rm your-repo_mongodb-data
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
This will delete the volume, along with all the data stored in MongoDB.
|
|
144
|
+
|
|
145
|
+
## Additional Information
|
|
146
|
+
|
|
147
|
+
For more details, you can read the following post on EthResearch:
|
|
148
|
+
|
|
149
|
+
[MACI with Mostly Off-Chain Happy Path](https://ethresear.ch/t/maci-with-mostly-off-chain-happy-path/19527)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
+
require("@nomicfoundation/hardhat-toolbox");
|
|
4
|
+
const dotenv = require("dotenv");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
dotenv.config();
|
|
7
|
+
const parentDir = __dirname.includes("build") ? ".." : "";
|
|
8
|
+
const TEST_MNEMONIC = "test test test test test test test test test test test junk";
|
|
9
|
+
module.exports = {
|
|
10
|
+
defaultNetwork: "hardhat",
|
|
11
|
+
networks: {
|
|
12
|
+
localhost: {
|
|
13
|
+
url: process.env.RELAYER_RPC_URL || "",
|
|
14
|
+
accounts: {
|
|
15
|
+
mnemonic: process.env.MNEMONIC || TEST_MNEMONIC,
|
|
16
|
+
path: "m/44'/60'/0'/0",
|
|
17
|
+
initialIndex: 0,
|
|
18
|
+
count: 20,
|
|
19
|
+
},
|
|
20
|
+
loggingEnabled: false,
|
|
21
|
+
},
|
|
22
|
+
hardhat: {
|
|
23
|
+
loggingEnabled: false,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
paths: {
|
|
27
|
+
sources: path.resolve(__dirname, parentDir, "./node_modules/@maci-protocol/sdk/node_modules/@maci-protocol/contracts/contracts"),
|
|
28
|
+
artifacts: path.resolve(__dirname, parentDir, "./node_modules/@maci-protocol/sdk/node_modules/@maci-protocol/contracts/artifacts"),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=hardhat.config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hardhat.config.cjs","sourceRoot":"","sources":["../hardhat.config.cjs"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1D,MAAM,aAAa,GAAG,6DAA6D,CAAC;AAEpF,MAAM,CAAC,OAAO,GAAG;IACf,cAAc,EAAE,SAAS;IACzB,QAAQ,EAAE;QACR,SAAS,EAAE;YACT,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE;YACtC,QAAQ,EAAE;gBACR,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa;gBAC/C,IAAI,EAAE,gBAAgB;gBACtB,YAAY,EAAE,CAAC;gBACf,KAAK,EAAE,EAAE;aACV;YACD,cAAc,EAAE,KAAK;SACtB;QACD,OAAO,EAAE;YACP,cAAc,EAAE,KAAK;SACtB;KACF;IACD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI,CAAC,OAAO,CACnB,SAAS,EACT,SAAS,EACT,mFAAmF,CACpF;QACD,SAAS,EAAE,IAAI,CAAC,OAAO,CACrB,SAAS,EACT,SAAS,EACT,mFAAmF,CACpF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export let defaultNetwork: string;
|
|
2
|
+
export namespace networks {
|
|
3
|
+
namespace localhost {
|
|
4
|
+
let url: string;
|
|
5
|
+
namespace accounts {
|
|
6
|
+
let mnemonic: string;
|
|
7
|
+
let path: string;
|
|
8
|
+
let initialIndex: number;
|
|
9
|
+
let count: number;
|
|
10
|
+
}
|
|
11
|
+
let loggingEnabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
namespace hardhat {
|
|
14
|
+
let loggingEnabled_1: boolean;
|
|
15
|
+
export { loggingEnabled_1 as loggingEnabled };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export namespace paths {
|
|
19
|
+
let sources: string;
|
|
20
|
+
let artifacts: string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=hardhat.config.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hardhat.config.d.cts","sourceRoot":"","sources":["../hardhat.config.cjs"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.test.d.ts","sourceRoot":"","sources":["../../tests/app.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HttpStatus, ValidationPipe } from "@nestjs/common";
|
|
2
|
+
import { Test } from "@nestjs/testing";
|
|
3
|
+
import request from "supertest";
|
|
4
|
+
import { AppModule } from "../ts/app.module.js";
|
|
5
|
+
describe("Integration", () => {
|
|
6
|
+
let app;
|
|
7
|
+
beforeAll(async () => {
|
|
8
|
+
const moduleFixture = await Test.createTestingModule({
|
|
9
|
+
imports: [AppModule],
|
|
10
|
+
}).compile();
|
|
11
|
+
app = moduleFixture.createNestApplication();
|
|
12
|
+
app.useGlobalPipes(new ValidationPipe({ transform: true }));
|
|
13
|
+
await app.listen(3000);
|
|
14
|
+
});
|
|
15
|
+
afterAll(async () => {
|
|
16
|
+
await app.close();
|
|
17
|
+
});
|
|
18
|
+
test("should throw an error if api is not found", async () => {
|
|
19
|
+
const result = await request(app.getHttpServer()).get("/unknown").send().expect(404);
|
|
20
|
+
expect(result.body).toStrictEqual({
|
|
21
|
+
error: "Not Found",
|
|
22
|
+
statusCode: HttpStatus.NOT_FOUND,
|
|
23
|
+
message: "Cannot GET /unknown",
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
test("should check health properly", async () => {
|
|
27
|
+
await request(app.getHttpServer()).get("/v1/health/check").send().expect(200);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=app.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.test.js","sourceRoot":"","sources":["../../tests/app.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAyB,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,OAAO,MAAM,WAAW,CAAC;AAIhC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,GAA2B,CAAC;IAEhC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC;YACnD,OAAO,EAAE,CAAC,SAAS,CAAC;SACrB,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,GAAG,GAAG,aAAa,CAAC,qBAAqB,EAAE,CAAC;QAC5C,GAAG,CAAC,cAAc,CAAC,IAAI,cAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC5D,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QAC3D,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAErF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC;YAChC,KAAK,EAAE,WAAW;YAClB,UAAU,EAAE,UAAU,CAAC,SAAS;YAChC,OAAO,EAAE,qBAAqB;SAC/B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type request from "supertest";
|
|
2
|
+
export declare const STATE_TREE_DEPTH = 10;
|
|
3
|
+
export declare const INT_STATE_TREE_DEPTH = 1;
|
|
4
|
+
export declare const VOTE_OPTION_TREE_DEPTH = 2;
|
|
5
|
+
export declare const MESSAGE_BATCH_SIZE = 20;
|
|
6
|
+
export declare const DEFAULT_INITIAL_VOICE_CREDITS = 99;
|
|
7
|
+
export declare const DEFAULT_VOTE_OPTIONS = 25;
|
|
8
|
+
export declare const dirname: string;
|
|
9
|
+
export declare const pollJoiningZkey: string;
|
|
10
|
+
export declare const pollJoinedZkey: string;
|
|
11
|
+
export declare const pollWasm: string;
|
|
12
|
+
export declare const pollWitgen: string;
|
|
13
|
+
export declare const pollJoinedWasm: string;
|
|
14
|
+
export declare const pollJoinedWitgen: string;
|
|
15
|
+
export declare const rapidsnark: string;
|
|
16
|
+
export declare const processMessagesZkeyPathNonQv: string;
|
|
17
|
+
export declare const tallyVotesZkeyPathNonQv: string;
|
|
18
|
+
export type TApp = Parameters<typeof request>[0];
|
|
19
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../tests/constants.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,eAAO,MAAM,OAAO,QAAmD,CAAC;AAExE,eAAO,MAAM,eAAe,QAAmF,CAAC;AAChH,eAAO,MAAM,cAAc,QAAiF,CAAC;AAC7G,eAAO,MAAM,QAAQ,QAGpB,CAAC;AACF,eAAO,MAAM,UAAU,QAGtB,CAAC;AACF,eAAO,MAAM,cAAc,QAG1B,CAAC;AACF,eAAO,MAAM,gBAAgB,QAG5B,CAAC;AACF,eAAO,MAAM,UAAU,QAAyC,CAAC;AACjE,eAAO,MAAM,4BAA4B,QAGxC,CAAC;AACF,eAAO,MAAM,uBAAuB,QAGnC,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { homedir } from "os";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import url from "url";
|
|
4
|
+
export const STATE_TREE_DEPTH = 10;
|
|
5
|
+
export const INT_STATE_TREE_DEPTH = 1;
|
|
6
|
+
export const VOTE_OPTION_TREE_DEPTH = 2;
|
|
7
|
+
export const MESSAGE_BATCH_SIZE = 20;
|
|
8
|
+
export const DEFAULT_INITIAL_VOICE_CREDITS = 99;
|
|
9
|
+
export const DEFAULT_VOTE_OPTIONS = 25;
|
|
10
|
+
export const dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
11
|
+
export const pollJoiningZkey = path.resolve(dirname, "../zkeys/PollJoining_10_test/PollJoining_10_test.0.zkey");
|
|
12
|
+
export const pollJoinedZkey = path.resolve(dirname, "../zkeys/PollJoined_10_test/PollJoined_10_test.0.zkey");
|
|
13
|
+
export const pollWasm = path.resolve(dirname, "../zkeys/PollJoining_10_test/PollJoining_10_test_js/PollJoining_10_test.wasm");
|
|
14
|
+
export const pollWitgen = path.resolve(dirname, "../zkeys/PollJoining_10_test/PollJoining_10_test_cpp/PollJoining_10_test");
|
|
15
|
+
export const pollJoinedWasm = path.resolve(dirname, "../zkeys/PollJoined_10_test/PollJoined_10_test_js/PollJoined_10_test.wasm");
|
|
16
|
+
export const pollJoinedWitgen = path.resolve(dirname, "../zkeys/PollJoined_10_test/PollJoined_10_test_cpp/PollJoined_10_test");
|
|
17
|
+
export const rapidsnark = `${homedir()}/rapidsnark/build/prover`;
|
|
18
|
+
export const processMessagesZkeyPathNonQv = path.resolve(dirname, "../zkeys/ProcessMessagesNonQv_10-20-2_test/ProcessMessagesNonQv_10-20-2_test.0.zkey");
|
|
19
|
+
export const tallyVotesZkeyPathNonQv = path.resolve(dirname, "../zkeys/TallyVotesNonQv_10-1-2_test/TallyVotesNonQv_10-1-2_test.0.zkey");
|
|
20
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../tests/constants.ts"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4B,GAAG,IAAI,CAAC,OAAO,CACtD,OAAO,EACP,qFAAqF,CACtF,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,OAAO,CACjD,OAAO,EACP,yEAAyE,CAC1E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageBatches.test.d.ts","sourceRoot":"","sources":["../../tests/messageBatches.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jest } from "@jest/globals";
|
|
2
|
+
import { Keypair } from "@maci-protocol/domainobjs";
|
|
3
|
+
import { formatProofForVerifierContract, genProofSnarkjs } from "@maci-protocol/sdk";
|
|
4
|
+
import { TestingClass } from "@maci-protocol/testing";
|
|
5
|
+
import { HttpStatus, ValidationPipe } from "@nestjs/common";
|
|
6
|
+
import { Test } from "@nestjs/testing";
|
|
7
|
+
import request from "supertest";
|
|
8
|
+
import { AppModule } from "../ts/app.module.js";
|
|
9
|
+
import { pollJoinedWasm, pollJoinedZkey, pollJoiningZkey, pollWasm, pollWitgen, processMessagesZkeyPathNonQv, rapidsnark, tallyVotesZkeyPathNonQv, } from "./constants.js";
|
|
10
|
+
jest.unmock("@maci-protocol/sdk");
|
|
11
|
+
describe("Integration message batches", () => {
|
|
12
|
+
let app;
|
|
13
|
+
let maciContractAddress;
|
|
14
|
+
let user;
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
await TestingClass.sleep(1_000);
|
|
17
|
+
const testDeploy = await TestingClass.getInstance({
|
|
18
|
+
pollJoiningZkeyPath: pollJoiningZkey,
|
|
19
|
+
pollJoinedZkeyPath: pollJoinedZkey,
|
|
20
|
+
processMessagesZkeyPath: processMessagesZkeyPathNonQv,
|
|
21
|
+
tallyVotesZkeyPath: tallyVotesZkeyPathNonQv,
|
|
22
|
+
pollWasm,
|
|
23
|
+
pollWitgen,
|
|
24
|
+
rapidsnark,
|
|
25
|
+
});
|
|
26
|
+
const poll = testDeploy.contractsData.maciState.polls.get(0n);
|
|
27
|
+
poll.updatePoll(BigInt(testDeploy.contractsData.maciState.pubKeys.length));
|
|
28
|
+
maciContractAddress = testDeploy.contractsData.maciContractAddress;
|
|
29
|
+
[user] = testDeploy.contractsData.users;
|
|
30
|
+
const moduleFixture = await Test.createTestingModule({
|
|
31
|
+
imports: [AppModule],
|
|
32
|
+
}).compile();
|
|
33
|
+
app = moduleFixture.createNestApplication();
|
|
34
|
+
app.useGlobalPipes(new ValidationPipe({ transform: true }));
|
|
35
|
+
await app.listen(3001);
|
|
36
|
+
const circuitInputs = poll.joinedCircuitInputs({
|
|
37
|
+
maciPrivKey: user.keypair.privKey,
|
|
38
|
+
stateLeafIndex: user.stateLeafIndex,
|
|
39
|
+
voiceCreditsBalance: user.voiceCreditBalance,
|
|
40
|
+
joinTimestamp: user.timestamp,
|
|
41
|
+
});
|
|
42
|
+
const { proof } = await genProofSnarkjs({
|
|
43
|
+
inputs: circuitInputs,
|
|
44
|
+
zkeyPath: pollJoinedZkey,
|
|
45
|
+
wasmPath: pollJoinedWasm,
|
|
46
|
+
});
|
|
47
|
+
const keypair = new Keypair();
|
|
48
|
+
await request(app.getHttpServer())
|
|
49
|
+
.post("/v1/messages/publish")
|
|
50
|
+
.send({
|
|
51
|
+
messages: [
|
|
52
|
+
{
|
|
53
|
+
data: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
54
|
+
publicKey: keypair.pubKey.serialize(),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
poll: 0,
|
|
58
|
+
maciContractAddress,
|
|
59
|
+
stateLeafIndex: Number(user.stateLeafIndex),
|
|
60
|
+
proof: formatProofForVerifierContract(proof),
|
|
61
|
+
})
|
|
62
|
+
.expect(HttpStatus.CREATED);
|
|
63
|
+
});
|
|
64
|
+
afterAll(async () => {
|
|
65
|
+
TestingClass.clean();
|
|
66
|
+
await app.close();
|
|
67
|
+
});
|
|
68
|
+
describe("/v1/messageBatches/get", () => {
|
|
69
|
+
test("should throw an error if dto is invalid", async () => {
|
|
70
|
+
const result = await request(app.getHttpServer())
|
|
71
|
+
.get("/v1/messageBatches/get")
|
|
72
|
+
.send({
|
|
73
|
+
limit: 0,
|
|
74
|
+
skip: -1,
|
|
75
|
+
poll: -1,
|
|
76
|
+
maciContractAddress: "invalid",
|
|
77
|
+
publicKeys: ["invalid"],
|
|
78
|
+
ipfsHashes: ["invalid1", "invalid2"],
|
|
79
|
+
})
|
|
80
|
+
.expect(HttpStatus.BAD_REQUEST);
|
|
81
|
+
expect(result.body).toStrictEqual({
|
|
82
|
+
error: "Bad Request",
|
|
83
|
+
statusCode: HttpStatus.BAD_REQUEST,
|
|
84
|
+
message: [
|
|
85
|
+
"limit must be a positive number",
|
|
86
|
+
"skip must not be less than 0",
|
|
87
|
+
"poll must not be less than 0",
|
|
88
|
+
"maciContractAddress must be an Ethereum address",
|
|
89
|
+
"IPFS hash is invalid",
|
|
90
|
+
"Public key is invalid",
|
|
91
|
+
],
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
test("should get message batches properly", async () => {
|
|
95
|
+
const result = await request(app.getHttpServer())
|
|
96
|
+
.get("/v1/messageBatches/get")
|
|
97
|
+
.send({
|
|
98
|
+
limit: 10,
|
|
99
|
+
skip: 0,
|
|
100
|
+
poll: 0,
|
|
101
|
+
maciContractAddress,
|
|
102
|
+
publicKeys: [user.keypair.pubKey.serialize()],
|
|
103
|
+
})
|
|
104
|
+
.expect(HttpStatus.OK);
|
|
105
|
+
expect(result.status).toBe(HttpStatus.OK);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=messageBatches.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageBatches.test.js","sourceRoot":"","sources":["../../tests/messageBatches.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,M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