Skip to content

Commit

Permalink
Adding rln contract deployment script (#30)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
stubbsta and rymnc authored Mar 26, 2024
1 parent d6fb3e5 commit 5c7909e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 14 deletions.
18 changes: 18 additions & 0 deletions deploy_rln_contract.sh
Original file line number Diff line number Diff line change
@@ -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
45 changes: 31 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand All @@ -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
Expand All @@ -67,7 +84,7 @@ services:
- ./run_nwaku.sh:/opt/run_nwaku.sh:Z
depends_on:
- bootstrap
- foundry
- contract-repo-deployer
networks:
- simulation

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions wakusim.env
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5c7909e

Please sign in to comment.