Finalize a test round #95
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: | |
clrfund_address: | |
description: 'Clrfund contract address' | |
required: true | |
default: '0x87790498127ff044f43b9230506833ca89113757' | |
maci_tx_hash: | |
description: 'MACI creation transaction hash' | |
required: true | |
default: '0x1280527bdb23cbd4906c94e152722792fc59400bfccfc89709beb2531fc55365' | |
blocks_per_batch: | |
description: 'Blocks of logs to fetch per batch' | |
required: true | |
default: '9000' | |
network: | |
description: 'Network' | |
required: true | |
default: 'optimism-sepolia' | |
jsonrpc_url: | |
description: jsonrpc url to node | |
required: false | |
env: | |
NODE_VERSION: 20.x | |
COORDINATOR_MACISK: ${{ secrets.COORDINATOR_MACI_PRIVATE_KEY }} | |
WALLET_PRIVATE_KEY: ${{ secrets.ARBITRUM_GOERLI_COORDINATOR_WALLET_PRIVATE_KEY }} | |
CIRCUIT_TYPE: micro | |
ZKEYS_DOWNLOAD_SCRIPT: "download-6-8-2-3.sh" | |
JSONRPC_HTTP_URL: ${{ github.event.inputs.jsonrpc_url }} | |
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 CLRFUND_ADDRESS=${{ github.event.inputs.clrfund_address }} | |
export MACI_TX_HASH=${{ github.event.inputs.maci_tx_hash }} | |
export NETWORK=${{ github.event.inputs.network }} | |
export BLOCKS_PER_BATCH=${{ github.event.inputs.blocks_per_batch }} | |
export RAPID_SNARK="$GITHUB_WORKSPACE/rapidsnark/package/bin/prover" | |
export CIRCUIT_DIRECTORY=$GITHUB_WORKSPACE/params | |
# tally and finalize | |
cd monorepo/contracts | |
mkdir -p proof_output | |
yarn hardhat clr-tally --clrfund "${CLRFUND_ADDRESS}" --network "${NETWORK}" \ | |
--rapidsnark ${RAPID_SNARK} \ | |
--circuit-directory ${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}" clr-finalize --clrfund "${CLRFUND_ADDRESS}" |