Finalize a test round #62
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: | |
branch_name: | |
description: 'Clrfund branch name' | |
required: true | |
default: 'cohort/EthSingapore' | |
subgraph_url: | |
description: 'Clrfund subgraph url' | |
required: true | |
default: 'https://graph.testnet.mantle.xyz/subgraphs/name/clrfund-ethsingapore-test' | |
maci_start_block: | |
description: 'MACI start block' | |
required: true | |
default: '0' | |
env: | |
NODE_VERSION: 16.x | |
NETWORK: "mantle-testnet" | |
COORDINATOR_ETH_PK: ${{ secrets.ARBITRUM_GOERLI_COORDINATOR_WALLET_PRIVATE_KEY }} | |
COORDINATOR_PK: ${{ secrets.ARBITRUM_GOERLI_COORDINATOR_MACI_PRIVATE_KEY }} | |
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: Install rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install zkutil | |
run: | | |
cargo install zkutil --version 0.3.2 | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.branch_name }} | |
- name: Download batch 64 params | |
run: | | |
ls -la $GITHUB_WORKSPACE | |
$GITHUB_WORKSPACE/.github/scripts/download-batch64-params.sh | |
- name: Build | |
run: | | |
yarn && yarn build | |
- name: Run finalize scripts | |
run: | | |
export SUBGRPAH_URL="${{ github.event.inputs.subgraph_url }}" | |
echo $SUBGRAPH_URL | |
export NODE_CONFIG=$(node -e "const snarkParamsPath=process.env.GITHUB_WORKSPACE + '/params'; console.log(JSON.stringify({ snarkParamsPath }));") | |
export ROUND=$(curl -X POST -d '{"query":"{fundingRoundFactories {id currentRound {id maci}}}"}' $SUBGRPAH_URL) | |
export FACTORY_ADDRESS=$(node -e 'console.log(JSON.parse(process.env.ROUND).data.fundingRoundFactories[0].id)') | |
export ROUND_ADDRESS=$(node -e 'console.log(JSON.parse(process.env.ROUND).data.fundingRoundFactories[0].currentRound.id)') | |
export MACI_ADDRESS=$(node -e 'console.log(JSON.parse(process.env.ROUND).data.fundingRoundFactories[0].currentRound.maci)') | |
# tally and finalize | |
cd contracts | |
yarn hardhat tally --round-address "${ROUND_ADDRESS}" --start-block "${{ github.event.inputs.maci_start_block }}" --network "${NETWORK}" | |
curl --location --request POST 'https://api.pinata.cloud/pinning/pinFileToIPFS' \ | |
--header "Authorization: Bearer ${{ secrets.PINATA_JWT }}" \ | |
--form 'file=@"tally.json"' | |
JSONRPC_HTTP_URL=${{env.JSONRPC_HTTP_URL}} yarn hardhat run --network "${NETWORK}" scripts/finalize.ts |