Finalize a test round #67
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Finalize a test round | |
on: | |
workflow_dispatch: | |
inputs: | |
subgraph_name: | |
description: 'Clrfund subgraph name' | |
required: true | |
default: 'clrfund/clrfund-testnet' | |
env: | |
NODE_VERSION: 20.x | |
NETWORK: "arbitrum-sepolia" | |
COORDINATOR_ETH_PK: ${{ secrets.ARBITRUM_GOERLI_COORDINATOR_WALLET_PRIVATE_KEY }} | |
COORDINATOR_PK: ${{ secrets.ARBITRUM_GOERLI_COORDINATOR_MACI_PRIVATE_KEY }} | |
CIRCUIT_TYPE: micro | |
ZKEYS_DOWNLOAD_SCRIPT: "download-6-8-2-3.sh" | |
jobs: | |
finalize: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install g++ library dependencies | |
run: | | |
sudo apt update | |
sudo apt-get install build-essential libgmp-dev libsodium-dev nlohmann-json3-dev nasm g++ curl | |
- name: Checkout rapidsnark source code | |
uses: actions/checkout@v3 | |
with: | |
repository: clrfund/rapidsnark | |
path: rapidsnark | |
- name: Install rapidsnark | |
run: | | |
cd $GITHUB_WORKSPACE/rapidsnark | |
npm install | |
git submodule init | |
git submodule update | |
./build_gmp.sh host | |
mkdir build_prover && cd build_prover | |
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package | |
make -j4 && make install | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
path: monorepo | |
- name: Download batch 64 params | |
run: | | |
ls -la $GITHUB_WORKSPACE | |
$GITHUB_WORKSPACE/monorepo/.github/scripts/${ZKEYS_DOWNLOAD_SCRIPT} | |
- name: Build | |
run: | | |
cd monorepo | |
# use https to avoid error: unable to connect to github.com | |
git config --global url."https://".insteadOf git:// | |
yarn && yarn build | |
- name: Run finalize scripts | |
run: | | |
export SUBGRPAH_URL="https://api.thegraph.com/subgraphs/name/${{ github.event.inputs.subgraph_name }}" | |
echo $SUBGRAPH_URL | |
export ROUND=$(curl -X POST -d '{"query":"{clrFunds {id currentRound {id maci maciTxHash}}}"}' $SUBGRPAH_URL) | |
export CLRFUND_ADDRESS=$(node -e 'console.log(JSON.parse(process.env.ROUND).data.clrFunds[0].id)') | |
export ROUND_ADDRESS=$(node -e 'console.log(JSON.parse(process.env.ROUND).data.clrFunds[0].currentRound.id)') | |
export MACI_ADDRESS=$(node -e 'console.log(JSON.parse(process.env.ROUND).data.clrFunds[0].currentRound.maci)') | |
export MACI_TX_HASH=$(node -e 'console.log(JSON.parse(process.env.ROUND).data.clrFunds[0].currentRound.maciTxHash)') | |
# tally and finalize | |
cd monorepo/contracts | |
yarn hardhat clr-tally --clrfund "${CLRFUND_ADDRESS}" --network "${NETWORK}" \ | |
--circuit-directory ~/params --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}" clr-finalize --clrfund "${CLRFUND_ADDRESS}" |