Adding rln contract deployment script (#30)

* chore: add rln registry deploy script

* removed local variables, now passed via docker enviroment

* foundry service now also running contract deploy script

* replaced hardcoded contract bytecode with bytecode retrieved from github

* fixed variable naming

* Added Anvil RPC_URL to env file

* new docker service to get waku-rln-contract repo, build it and deploy

* added entrypoint: sh to contract-repo-deployer and deploy script now has bash/sh

---------

Co-authored-by: rymnc <43716372+rymnc@users.noreply.github.com>
This commit is contained in:
Tanya S 2024-03-26 10:41:52 +02:00 committed by GitHub
parent d6fb3e56e5
commit 5c7909eb92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 14 deletions

18
deploy_rln_contract.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/sh
set -e
# 1. Install foundry
curl -L https://foundry.paradigm.xyz | bash && . /root/.bashrc && foundryup && export PATH=$PATH:$HOME/.foundry/bin
#. 2. Clone and build waku-rln-contract repo
git clone https://github.com/waku-org/waku-rln-contract.git
cd /waku-rln-contract
forge install && yarn install && yarn compile
# 3. Create .env file with RPC_PROVIDER variable
echo "creating .env file with RPC_PROVIDER=$RPC_URL"
echo "RPC_PROVIDER=$RPC_URL" > .env
# 3. Deploy the contracts
yarn deploy localhost_integration

View File

@ -16,15 +16,32 @@ services:
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
ports:
- 127.0.0.1:8545:8545
command: >
"anvil
--port=8545
--host=0.0.0.0
--chain-id=1337
--block-time=12
--accounts=1
--allow-origin=*
--silent"
command:
- anvil
--port=8545
--host=0.0.0.0
--chain-id=1337
--accounts=1
--allow-origin=*
--block-time=12
--silent
--config-out=anvil-config.txt
networks:
- simulation
contract-repo-deployer:
image: node:hydrogen-bullseye
labels:
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
environment:
- RPC_URL=${RPC_URL:-http://foundry:8545}
entrypoint: sh
command:
- '/opt/deploy_rln_contract.sh'
volumes:
- ./deploy_rln_contract.sh:/opt/deploy_rln_contract.sh
depends_on:
- foundry
networks:
- simulation
@ -41,7 +58,7 @@ services:
- 127.0.0.1:8645:8645
entrypoint: sh
command:
- '/opt/run_bootstrap.sh'
- '/opt/run_bootstrap.sh'
volumes:
- ./run_bootstrap.sh:/opt/run_bootstrap.sh:Z
networks:
@ -56,7 +73,7 @@ services:
replicas: ${NUM_NWAKU_NODES:-5}
entrypoint: sh
environment:
- RPC_URL=http://foundry:8545
- RPC_URL=${RPC_URL:-http://foundry:8545}
- PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
- RLN_CONTRACT_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
- RLN_CREDENTIAL_PATH=/keystore.json
@ -67,7 +84,7 @@ services:
- ./run_nwaku.sh:/opt/run_nwaku.sh:Z
depends_on:
- bootstrap
- foundry
- contract-repo-deployer
networks:
- simulation
@ -165,7 +182,7 @@ services:
ports:
- 127.0.0.1:8090:8090
environment:
- NODE_ENDPOINT=http://foundry:8545
- NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
- MONGO_CLIENT_URI=mongodb://mongodb:27017
- REINDEX_ENDPOINT=http://ingestion/reindex/
- MONGO_DB_NAME=epirus
@ -204,7 +221,7 @@ services:
ingestion:
image: web3labs/epirus-free-ingestion:latest
environment:
- NODE_ENDPOINT=http://foundry:8545
- NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
- MONGO_CLIENT_URI=mongodb://mongodb:27017
- MONGO_DB_NAME=epirus
- LIST_OF_METRICS_TO_CALCULATE_PER_MINUTE=hourly,daily,monthly,yearly

View File

@ -10,3 +10,5 @@ MSG_SIZE_KBYTES=10
TRAFFIC_DELAY_SECONDS=15
# Enable automatic Docker image updates.
WATCHTOWER_ENABLED=true
# Anvil RPC Node external IP and port
RPC_URL=http://foundry:8545