Skip to content

Commit

Permalink
feat: add interfaces and factory contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
kittybest committed Jan 12, 2024
1 parent dcca295 commit dc2822d
Show file tree
Hide file tree
Showing 48 changed files with 938 additions and 687 deletions.
5 changes: 4 additions & 1 deletion .github/scripts/ceremony-param-tests-c-witness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js deployPoll \
--msg-tree-depth 8 \
--msg-batch-depth 2 \
--vote-option-tree-depth 3 \
--subsidy-enabled false \
-q true
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js signup \
--pubkey macipk.e743ffb5298ef0f5c1f63b6464a48fea19ea7ee5a885c67ae1b24a1d04f03f07 \
Expand Down Expand Up @@ -64,8 +65,10 @@ HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js genProofs \
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js proveOnChain \
--poll-id 0 \
--proof-dir proofs/ \
--subsidy-enabled false \
-q true
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js verify \
--poll-id 0 \
--subsidy-enabled false \
--tally-file tally.json \
-q true
-q true
6 changes: 3 additions & 3 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"postbuild": "cp package.json ./build",
"types": "tsc -p tsconfig.json --noEmit",
"test": "nyc ts-mocha --exit tests/**/*.test.ts",
"test:e2e": "ts-mocha --exit tests/e2e.test.ts",
"test:e2e-subsidy": "ts-mocha --exit tests/e2e.subsidy.test.ts",
"test:keyChange": "ts-mocha --exit tests/keyChange.test.ts",
"test:e2e": "ts-mocha --exit tests/e2e/e2e.test.ts",
"test:e2e-subsidy": "ts-mocha --exit tests/e2e/e2e.subsidy.test.ts",
"test:keyChange": "ts-mocha --exit tests/e2e/keyChange.test.ts",
"test:unit": "nyc ts-mocha --exit tests/unit/*.test.ts",
"test:airdrop": "nyc ts-mocha --exit tests/unit/airdrop.test.ts",
"test:genPubKey": "ts-mocha --exit tests/unit/genPubKey.test.ts",
Expand Down
4 changes: 3 additions & 1 deletion cli/testScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js setVerifyingKeys
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js create -s 10
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js deployPoll \
--pubkey macipk.ea638a3366ed91f2e955110888573861f7c0fc0bb5fb8b8dca9cd7a08d7d6b93 \
-t 30 -g 25 -mv 25 -i 1 -m 2 -b 1 -v 2
-t 30 -g 25 -mv 25 -i 1 -m 2 -b 1 -v 2 -se false
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js signup \
--pubkey macipk.e743ffb5298ef0f5c1f63b6464a48fea19ea7ee5a885c67ae1b24a1d04f03f07
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js publish \
Expand Down Expand Up @@ -48,6 +48,8 @@ HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js genProofs \
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js proveOnChain \
--poll-id 0 \
--proof-dir proofs/
--subsidy-enabled false
HARDHAT_CONFIG=./build/hardhat.config.js node build/ts/index.js verify \
--poll-id 0 \
--subsidy-enabled false \
--tally-file tally.json
24 changes: 20 additions & 4 deletions cli/tests/e2e/e2e.subsidy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ describe("e2e with Subsidy tests", function test() {
let pollAddresses: PollContracts;
let vkRegistryContractAddress: string;

const subsidyEnabled = true;

before(async () => {
// we deploy the vk registry contract
vkRegistryContractAddress = await deployVkRegistryContract(true);
Expand Down Expand Up @@ -89,6 +91,7 @@ describe("e2e with Subsidy tests", function test() {
MSG_TREE_DEPTH,
VOTE_OPTION_TREE_DEPTH,
coordinatorPubKey,
subsidyEnabled,
);
});

Expand Down Expand Up @@ -193,9 +196,10 @@ describe("e2e with Subsidy tests", function test() {
testSubsidyWasmPath,
useWasm,
);
await proveOnChain("0", testProofsDirPath);
await proveOnChain("0", testProofsDirPath, subsidyEnabled);
await verify(
"0",
subsidyEnabled,
testTallyFilePath,
tallyData,
maciAddresses.maciAddress,
Expand Down Expand Up @@ -236,6 +240,7 @@ describe("e2e with Subsidy tests", function test() {
MSG_TREE_DEPTH,
VOTE_OPTION_TREE_DEPTH,
coordinatorPubKey,
subsidyEnabled,
);
});

Expand Down Expand Up @@ -285,9 +290,10 @@ describe("e2e with Subsidy tests", function test() {
testSubsidyWasmPath,
useWasm,
);
await proveOnChain("0", testProofsDirPath);
await proveOnChain("0", testProofsDirPath, subsidyEnabled);
await verify(
"0",
subsidyEnabled,
testTallyFilePath,
tallyData,
maciAddresses.maciAddress,
Expand Down Expand Up @@ -318,6 +324,7 @@ describe("e2e with Subsidy tests", function test() {
MSG_TREE_DEPTH,
VOTE_OPTION_TREE_DEPTH,
coordinatorPubKey,
subsidyEnabled,
);
});

Expand Down Expand Up @@ -369,9 +376,10 @@ describe("e2e with Subsidy tests", function test() {
testSubsidyWasmPath,
useWasm,
);
await proveOnChain("0", testProofsDirPath);
await proveOnChain("0", testProofsDirPath, subsidyEnabled);
await verify(
"0",
subsidyEnabled,
testTallyFilePath,
tallyData,
maciAddresses.maciAddress,
Expand Down Expand Up @@ -415,6 +423,7 @@ describe("e2e with Subsidy tests", function test() {
MSG_TREE_DEPTH,
VOTE_OPTION_TREE_DEPTH,
coordinatorPubKey,
subsidyEnabled,
);
// signup
// eslint-disable-next-line @typescript-eslint/prefer-for-of
Expand Down Expand Up @@ -459,9 +468,10 @@ describe("e2e with Subsidy tests", function test() {
testSubsidyWasmPath,
useWasm,
);
await proveOnChain("0", testProofsDirPath);
await proveOnChain("0", testProofsDirPath, subsidyEnabled);
await verify(
"0",
subsidyEnabled,
testTallyFilePath,
tallyData,
maciAddresses.maciAddress,
Expand All @@ -483,6 +493,7 @@ describe("e2e with Subsidy tests", function test() {
MSG_TREE_DEPTH,
VOTE_OPTION_TREE_DEPTH,
coordinatorPubKey,
subsidyEnabled,
);
secondPollAddresses = await deployPoll(
pollDuration,
Expand All @@ -493,6 +504,7 @@ describe("e2e with Subsidy tests", function test() {
MSG_TREE_DEPTH,
VOTE_OPTION_TREE_DEPTH,
coordinatorPubKey,
subsidyEnabled,
);
});

Expand Down Expand Up @@ -597,13 +609,15 @@ describe("e2e with Subsidy tests", function test() {
await proveOnChain(
"1",
testProofsDirPath,
subsidyEnabled,
maciAddresses.maciAddress,
pollAddresses.messageProcessor,
pollAddresses.tally,
pollAddresses.subsidy,
);
await verify(
"1",
subsidyEnabled,
testTallyFilePath,
tallyData,
maciAddresses.maciAddress,
Expand Down Expand Up @@ -640,13 +654,15 @@ describe("e2e with Subsidy tests", function test() {
await proveOnChain(
"2",
testProofsDirPath,
subsidyEnabled,
maciAddresses.maciAddress,
secondPollAddresses.messageProcessor,
secondPollAddresses.tally,
secondPollAddresses.subsidy,
);
await verify(
"2",
subsidyEnabled,
testTallyFilePath,
tallyData,
maciAddresses.maciAddress,
Expand Down
Loading

0 comments on commit dc2822d

Please sign in to comment.