more changes

This commit is contained in:
alrevuelta 2023-09-05 09:45:45 +00:00
parent 56ddec1e09
commit 728b611bde
6 changed files with 3187 additions and 29 deletions

4
.env
View File

@ -1,5 +1,7 @@
export GOWAKU_IMAGE=statusteam/go-waku:latest
export NWAKU_IMAGE=f2ad7066ff4b05180b8acb10d20dec08ddce5b855d60d3d6400a01fff9639761
#export NWAKU_IMAGE=quay.io/wakuorg/nwaku-pr:master-experimental
export NWAKU_IMAGE=d8deff569a1ba99e1bca165ec100eb10c27072ed418f9899e82203bca40820d1
export NUM_NWAKU_NODES=5
export NUM_GOWAKU_NODES=0
export MSG_PER_SECOND=10

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,8 @@ nwaku = '''
- '/opt/run_nwaku.sh'
volumes:
- ./run_nwaku.sh:/opt/run_nwaku.sh:Z
- ./rlnKeystore.json:/rlnKeystore.json:Z
- ./data/nwaku_INDEX:/data:Z
# - ./rlnKeystore.json:/rlnKeystore.json:Z
# - ./rln_tree.db:/rln_tree.db:Z # this should not be done as its being written by all the replicas
depends_on:
- bootstrap
@ -115,8 +116,8 @@ nwaku = '''
fname = "docker-compose.yml"
f = open(fname, "w")
f.write(base)
for i in range(1, 20+1):
NUM_NWAKUS = 200
for i in range(1, NUM_NWAKUS+1):
my_copy= nwaku.replace("INDEX", str(i))
f.write(my_copy)
f.close()

53
generate_keystores.py Normal file
View File

@ -0,0 +1,53 @@
import json
import copy
import os
import subprocess
# Opening JSON file
f = open('rlnKeystore.json')
# returns JSON object as
# a dictionary
data = json.load(f)
base_credentials = copy.deepcopy(data)
base_credentials["credentials"] = {}
#print(data["credentials"][0])
#config
NUM_KEYSTORES_TO_GENERATE = 2
BASE_FOLDER = "data"
assert len(data["credentials"]) > NUM_KEYSTORES_TO_GENERATE
import shutil
#if os.path.exists(BASE_FOLDER):
# shutil.rmtree(BASE_FOLDER)
if not os.path.exists(BASE_FOLDER):
os.mkdir(BASE_FOLDER, mode=0o777, dir_fd=None)
index = 0
for k,v in data["credentials"].items():
new_cred = copy.deepcopy(base_credentials)
new_cred["credentials"][k] = v
#base_credentials["credentials"][0] = data["credentials"][i]
print(base_credentials)
new_dir = BASE_FOLDER + "/nwaku_" + str(index)
if not os.path.exists(new_dir):
os.mkdir(new_dir, mode=0o777, dir_fd=None)
fname = new_dir+'/rlnKeystore_' + str(index) + ".json"
with open(fname, 'w') as outfile:
json.dump(new_cred, outfile, separators=(',', ':'))
#json.dump(base_credentials, outfile)
#os.chmod(fname, 0o777)
import stat
#os.chmod(fname, stat.S_IRWXO)
#os.chmod(fname, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
# quick to make it work
print(subprocess.run(['chmod', '777', fname]))
print(subprocess.run(['chmod', '777', new_dir]))
index += 1
f.close()

View File

@ -19,11 +19,14 @@ if [ -z "${BOOTSTRAP_ENR}" ]; then
exit 1
fi
echo "Bootstrap node: ${BOOTSTRAP_ENR}"
RANDOM_PEERS=$(shuf -i 20-80 -n 1)
echo $RANDOM_PEERS
echo "Using bootstrap node: ${BOOTSTRAP_ENR}"
exec /usr/bin/wakunode\
--relay=true\
--rpc-admin=true\
--max-connections=250\
--max-connections=20\
--dns-discovery=true\
--discv5-discovery=true\
--discv5-enr-auto-update=True\
@ -36,7 +39,7 @@ exec /usr/bin/wakunode\
--rln-relay=true \
--rln-relay-dynamic=true \
--rln-relay-cred-password=password \
--rln-relay-cred-path=/rlnKeystore.json \
--rln-relay-membership-index=$REPLICA \
--rln-relay-eth-contract-address=0x2992c7bFD42729991b614e95F4C2C78619f49c50 \
--rln-relay-eth-client-address=ws://linux-01.ih-eu-mda1.nimbus.sepolia.wg:9557
--rln-relay-cred-path=/data/rlnKeystore_$REPLICA.json \
--rln-relay-tree-path=/data/rln_tree.db \
--rln-relay-eth-contract-address=0x0A988fd9CA5BAebDf098b8A73621b2AaDa6492E8 \
--rln-relay-eth-client-address=ws://linux-01.ih-eu-mda1.nimbus.sepolia.wg:9558

19
up_containers.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
echo "Generating rln memberships into a single keystore"
# clean old keystore
#rm rlnKeystore.json
# seems we dont populate the chain id, so infura considers it as replayable and rejects it.
#ws://linux-01.ih-eu-mda1.nimbus.sepolia.wg:9557
for i in {1..10}
do
docker-compose up -d nwaku_$i
sleep 5
done
# TODO: add this. run at the end. ensures the size of the keystore matches
# grep -o salt rlnKeystore.json | wc -l