Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(zkeys): use ts to download zkey artifacts and simplify repo #1505

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import dotenv from "dotenv";
import * as tar from "tar";

import fs from "fs";
import https from "https";
import path from "path";

dotenv.config({ path: [path.resolve(__dirname, "../.env"), path.resolve(__dirname, "../.env.example")] });

const ZKEY_PATH = path.resolve(process.env.COORDINATOR_ZKEY_PATH!);
const ZKEY_PATH = path.resolve(process.argv.slice(3)[0]);
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 +32,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, strip: 1 }).then(() => fs.promises.rm(ARCHIVE_NAME));
})
.on("error", () => fs.promises.unlink(ARCHIVE_NAME));
})
Expand Down
5 changes: 2 additions & 3 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: "./zkeys/"
COORDINATOR_RAPIDSNARK_EXE: "~/rapidsnark/build/prover"

concurrency:
Expand Down Expand Up @@ -98,8 +98,7 @@ jobs:
- name: Download zkeys
if: ${{ env.CHANGED == 'false' }}
run: |
pnpm download-zkeys:test
working-directory: coordinator
pnpm download-zkeys-coordinator:test

- 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.

2 changes: 1 addition & 1 deletion coordinator/apps/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ ARG PORT=3000

WORKDIR ./maci
COPY --chown=node:node --from=builder /builder/ ./
RUN pnpm run download-zkeys-coordinator:test
WORKDIR /maci/coordinator
RUN pnpm run download-zkeys:test
RUN pnpm run generate-keypair

EXPOSE ${PORT}
Expand Down
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: 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.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"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": "ts-node ./.github/scripts/downloadZkeys.ts test ./cli/zkeys",
"download-zkeys:ceremony": "ts-node ./.github/scripts/downloadZkeys.ts prod ./cli/zkeys",
"download-zkeys-coordinator:test": "ts-node ./.github/scripts/downloadZkeys.ts test ./coordinator/zkeys",
"prettier": "prettier -c .",
"prettier:fix": "prettier -w .",
"lint:ts": "eslint './**/**/*.ts' './**/**/*.tsx'",
Expand Down Expand Up @@ -55,6 +55,8 @@
"prettier": "^3.2.5",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^5.0.1",
"tar": "^7.1.0",
"ts-node": "^10.9.1",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.4.5"
Expand Down
Loading
Loading