Skip to content

Commit

Permalink
merged with the develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Apr 22, 2024
2 parents 179e0da + b9b667b commit a307709
Show file tree
Hide file tree
Showing 52 changed files with 1,709 additions and 544 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/finalize-round.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ env:
CIRCUIT_TYPE: micro
ZKEYS_DOWNLOAD_SCRIPT: "download-6-9-2-3.sh"
JSONRPC_HTTP_URL: ${{ github.event.inputs.jsonrpc_url }}
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }}

jobs:
finalize:
Expand Down Expand Up @@ -84,10 +86,9 @@ jobs:
mkdir -p proof_output
yarn hardhat tally --clrfund "${CLRFUND_ADDRESS}" --network "${NETWORK}" \
--rapidsnark ${RAPID_SNARK} \
--circuit-directory ${CIRCUIT_DIRECTORY} \
--params-dir ${CIRCUIT_DIRECTORY} \
--blocks-per-batch ${BLOCKS_PER_BATCH} \
--maci-tx-hash "${MACI_TX_HASH}" --output-dir "./proof_output"
curl --location --request POST 'https://api.pinata.cloud/pinning/pinFileToIPFS' \
--header "Authorization: Bearer ${{ secrets.PINATA_JWT }}" \
--form 'file=@"./proof_output/tally.json"'
yarn hardhat --network "${NETWORK}" finalize --clrfund "${CLRFUND_ADDRESS}"
--maci-tx-hash "${MACI_TX_HASH}" \
--proof-dir "./proof_output"
yarn hardhat --network "${NETWORK}" finalize --clrfund "${CLRFUND_ADDRESS}" \
--proof-dir "./proof_output"
2 changes: 2 additions & 0 deletions .github/workflows/test-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
env:
NODE_VERSION: 20.x
ZKEYS_DOWNLOAD_SCRIPT: "download-6-9-2-3.sh"
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }}

jobs:
script-tests:
Expand Down
6 changes: 5 additions & 1 deletion contracts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ JSONRPC_HTTP_URL=https://eth-goerli.alchemyapi.io/v2/ADD_API_KEY
WALLET_MNEMONIC=
WALLET_PRIVATE_KEY=

# The coordinator MACI private key, required by the tally script
# The coordinator MACI private key, required by the gen-proofs script
COORDINATOR_MACISK=

# API key used to verify contracts on arbitrum chain (including testnet)
# Update the etherscan section in hardhat.config to add API key for other chains
ARBISCAN_API_KEY=

# PINATE credentials to upload tally.json file to IPFS; used by the tally script
PINATA_API_KEY=
PINATA_SECRET_API_KEY=

# these are used in the e2e testing
CIRCUIT_TYPE=
CIRCUIT_DIRECTORY=
Expand Down
4 changes: 4 additions & 0 deletions contracts/e2e/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import path from 'path'
import { FundingRound } from '../typechain-types'
import { JSONFile } from '../utils/JSONFile'
import { EContracts } from '../utils/types'
import { getTalyFilePath } from '../utils/misc'

type VoteData = { recipientIndex: number; voiceCredits: bigint }
type ClaimData = { [index: number]: bigint }
Expand Down Expand Up @@ -359,6 +360,8 @@ describe('End-to-end Tests', function () {
mkdirSync(outputDir, { recursive: true })
}

const tallyFile = getTalyFilePath(outputDir)

// past an end block that's later than the MACI start block
const genProofArgs = getGenProofArgs({
maciAddress,
Expand All @@ -368,6 +371,7 @@ describe('End-to-end Tests', function () {
circuitType: circuit,
circuitDirectory,
outputDir,
tallyFile,
blocksPerBatch: DEFAULT_GET_LOG_BATCH_SIZE,
maciTxHash: maciTransactionHash,
signer: coordinator,
Expand Down
3 changes: 2 additions & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clrfund/contracts",
"version": "5.1.0",
"version": "5.1.1",
"license": "GPL-3.0",
"scripts": {
"hardhat": "hardhat",
Expand All @@ -16,6 +16,7 @@
},
"dependencies": {
"@openzeppelin/contracts": "4.9.0",
"@pinata/sdk": "^2.1.0",
"dotenv": "^8.2.0",
"maci-contracts": "^1.2.0",
"solidity-rlp": "2.0.8"
Expand Down
12 changes: 6 additions & 6 deletions contracts/sh/runScriptTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ yarn hardhat contribute --network ${HARDHAT_NETWORK}

yarn hardhat time-travel --seconds ${ROUND_DURATION} --network ${HARDHAT_NETWORK}

# run the tally script
# tally the votes
NODE_OPTIONS="--max-old-space-size=4096"
yarn hardhat tally \
--rapidsnark ${RAPID_SNARK} \
--batch-size 8 \
--output-dir ${OUTPUT_DIR} \
--proof-dir ${OUTPUT_DIR} \
--maci-start-block 0 \
--network "${HARDHAT_NETWORK}"

# finalize the round
yarn hardhat finalize --tally-file ${TALLY_FILE} --network ${HARDHAT_NETWORK}
yarn hardhat finalize --proof-dir ${OUTPUT_DIR} --network ${HARDHAT_NETWORK}

# claim funds
yarn hardhat claim --recipient 1 --tally-file ${TALLY_FILE} --network ${HARDHAT_NETWORK}
yarn hardhat claim --recipient 2 --tally-file ${TALLY_FILE} --network ${HARDHAT_NETWORK}
yarn hardhat claim --recipient 1 --proof-dir ${OUTPUT_DIR} --network ${HARDHAT_NETWORK}
yarn hardhat claim --recipient 2 --proof-dir ${OUTPUT_DIR} --network ${HARDHAT_NETWORK}
Loading

0 comments on commit a307709

Please sign in to comment.