Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/no-subgraph' into merge/clr…
Browse files Browse the repository at this point in the history
…fund-static
  • Loading branch information
yuetloo committed Apr 23, 2024
2 parents a7b6df2 + 8489b00 commit 86527d4
Show file tree
Hide file tree
Showing 377 changed files with 35,929 additions and 21,221 deletions.
20 changes: 20 additions & 0 deletions .github/scripts/download-6-9-2-3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e

BASE_URL="https://maci-develop-fra.s3.eu-central-1.amazonaws.com/v1.2.0"
PKGS="maci_artifacts_6-9-2-3_prod.tar.gz"

for p in $PKGS
do
url="$BASE_URL/$p"
echo "downloading $url"
curl $url -o $p
extension="${p##*.}"
if [ "$extension" == "gz" ]
then
tar -zxvf $p
fi
done

mv zkeys params
rm maci_artifacts_6-9-2-3_prod.tar.gz
22 changes: 22 additions & 0 deletions .github/scripts/download-zkeys-micro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

PKGS="zkeys_10-2-1-2_glibc-211.tar.gz ProcessMessages_10-2-1-2_test.0.zkey TallyVotes_10-1-2_test.0.zkey"

mkdir -p params
cd params


BASE_URL=https://maci-develop-fra.s3.eu-central-1.amazonaws.com/v1.1.1-aa4ba27/10-2-1-2
for p in $PKGS
do
url="$BASE_URL/$p"
echo "downloading $url"
curl $url -o $p
extension="${p##*.}"
if [ "$extension" == "gz" ]
then
tar -xvf $p
fi
done

26 changes: 20 additions & 6 deletions .github/workflows/cancel-round.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
name: Cancel current round

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
clrfund:
description: 'Clrfund contract address'
required: true
default: '0x87790498127ff044f43b9230506833ca89113757'
network:
description: 'Network'
required: true
default: 'arbitrum-sepolia'
jsonrpc_url:
description: jsonrpc url to node
required: false

env:
NODE_VERSION: 16.x
SUBGRPAH_URL: "https://api.thegraph.com/subgraphs/name/clrfund/clrfund-arbitrum-goerli"
NODE_VERSION: 20.x
WALLET_PRIVATE_KEY: ${{ secrets.ARBITRUM_GOERLI_COORDINATOR_WALLET_PRIVATE_KEY }}

jobs:
Expand All @@ -19,10 +31,12 @@ jobs:
uses: actions/checkout@v3
- name: Build CLR
run: |
# use https to avoid error: unable to connect to github.com
git config --global url."https://".insteadOf git://
yarn && yarn build
- name: Run the cancel round script
run: |
cd contracts
export FACTORY=$(curl -X POST -d '{"query":"{fundingRoundFactories {id}}"}' $SUBGRPAH_URL)
export FACTORY_ADDRESS=$(node -e 'console.log(JSON.parse(process.env.FACTORY).data.fundingRoundFactories[0].id)')
yarn hardhat cancel-round --factory ${FACTORY_ADDRESS} --network arbitrum-goerli
yarn hardhat cancel-round \
--clrfund ${{ github.event.inputs.clrfund }} \
--network ${{ github.event.inputs.network }}
6 changes: 4 additions & 2 deletions .github/workflows/create-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
- major

env:
NODE_VERSION: 16.x
VITE_CLRFUND_FACTORY_ADDRESS: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707"
NODE_VERSION: 20.x
VITE_CLRFUND_ADDRESS: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707"
VITE_ETHEREUM_API_CHAINID: 1
VITE_ETHEREUM_API_URL: "dummy"
VITE_IPFS_PINNING_JWT: "dummy"
Expand All @@ -33,6 +33,8 @@ jobs:
uses: actions/checkout@v3
- name: Install dependencies
run: |
# use https to avoid error: unable to connect to github.com
git config --global url."https://".insteadOf git://
yarn && yarn build
- name: setup git config
run: |
Expand Down
95 changes: 58 additions & 37 deletions .github/workflows/finalize-round.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,34 @@ name: Finalize a test round
on:
workflow_dispatch:
inputs:
branch_name:
description: 'Clrfund branch name'
clrfund_address:
description: 'Clrfund contract address'
required: true
default: 'develop'
subgraph_name:
description: 'Clrfund subgraph name'
default: '0x87790498127ff044f43b9230506833ca89113757'
maci_tx_hash:
description: 'MACI creation transaction hash'
required: false
blocks_per_batch:
description: 'Blocks of logs to fetch per batch'
required: true
default: 'yuetloo/clrfund-dev'
default: '9000'
network:
description: 'Network'
required: true
default: 'arbitrum-sepolia'
jsonrpc_url:
description: jsonrpc url to node
required: false

env:
NODE_VERSION: 16.x
NETWORK: "arbitrum-goerli"
COORDINATOR_ETH_PK: ${{ secrets.ARBITRUM_GOERLI_COORDINATOR_WALLET_PRIVATE_KEY }}
COORDINATOR_PK: ${{ secrets.ARBITRUM_GOERLI_COORDINATOR_MACI_PRIVATE_KEY }}
JSONRPC_HTTP_URL: ${{ secrets.JSONRPC_HTTP_URL }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_ARBITRUM }}
ETHERSCAN_URL: "https://api-goerli.arbiscan.io"
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-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 All @@ -33,41 +44,51 @@ jobs:
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
- name: Checkout rapidsnark source code
uses: actions/checkout@v3
with:
toolchain: stable
- name: Install zkutil
repository: clrfund/rapidsnark
path: rapidsnark
- name: Install rapidsnark
run: |
cargo install zkutil --version 0.3.2
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:
ref: ${{ github.event.inputs.branch_name }}
path: monorepo
- name: Download batch 64 params
run: |
ls -la $GITHUB_WORKSPACE
$GITHUB_WORKSPACE/.github/scripts/download-batch64-params.sh
$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 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)')
export TX_URL="${ETHERSCAN_URL}/api?module=account&action=txlistinternal&address=${MACI_ADDRESS}&startblock=0&page=10&offset=1&sort=asc&apikey=${ETHERSCAN_API_KEY}"
export TXLIST=$(curl $TX_URL)
export MACI_START_BLOCK=$(node -e 'console.log(JSON.parse(process.env.TXLIST).result[0].blockNumber)')
echo "MACI_START_BLOCK:" $MACI_START_BLOCK
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 contracts
yarn hardhat tally --round-address "${ROUND_ADDRESS}" --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
cd monorepo/contracts
mkdir -p proof_output
yarn hardhat tally --clrfund "${CLRFUND_ADDRESS}" --network "${NETWORK}" \
--rapidsnark ${RAPID_SNARK} \
--params-dir ${CIRCUIT_DIRECTORY} \
--blocks-per-batch ${BLOCKS_PER_BATCH} \
--maci-tx-hash "${MACI_TX_HASH}" \
--proof-dir "./proof_output"
yarn hardhat --network "${NETWORK}" finalize --clrfund "${CLRFUND_ADDRESS}" \
--proof-dir "./proof_output"
40 changes: 0 additions & 40 deletions .github/workflows/mantle_cancel_round.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/mantle_create_new_round.yml

This file was deleted.

76 changes: 0 additions & 76 deletions .github/workflows/mantle_finalize_round.yml

This file was deleted.

Loading

0 comments on commit 86527d4

Please sign in to comment.