Skip to content

Commit

Permalink
chore(zkeys): use ts to download zkey artifacts and simplify repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 committed May 23, 2024
1 parent 9cb775f commit d04f22e
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 73 deletions.
15 changes: 0 additions & 15 deletions .github/scripts/download-ceremony-artifacts.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .github/scripts/download-zkeys-1-3.sh

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/coordinator-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
COORDINATOR_PRIVATE_KEY_PATH: "./priv.key"
COORDINATOR_TALLY_ZKEY_NAME: "TallyVotes_10-1-2_test"
COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME: "ProcessMessages_10-2-1-2_test"
COORDINATOR_ZKEY_PATH: "./zkeys"
COORDINATOR_ZKEY_PATH: "./coordinator/zkeys"
COORDINATOR_RAPIDSNARK_EXE: "~/rapidsnark/build/prover"

concurrency:
Expand Down Expand Up @@ -99,7 +99,6 @@ jobs:
if: ${{ env.CHANGED == 'false' }}
run: |
pnpm download-zkeys:test
working-directory: coordinator
- name: Generate keypair
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-ceremony.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
chmod +x ~/rapidsnark/build/prover
- name: Download ceremony artifacts
run: ./.github/scripts/download-ceremony-artifacts.sh
run: pnpm download-zkeys:ceremony

- name: Run e2e tests
run: pnpm test:cli-ceremony
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Download zkeys
if: ${{ env.CHANGED == 'false' }}
run: |
pnpm download:test-zkeys-1-3
pnpm download-zkeys:test
- name: ${{ matrix.command }}
run: pnpm run ${{ matrix.command }}
Expand Down
8 changes: 0 additions & 8 deletions cli/scripts/gen_zkey.sh

This file was deleted.

1 change: 0 additions & 1 deletion coordinator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"test": "jest",
"test:coverage": "jest --coverage",
"types": "tsc -p tsconfig.json --noEmit",
"download-zkeys:test": "ts-node ./scripts/downloadZkeys.ts test",
"generate-keypair": "ts-node ./scripts/generateKeypair.ts"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion coordinator/scripts/downloadZkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dotenv.config({ path: [path.resolve(__dirname, "../.env"), path.resolve(__dirnam
const ZKEY_PATH = path.resolve(process.env.COORDINATOR_ZKEY_PATH!);
const ZKEYS_URLS = {
test: "https://maci-develop-fra.s3.eu-central-1.amazonaws.com/v1.3.0/maci_artifacts_10-2-1-2_test.tar.gz",
prod: "https://maci-develop-fra.s3.eu-central-1.amazonaws.com/v1.2.0/maci_artifacts_6-9-2-3_prod.tar.gz",
};
const ARCHIVE_NAME = path.resolve(ZKEY_PATH, "maci_keys.tar.gz");

Expand All @@ -34,7 +35,7 @@ export async function downloadZkeys(): Promise<void> {
.on("finish", () => {
file.close();

tar.x({ f: ARCHIVE_NAME }).then(() => fs.promises.rm(ARCHIVE_NAME));
tar.x({ f: ARCHIVE_NAME, C: ZKEY_PATH }).then(() => fs.promises.rm(ARCHIVE_NAME));
})
.on("error", () => fs.promises.unlink(ARCHIVE_NAME));
})
Expand Down
3 changes: 1 addition & 2 deletions integrationTests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"types": "tsc -p tsconfig.json --noEmit",
"test": "ts-mocha --exit ./ts/__tests__/**.test.ts",
"test:integration": "NODE_OPTIONS=--max-old-space-size=4096 ts-mocha --exit ./ts/__tests__/integration.test.ts",
"test:maciKeys": "ts-mocha --exit ./ts/__tests__/maci-keys.test.ts",
"download-zkeys": "./scripts/download_zkeys.sh"
"test:maciKeys": "ts-mocha --exit ./ts/__tests__/maci-keys.test.ts"
},
"devDependencies": {
"@types/chai": "^4.3.11",
Expand Down
14 changes: 0 additions & 14 deletions integrationTests/scripts/download_zkeys.sh

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
"setup:zkeys": "NODE_OPTIONS=--max-old-space-size=4096 lerna run gen-zkeys --scope \"maci-circuits\"",
"clean": "lerna exec -- rm -rf node_modules build && rm -rf node_modules",
"commit": "git cz",
"download:test-zkeys-1-2": "lerna run download-zkeys --scope \"maci-integrationtests\"",
"download:test-zkeys-1-3": "bash .github/scripts/download-zkeys-1-3.sh",
"download:ceremony-zkeys": "bash .github/scripts/download-ceremony-artifacts.sh",
"download-zkeys:test": "export COORDINATOR_ZKEY_PATH=./cli && ts-node ./coordinator/scripts/downloadZkeys.ts test",
"download-zkeys:ceremony": "export COORDINATOR_ZKEY_PATH=./cli && ts-node ./coordinator/scripts/downloadZkeys.ts prod",
"prettier": "prettier -c .",
"prettier:fix": "prettier -w .",
"lint:ts": "eslint './**/**/*.ts' './**/**/*.tsx'",
Expand Down Expand Up @@ -55,6 +54,7 @@
"prettier": "^3.2.5",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^5.0.1",
"ts-node": "^10.9.1",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.4.5"
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,15 @@ Note the locations of the `.zkey` files as the CLI requires them as command-line
If using the latest dev updates:
```bash
pnpm download:test-zkeys-1-3
pnpm download-zkeys:test
```
If using **1.2.1**

```bash
pnpm download:test-zkeys-1-2
```

Note that the below will work up until **1.2.1**

**Download ceremony artifacts**

:::info
Currently, the ceremony artifacts work with MACI version up to 1.2.2.
:::

```bash
pnpm download:ceremony-zkeys
pnpm download-zkeys:ceremony
```

0 comments on commit d04f22e

Please sign in to comment.