feat(relayer): add auth guard for message publishing #395
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: Relayer | |
on: | |
push: | |
branches: [dev] | |
pull_request: | |
env: | |
RELAYER_RPC_URL: "http://localhost:8545" | |
TTL: ${{ vars.RELAYER_TTL }} | |
LIMIT: ${{ vars.RELAYER_LIMIT }} | |
ALLOWED_ORIGINS: ${{ vars.ALLOWED_ORIGINS }} | |
MAX_MESSAGES: ${{ vars.RELAYER_MAX_MESSAGES || 20 }} | |
MONGO_DB_URI: ${{ secrets.RELAYER_MONGO_DB_URI }} | |
MONGODB_USER: ${{ secrets.MONGODB_USER }} | |
MONGODB_PASSWORD: ${{ secrets.MONGODB_PASSWORD }} | |
MONGODB_DATABASE: ${{ secrets.MONGODB_DATABASE }} | |
MNEMONIC: ${{ secrets.RELAYER_MNEMONIC }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- name: Get changed files | |
id: get-changed-files | |
uses: jitterbit/get-changed-files@v1 | |
with: | |
format: "csv" | |
- name: Check for changes in 'circuit' folder | |
id: check_changes | |
run: | | |
CHANGED_FILES=${{ steps.get-changed-files.outputs.all }} | |
if echo "$CHANGED_FILES" | grep -q "\.circom"; then | |
echo "CHANGED=true" >> $GITHUB_ENV | |
echo "Circuits have changes." | |
else | |
echo "CHANGED=false" >> $GITHUB_ENV | |
echo "No changes on circuits." | |
fi | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install --yes \ | |
build-essential \ | |
libgmp-dev \ | |
libsodium-dev \ | |
nasm \ | |
nlohmann-json3-dev | |
- name: Install | |
run: | | |
pnpm install --frozen-lockfile --prefer-offline | |
- name: Build | |
run: | | |
pnpm run build | |
- name: Download rapidsnark (1c137) | |
run: | | |
mkdir -p ~/rapidsnark/build | |
wget -qO ~/rapidsnark/build/prover https://maci-devops-zkeys.s3.ap-northeast-2.amazonaws.com/rapidsnark-linux-amd64-1c137 | |
chmod +x ~/rapidsnark/build/prover | |
- name: Download circom Binary v2.1.6 | |
run: | | |
wget -qO ${{ github.workspace }}/circom https://github.com/iden3/circom/releases/download/v2.1.6/circom-linux-amd64 | |
chmod +x ${{ github.workspace }}/circom | |
sudo mv ${{ github.workspace }}/circom /bin/circom | |
- name: Compile Circuits And Generate zkeys | |
if: ${{ env.CHANGED == 'true' }} | |
run: | | |
pnpm build:circuits-c -- --outPath ../../apps/relayer/zkeys | |
pnpm setup:zkeys -- --outPath ../../apps/relayer/zkeys | |
- name: Download zkeys | |
if: ${{ env.CHANGED == 'false' }} | |
run: | | |
pnpm download-zkeys:test:relayer | |
- name: Run hardhat | |
run: | | |
pnpm run hardhat & | |
sleep 5 | |
working-directory: apps/relayer | |
- name: Test | |
run: pnpm run test:coverage | |
working-directory: apps/relayer | |
- name: Stop Hardhat | |
if: always() | |
run: kill $(lsof -t -i:8545) |