mirror of
https://github.com/logos-messaging/logos-messaging-simulator.git
synced 2026-01-05 23:43:11 +00:00
modifications to remove rln for adhoc debugging of other features
This commit is contained in:
parent
77d37c96ba
commit
84da715708
@ -12,46 +12,46 @@ services:
|
|||||||
|
|
||||||
# Accounts are hardcoded to 520 with the idea that nwaku nodes use up to 500 for membership registration and the last 20 are used for ad-hoc testing.
|
# Accounts are hardcoded to 520 with the idea that nwaku nodes use up to 500 for membership registration and the last 20 are used for ad-hoc testing.
|
||||||
# The account number and private key pairs of the last 20 accounts can be found in the Register memberships section of the Waku-simulator book.
|
# The account number and private key pairs of the last 20 accounts can be found in the Register memberships section of the Waku-simulator book.
|
||||||
foundry:
|
# foundry:
|
||||||
image: ghcr.io/foundry-rs/foundry:nightly-9b73e06e1fe376738b92ae081107620291d50188
|
# image: ghcr.io/foundry-rs/foundry:v0.3.0
|
||||||
labels:
|
# labels:
|
||||||
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
# com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
||||||
ports:
|
# ports:
|
||||||
- 0.0.0.0:8545:8545
|
# - 0.0.0.0:8545:8545
|
||||||
command:
|
# command:
|
||||||
- anvil
|
# - anvil
|
||||||
--port=8545
|
# --port=8545
|
||||||
--host=0.0.0.0
|
# --host=0.0.0.0
|
||||||
--accounts=520
|
# --accounts=520
|
||||||
--allow-origin=*
|
# --allow-origin=*
|
||||||
--block-time=12
|
# --block-time=12
|
||||||
--chain-id=1234
|
# --chain-id=1234
|
||||||
--silent
|
# --silent
|
||||||
--config-out=/shared/anvil-config.txt
|
# --config-out=/shared/anvil-config.txt
|
||||||
volumes:
|
# volumes:
|
||||||
- privatekeys-volume:/shared
|
# - privatekeys-volume:/shared
|
||||||
networks:
|
# networks:
|
||||||
- simulation
|
# - simulation
|
||||||
|
|
||||||
contract-repo-deployer:
|
# contract-repo-deployer:
|
||||||
image: node:hydrogen-bullseye
|
# image: node:hydrogen-bullseye
|
||||||
labels:
|
# labels:
|
||||||
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
# com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
||||||
environment:
|
# environment:
|
||||||
- RLN_CONTRACT_REPO_COMMIT=${RLN_CONTRACT_REPO_COMMIT:-64df4593c6a14e43b8b0e9b396d2f4772bb08b34}
|
# - RLN_CONTRACT_REPO_COMMIT=${RLN_CONTRACT_REPO_COMMIT:-64df4593c6a14e43b8b0e9b396d2f4772bb08b34}
|
||||||
- PRIVATE_KEY=${PRIVATE_KEY}
|
# - PRIVATE_KEY=${PRIVATE_KEY}
|
||||||
- RPC_URL=${RPC_URL:-http://foundry:8545}
|
# - RPC_URL=${RPC_URL:-http://foundry:8545}
|
||||||
- ETH_FROM=${ETH_FROM}
|
# - ETH_FROM=${ETH_FROM}
|
||||||
- MAX_MESSAGE_LIMIT=${MAX_MESSAGE_LIMIT:-20}
|
# - MAX_MESSAGE_LIMIT=${MAX_MESSAGE_LIMIT:-20}
|
||||||
entrypoint: sh
|
# entrypoint: sh
|
||||||
command:
|
# command:
|
||||||
- '/opt/deploy_rln_contract.sh'
|
# - '/opt/deploy_rln_contract.sh'
|
||||||
volumes:
|
# volumes:
|
||||||
- ./deploy_rln_contract.sh:/opt/deploy_rln_contract.sh
|
# - ./deploy_rln_contract.sh:/opt/deploy_rln_contract.sh
|
||||||
depends_on:
|
# depends_on:
|
||||||
- foundry
|
# - foundry
|
||||||
networks:
|
# networks:
|
||||||
- simulation
|
# - simulation
|
||||||
|
|
||||||
bootstrap:
|
bootstrap:
|
||||||
image: ${NWAKU_IMAGE:-wakuorg/nwaku:latest}
|
image: ${NWAKU_IMAGE:-wakuorg/nwaku:latest}
|
||||||
@ -93,8 +93,7 @@ services:
|
|||||||
- ./run_nwaku.sh:/opt/run_nwaku.sh:Z
|
- ./run_nwaku.sh:/opt/run_nwaku.sh:Z
|
||||||
- privatekeys-volume:/shared
|
- privatekeys-volume:/shared
|
||||||
depends_on:
|
depends_on:
|
||||||
contract-repo-deployer:
|
- bootstrap
|
||||||
condition: service_completed_successfully
|
|
||||||
networks:
|
networks:
|
||||||
- simulation
|
- simulation
|
||||||
|
|
||||||
@ -168,71 +167,71 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- simulation
|
- simulation
|
||||||
|
|
||||||
api:
|
# api:
|
||||||
image: web3labs/epirus-free-api:latest
|
# image: web3labs/epirus-free-api:latest
|
||||||
ports:
|
# ports:
|
||||||
- 127.0.0.1:8090:8090
|
# - 127.0.0.1:8090:8090
|
||||||
environment:
|
# environment:
|
||||||
- NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
|
# - NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
|
||||||
- MONGO_CLIENT_URI=mongodb://mongodb:27017
|
# - MONGO_CLIENT_URI=mongodb://mongodb:27017
|
||||||
- REINDEX_ENDPOINT=http://ingestion/reindex/
|
# - REINDEX_ENDPOINT=http://ingestion/reindex/
|
||||||
- MONGO_DB_NAME=epirus
|
# - MONGO_DB_NAME=epirus
|
||||||
- MONGO_CREATE_INDICES=true
|
# - MONGO_CREATE_INDICES=true
|
||||||
- REDIS_HOST=redis
|
# - REDIS_HOST=redis
|
||||||
- REDIS_PORT=6379
|
# - REDIS_PORT=6379
|
||||||
depends_on:
|
# depends_on:
|
||||||
- redis
|
# - redis
|
||||||
- mongodb
|
# - mongodb
|
||||||
- foundry
|
# - foundry
|
||||||
networks:
|
# networks:
|
||||||
- simulation
|
# - simulation
|
||||||
|
|
||||||
mongodb:
|
# mongodb:
|
||||||
image: mongo:5.0.8
|
# image: mongo:5.0.8
|
||||||
environment:
|
# environment:
|
||||||
- COMPOSE_HTTP_TIMEOUT=900
|
# - COMPOSE_HTTP_TIMEOUT=900
|
||||||
- DOCKER_CLIENT_TIMEOUT=900
|
# - DOCKER_CLIENT_TIMEOUT=900
|
||||||
entrypoint: mongod --bind_ip "0.0.0.0"
|
# entrypoint: mongod --bind_ip "0.0.0.0"
|
||||||
networks:
|
# networks:
|
||||||
- simulation
|
# - simulation
|
||||||
|
|
||||||
web:
|
# web:
|
||||||
image: web3labs/epirus-free-web:latest
|
# image: web3labs/epirus-free-web:latest
|
||||||
environment:
|
# environment:
|
||||||
- API_URL=${EPIRUS_WEB_API_URL:-/api}
|
# - API_URL=${EPIRUS_WEB_API_URL:-/api}
|
||||||
- WS_API_URL=${EPIRUS_WEB_WS_API_URL:-ws://localhost:8090}
|
# - WS_API_URL=${EPIRUS_WEB_WS_API_URL:-ws://localhost:8090}
|
||||||
- DISPLAY_NETWORK_TAB=disabled
|
# - DISPLAY_NETWORK_TAB=disabled
|
||||||
depends_on:
|
# depends_on:
|
||||||
- api
|
# - api
|
||||||
networks:
|
# networks:
|
||||||
- simulation
|
# - simulation
|
||||||
|
|
||||||
ingestion:
|
# ingestion:
|
||||||
image: web3labs/epirus-free-ingestion:latest
|
# image: web3labs/epirus-free-ingestion:latest
|
||||||
environment:
|
# environment:
|
||||||
- NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
|
# - NODE_ENDPOINT=${RPC_URL:-http://foundry:8545}
|
||||||
- MONGO_CLIENT_URI=mongodb://mongodb:27017
|
# - MONGO_CLIENT_URI=mongodb://mongodb:27017
|
||||||
- MONGO_DB_NAME=epirus
|
# - MONGO_DB_NAME=epirus
|
||||||
- LIST_OF_METRICS_TO_CALCULATE_PER_MINUTE=hourly,daily,monthly,yearly
|
# - LIST_OF_METRICS_TO_CALCULATE_PER_MINUTE=hourly,daily,monthly,yearly
|
||||||
depends_on:
|
# depends_on:
|
||||||
- mongodb
|
# - mongodb
|
||||||
- redis
|
# - redis
|
||||||
- foundry
|
# - foundry
|
||||||
networks:
|
# networks:
|
||||||
- simulation
|
# - simulation
|
||||||
|
|
||||||
nginx:
|
# nginx:
|
||||||
image: nginx:latest
|
# image: nginx:latest
|
||||||
volumes:
|
# volumes:
|
||||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
# - ./nginx.conf:/etc/nginx/nginx.conf
|
||||||
- ./5xx.html:/www/error_pages/5xx.html
|
# - ./5xx.html:/www/error_pages/5xx.html
|
||||||
ports:
|
# ports:
|
||||||
- 0.0.0.0:3000:80
|
# - 0.0.0.0:3000:80
|
||||||
depends_on:
|
# depends_on:
|
||||||
- api
|
# - api
|
||||||
- web
|
# - web
|
||||||
networks:
|
# networks:
|
||||||
- simulation
|
# - simulation
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
privatekeys-volume:
|
privatekeys-volume:
|
||||||
185
run_nwaku.sh
185
run_nwaku.sh
@ -2,110 +2,110 @@
|
|||||||
|
|
||||||
# Check Linux Distro Version - it can differ depending on the nwaku image used
|
# Check Linux Distro Version - it can differ depending on the nwaku image used
|
||||||
OS=$(cat /etc/os-release)
|
OS=$(cat /etc/os-release)
|
||||||
if echo $OS | grep -q "Debian"; then
|
# if echo $OS | grep -q "Debian"; then
|
||||||
echo "The operating system is Debian."
|
# echo "The operating system is Debian."
|
||||||
apt update
|
# apt update
|
||||||
apt install -y dnsutils
|
# apt install -y dnsutils
|
||||||
apt install -y jq
|
# apt install -y jq
|
||||||
elif echo $OS | grep -q "Alpine"; then
|
# elif echo $OS | grep -q "Alpine"; then
|
||||||
echo "The operating system is Alpine."
|
# echo "The operating system is Alpine."
|
||||||
apk add bind-tools
|
# apk add bind-tools
|
||||||
apk add jq
|
# apk add jq
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
if test -f .env; then
|
# if test -f .env; then
|
||||||
echo "Using .env file"
|
# echo "Using .env file"
|
||||||
. $(pwd)/.env
|
# . $(pwd)/.env
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
IP=$(ip a | grep "inet " | grep -Fv 127.0.0.1 | sed 's/.*inet \([^/]*\).*/\1/')
|
IP=$(ip a | grep "inet " | grep -Fv 127.0.0.1 | sed 's/.*inet \([^/]*\).*/\1/')
|
||||||
|
|
||||||
# Function to extract IP address from URL, resolve the IP and replace it in the original URL
|
# # Function to extract IP address from URL, resolve the IP and replace it in the original URL
|
||||||
get_ip_address_and_replace() {
|
# get_ip_address_and_replace() {
|
||||||
local url=$1
|
# local url=$1
|
||||||
local domain_name=$(echo $RPC_URL | awk -F[/:] '{print $4}')
|
# local domain_name=$(echo $RPC_URL | awk -F[/:] '{print $4}')
|
||||||
local ip_address=$(dig +short $domain_name)
|
# local ip_address=$(dig +short $domain_name)
|
||||||
valid_rpc_url="$(echo "$url" | sed "s/$domain_name/$ip_address/g")"
|
# valid_rpc_url="$(echo "$url" | sed "s/$domain_name/$ip_address/g")"
|
||||||
echo $valid_rpc_url
|
# echo $valid_rpc_url
|
||||||
}
|
# }
|
||||||
|
|
||||||
# the format of the RPC URL is checked in the generateRlnKeystore command and hostnames are not valid
|
# # the format of the RPC URL is checked in the generateRlnKeystore command and hostnames are not valid
|
||||||
pattern="^(https?):\/\/((localhost)|([\w_-]+(?:(?:\.[\w_-]+)+)))(:[0-9]{1,5})?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])*"
|
# pattern="^(https?):\/\/((localhost)|([\w_-]+(?:(?:\.[\w_-]+)+)))(:[0-9]{1,5})?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])*"
|
||||||
# Perform regex matching
|
# # Perform regex matching
|
||||||
if echo "$RPC_URL" | grep -q "$pattern"; then
|
# if echo "$RPC_URL" | grep -q "$pattern"; then
|
||||||
echo "RPC URL is valid"
|
# echo "RPC URL is valid"
|
||||||
else
|
# else
|
||||||
echo "RPC URL is invalid: $RPC_URL. Attempting to resolve hostname."
|
# echo "RPC URL is invalid: $RPC_URL. Attempting to resolve hostname."
|
||||||
resolved_rpc_url="$(get_ip_address_and_replace $RPC_URL)"
|
# resolved_rpc_url="$(get_ip_address_and_replace $RPC_URL)"
|
||||||
if [ -z "$resolved_rpc_url" ]; then
|
# if [ -z "$resolved_rpc_url" ]; then
|
||||||
echo -e "Failed to retrieve IP address for $RPC_URL\n"
|
# echo -e "Failed to retrieve IP address for $RPC_URL\n"
|
||||||
else
|
# else
|
||||||
echo -e "Resolved RPC URL for $RPC_URL: $resolved_rpc_url"
|
# echo -e "Resolved RPC URL for $RPC_URL: $resolved_rpc_url"
|
||||||
RPC_URL="$resolved_rpc_url"
|
# RPC_URL="$resolved_rpc_url"
|
||||||
fi
|
# fi
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
#Function to get the index of the container and use it to retrieve a private key to be used to generate the keystore, allowing for either dash or underscore container name format (for docker-compose backward compatibility)
|
# #Function to get the index of the container and use it to retrieve a private key to be used to generate the keystore, allowing for either dash or underscore container name format (for docker-compose backward compatibility)
|
||||||
get_private_key(){
|
# get_private_key(){
|
||||||
|
|
||||||
# Read the JSON file
|
# # Read the JSON file
|
||||||
json_content=$(cat /shared/anvil-config.txt)
|
# json_content=$(cat /shared/anvil-config.txt)
|
||||||
|
|
||||||
# Check if json_content has a value
|
# # Check if json_content has a value
|
||||||
if [ -z "$json_content" ]; then
|
# if [ -z "$json_content" ]; then
|
||||||
echo "Error: Failed to read the JSON file or the file is empty." >&2
|
# echo "Error: Failed to read the JSON file or the file is empty." >&2
|
||||||
return 1
|
# return 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Extract private_keys json array using jq
|
# # Extract private_keys json array using jq
|
||||||
private_keys=$(echo "$json_content" | jq -r '.private_keys[]')
|
# private_keys=$(echo "$json_content" | jq -r '.private_keys[]')
|
||||||
|
|
||||||
CNTR=`dig -x $IP +short | cut -d'.' -f1`
|
# CNTR=`dig -x $IP +short | cut -d'.' -f1`
|
||||||
INDEX=`echo $CNTR | sed 's/.*[-_]\([0-9]*\)/\1/'`
|
# INDEX=`echo $CNTR | sed 's/.*[-_]\([0-9]*\)/\1/'`
|
||||||
|
|
||||||
if [ $? -ne 0 ] || [ -z "$INDEX" ]; then
|
# if [ $? -ne 0 ] || [ -z "$INDEX" ]; then
|
||||||
echo "Error: Failed to determine the replica index from IP." >&2
|
# echo "Error: Failed to determine the replica index from IP." >&2
|
||||||
return 1
|
# return 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
|
|
||||||
# iterate through list of private keys and get the one corresponding to the container index
|
# # iterate through list of private keys and get the one corresponding to the container index
|
||||||
# we need to iterate because array objects cannot be used in /bin/ash (Alpine) and a separate script would need to be called to use bash
|
# # we need to iterate because array objects cannot be used in /bin/ash (Alpine) and a separate script would need to be called to use bash
|
||||||
current_index=1
|
# current_index=1
|
||||||
for key in $private_keys
|
# for key in $private_keys
|
||||||
do
|
# do
|
||||||
if [ $current_index -eq $INDEX ]; then
|
# if [ $current_index -eq $INDEX ]; then
|
||||||
pk=$key
|
# pk=$key
|
||||||
echo $key
|
# echo $key
|
||||||
break
|
# break
|
||||||
fi
|
# fi
|
||||||
current_index=$((current_index+1))
|
# current_index=$((current_index+1))
|
||||||
done
|
# done
|
||||||
|
|
||||||
if [ -z "$pk" ]; then
|
# if [ -z "$pk" ]; then
|
||||||
echo "Error: Failed to get private key for the container with index=$INDEX." >&2
|
# echo "Error: Failed to get private key for the container with index=$INDEX." >&2
|
||||||
return 1
|
# return 1
|
||||||
fi
|
# fi
|
||||||
}
|
# }
|
||||||
|
|
||||||
if test -f .$RLN_CREDENTIAL_PATH; then
|
# if test -f .$RLN_CREDENTIAL_PATH; then
|
||||||
echo "$RLN_CREDENTIAL_PATH already exists. Use it instead of creating a new one."
|
# echo "$RLN_CREDENTIAL_PATH already exists. Use it instead of creating a new one."
|
||||||
else
|
# else
|
||||||
private_key="$(get_private_key)"
|
# private_key="$(get_private_key)"
|
||||||
echo "Private key: $private_key"
|
# echo "Private key: $private_key"
|
||||||
|
|
||||||
echo "Generating RLN keystore"
|
# echo "Generating RLN keystore"
|
||||||
/usr/bin/wakunode generateRlnKeystore \
|
# /usr/bin/wakunode generateRlnKeystore \
|
||||||
--rln-relay-eth-client-address="$RPC_URL" \
|
# --rln-relay-eth-client-address="$RPC_URL" \
|
||||||
--rln-relay-eth-private-key=$private_key \
|
# --rln-relay-eth-private-key=$private_key \
|
||||||
--rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS \
|
# --rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS \
|
||||||
--rln-relay-cred-path=$RLN_CREDENTIAL_PATH \
|
# --rln-relay-cred-path=$RLN_CREDENTIAL_PATH \
|
||||||
--rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD \
|
# --rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD \
|
||||||
--rln-relay-user-message-limit=$RLN_RELAY_MSG_LIMIT \
|
# --rln-relay-user-message-limit=$RLN_RELAY_MSG_LIMIT \
|
||||||
--rln-relay-epoch-sec=$RLN_RELAY_EPOCH_SEC \
|
# --rln-relay-epoch-sec=$RLN_RELAY_EPOCH_SEC \
|
||||||
--log-level=DEBUG \
|
# --log-level=DEBUG \
|
||||||
--execute
|
# --execute
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
echo "I am a nwaku node"
|
echo "I am a nwaku node"
|
||||||
|
|
||||||
@ -131,15 +131,6 @@ exec /usr/bin/wakunode\
|
|||||||
--rest=true\
|
--rest=true\
|
||||||
--rest-address=0.0.0.0\
|
--rest-address=0.0.0.0\
|
||||||
--rest-port=8645\
|
--rest-port=8645\
|
||||||
--rln-relay=true\
|
|
||||||
--rln-relay-dynamic=true\
|
|
||||||
--rln-relay-eth-client-address="$RPC_URL"\
|
|
||||||
--rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS\
|
|
||||||
--rln-relay-cred-path=$RLN_CREDENTIAL_PATH\
|
|
||||||
--rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD\
|
|
||||||
--rln-relay-tree-path="rlnv2_tree1"\
|
|
||||||
--rln-relay-epoch-sec=$RLN_RELAY_EPOCH_SEC\
|
|
||||||
--rln-relay-user-message-limit=$RLN_RELAY_MSG_LIMIT\
|
|
||||||
--dns-discovery=true\
|
--dns-discovery=true\
|
||||||
--discv5-discovery=true\
|
--discv5-discovery=true\
|
||||||
--discv5-enr-auto-update=True\
|
--discv5-enr-auto-update=True\
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user