Skip to content

Commit

Permalink
fix(cli): prioritize contract addresses params
Browse files Browse the repository at this point in the history
do no throw when the contract addresses file is not present but a contract address has been provided

fix #1039
  • Loading branch information
ctrlc03 committed Jan 18, 2024
1 parent ac7527b commit 8ec36c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
12 changes: 6 additions & 6 deletions cli/testScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ node build/ts/index.js setVerifyingKeys \
--msg-tree-depth 2 \
--vote-option-tree-depth 2 \
--msg-batch-depth 1 \
--process-messages-zkey ./zkeys/ProcessMessages_10-2-1-2_test.0.zkey \
--tally-votes-zkey ./zkeys/TallyVotes_10-1-2_test.0.zkey
--process-messages-zkey ./zkeys/ProcessMessages_10-2-1-2_test/ProcessMessages_10-2-1-2_test.0.zkey \
--tally-votes-zkey ./zkeys/TallyVotes_10-1-2_test/TallyVotes_10-1-2_test.0.zkey
node build/ts/index.js create -s 10
node build/ts/index.js deployPoll \
--pubkey macipk.ea638a3366ed91f2e955110888573861f7c0fc0bb5fb8b8dca9cd7a08d7d6b93 \
Expand Down Expand Up @@ -38,12 +38,12 @@ node build/ts/index.js mergeMessages --poll-id 0
node build/ts/index.js genProofs \
--privkey macisk.1751146b59d32e3c0d7426de411218172428263f93b2fc4d981c036047a4d8c0 \
--poll-id 0 \
--process-zkey ./zkeys/ProcessMessages_10-2-1-2_test.0.zkey \
--tally-zkey ./zkeys/TallyVotes_10-1-2_test.0.zkey \
--process-zkey ./zkeys/ProcessMessages_10-2-1-2_test/ProcessMessages_10-2-1-2_test.0.zkey \
--tally-zkey ./zkeys/TallyVotes_10-1-2_test/TallyVotes_10-1-2_test.0.zkey \
--tally-file tally.json \
--output proofs/ \
-tw ./zkeys/TallyVotes_10-1-2_test_js/TallyVotes_10-1-2_test.wasm \
-pw ./zkeys/ProcessMessages_10-2-1-2_test_js/ProcessMessages_10-2-1-2_test.wasm \
-tw ./zkeys/TallyVotes_10-1-2_test/TallyVotes_10-1-2_test_js/TallyVotes_10-1-2_test.wasm \
-pw ./zkeys/ProcessMessages_10-2-1-2_test/ProcessMessages_10-2-1-2_test_js/ProcessMessages_10-2-1-2_test.wasm \
-w true
node build/ts/index.js proveOnChain \
--poll-id 0 \
Expand Down
2 changes: 1 addition & 1 deletion cli/ts/commands/proveOnChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const proveOnChain = async (
quiet,
error(
`The proof files inside ${proofDir} do not have the correct number of message processign proofs` +
`(expected ${totalMessageBatches}, got ${numProcessProofs}.`,
`(expected ${totalMessageBatches}, got ${numProcessProofs}).`,
),
);
}
Expand Down
7 changes: 5 additions & 2 deletions cli/ts/utils/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ export const storeContractAddress = (contractName: string, address: string): voi
* @returns the contract address or a undefined it it does not exist
*/
export const readContractAddress = (contractName: string): string => {
const contractAddrs = readJSONFile(contractAddressesStore);
return contractAddrs[contractName] || "";
try {
return readJSONFile(contractAddressesStore)[contractName] || "";
} catch (error) {
return "";
}
};

/**
Expand Down

0 comments on commit 8ec36c4

Please sign in to comment.