add repro scripts folder (#23)

This commit is contained in:
Florin Barbu 2024-03-18 12:28:35 +02:00 committed by GitHub
parent 26dd7144c7
commit 124f6cd5ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 161 additions and 0 deletions

3
scripts/README.md Normal file
View File

@ -0,0 +1,3 @@
# Scripts
A collection of scripts and examples on how to reproduce different bugs or use cases

View File

@ -0,0 +1,79 @@
#!/bin/bash
printf "\nAssuming you already have a docker network called waku\n"
# if not something like this should create it: docker network create --driver bridge --subnet 172.18.0.0/16 --gateway 172.18.0.1 waku
cluster_id=4
pubsub_topic="/waku/2/rs/$cluster_id/0"
encoded_pubsub_topic=$(echo "$pubsub_topic" | sed 's:/:%2F:g')
node_1=harbor.status.im/wakuorg/nwaku:latest
node_2=harbor.status.im/wakuorg/go-waku:latest
printf "\nStarting containers\n"
container_id1=$(docker run -d -i -t -p 12297:12297 -p 12298:12298 -p 12299:12299 -p 12300:12300 -p 12301:12301 $node_1 --listen-address=0.0.0.0 --rest=true --rest-admin=true --websocket-support=true --log-level=DEBUG --rest-relay-cache-capacity=100 --websocket-port=12299 --rest-port=12297 --tcp-port=12298 --discv5-udp-port=12300 --rest-address=0.0.0.0 --nat=extip:172.18.45.95 --peer-exchange=true --discv5-discovery=true --cluster-id=$cluster_id --relay=true --nodekey=30348dd51465150e04a5d9d932c72864c8967f806cce60b5d26afeca1e77eb68)
docker network connect --ip 172.18.45.95 waku $container_id1
printf "\nSleeping 2 seconds\n"
sleep 2
response=$(curl -X GET "http://127.0.0.1:12297/debug/v1/info" -H "accept: application/json")
enrUri=$(echo $response | jq -r '.enrUri')
container_id2=$(docker run -d -i -t -p 8158:8158 -p 8159:8159 -p 8160:8160 -p 8161:8161 -p 8162:8162 $node_2 --listen-address=0.0.0.0 --rest=true --rest-admin=true --websocket-support=true --log-level=DEBUG --rest-relay-cache-capacity=100 --websocket-port=8160 --rest-port=8158 --tcp-port=8159 --discv5-udp-port=8161 --rest-address=0.0.0.0 --nat=extip:172.18.207.159 --peer-exchange=true --discv5-discovery=true --cluster-id=$cluster_id --relay=true --discv5-bootstrap-node=$enrUri)
docker network connect --ip 172.18.207.159 waku $container_id2
printf "\nSleeping 1 seconds\n"
sleep 1
printf "\nSubscribe\n"
curl -X POST "http://127.0.0.1:12297/relay/v1/subscriptions" -H "Content-Type: application/json" -d "[\"$pubsub_topic\"]"
curl -X POST "http://127.0.0.1:8158/relay/v1/subscriptions" -H "Content-Type: application/json" -d "[\"$pubsub_topic\"]"
printf "\nSleeping 70 seconds\n"
sleep 70
printf "\nRelay from NODE 1\n"
curl -X POST "http://127.0.0.1:12297/relay/v1/messages/$encoded_pubsub_topic" -H "Content-Type: application/json" -d '{"payload": "UmVsYXkgd29ya3MhIQ==", "contentTopic": "/test/1/waku-relay/proto", "timestamp": '$(date +%s%N)'}'
printf "\nSleeping 1 seconds\n"
sleep 1
printf "\nCheck message in NODE 2\n"
response=$(curl -X GET "http://127.0.0.1:8158/relay/v1/messages/$encoded_pubsub_topic" -H "Content-Type: application/json")
printf "\nResponse: $response\n"
if [ "$response" == "no subscription found for pubsubTopic" ] || [ "$response" == "[]" ] || [ -z "$response" ] || [ "$response" == "null" ]; then
printf "\nError: NODE 2 didn't find the message, the response is null, or the response contains the text 'null'\n"
exit 1
else
printf "\nSuccess: NODE 2 received the message\n"
fi
printf "\nUn-Subscribe NODE 2\n"
curl -X DELETE "http://127.0.0.1:8158/relay/v1/subscriptions" -H "Content-Type: application/json" -d "[\"$pubsub_topic\"]"
printf "\nSleeping 1 seconds\n"
sleep 1
printf "\nRelay from NODE 1\n"
curl -X POST "http://127.0.0.1:12297/relay/v1/messages/$encoded_pubsub_topic" -H "Content-Type: application/json" -d '{"payload": "UmVsYXkgd29ya3MhIQ==", "contentTopic": "/test/1/waku-relay/proto", "timestamp": '$(date +%s%N)'}'
printf "\nSleeping 1 seconds\n"
sleep 1
printf "\nCheck message in NODE 2\n"
response=$(curl -X GET "http://127.0.0.1:8158/relay/v1/messages/$encoded_pubsub_topic" -H "Content-Type: application/json")
printf "\nResponse: $response\n"
if [ "$response" == "no subscription found for pubsubTopic" ] || [ "$response" == "[]" ] || [ -z "$response" ] || [ "$response" == "null" ]; then
printf "\nSuccess: NODE 2 didn't find the message\n"
else
printf "\nError: NODE 2 received the message\n"
exit 1
fi

View File

@ -0,0 +1,79 @@
#!/bin/bash
echo "Assuming you already have a docker network called waku"
# if not something like this should create it: docker network create --driver bridge --subnet 172.18.0.0/16 --gateway 172.18.0.1 waku
echo "Starting containers"
container_id1=$(docker run -d -i -t -p 41717:41717 -p 41718:41718 -p 41719:41719 -p 41720:41720 -p 41721:41721 harbor.status.im/wakuorg/nwaku:latest --listen-address=0.0.0.0 --rest=true --rest-admin=true --websocket-support=true --log-level=TRACE --rest-relay-cache-capacity=100 --websocket-port=41719 --rest-port=41717 --tcp-port=41718 --discv5-udp-port=41720 --rest-address=0.0.0.0 --nat=extip:172.18.223.170 --peer-exchange=true --discv5-discovery=true --cluster-id=0 --metrics-server=true --metrics-server-address=0.0.0.0 --metrics-server-port=41721 --metrics-logging=true --relay=true --filter=true --nodekey=30348dd51465150e04a5d9d932c72864c8967f806cce60b5d26afeca1e77eb68)
docker network connect --ip 172.18.223.170 waku $container_id1
container_id2=$(docker run -d -i -t -p 10628:10628 -p 10629:10629 -p 10630:10630 -p 10631:10631 -p 10632:10632 harbor.status.im/wakuorg/nwaku:latest --listen-address=0.0.0.0 --rest=true --rest-admin=true --websocket-support=true --log-level=TRACE --rest-relay-cache-capacity=100 --websocket-port=10630 --rest-port=10628 --tcp-port=10629 --discv5-udp-port=10631 --rest-address=0.0.0.0 --nat=extip:172.18.249.98 --peer-exchange=true --discv5-discovery=true --cluster-id=0 --metrics-server=true --metrics-server-address=0.0.0.0 --metrics-server-port=10632 --metrics-logging=true --relay=false --filter=true --discv5-bootstrap-node=enr:-Kq4QEXWJfpPEPrBCJlgXGla9FJiEzYKM6P8DuVyQbGyl_-POLWKvQgMQEZDF3tDPTIdUKqCI8i2GG0MW2FsOkAtoW0BgmlkgnY0gmlwhKwS36qKbXVsdGlhZGRyc4wACgSsEt-qBqL33QOJc2VjcDI1NmsxoQM3Tqpf5eFn4Jztm4gB0Y0JVSJyxyZsW8QR-QU5DZb-PYN0Y3CCovaDdWRwgqL4hXdha3UyBQ --filternode=/ip4/172.18.223.170/tcp/41718/p2p/16Uiu2HAmGNtM2rQ8abySFNhqPDFY4cmfAEpfo9Z9fD3NekoFR2ip)
docker network connect --ip 172.18.249.98 waku $container_id2
container_id3=$(docker run -d -i -t -p 12108:12108 -p 12109:12109 -p 12110:12110 -p 12111:12111 -p 12112:12112 harbor.status.im/wakuorg/go-waku:latest --listen-address=0.0.0.0 --rest=true --rest-admin=true --websocket-support=true --log-level=DEBUG --rest-relay-cache-capacity=100 --websocket-port=12110 --rest-port=12108 --tcp-port=12109 --discv5-udp-port=12111 --rest-address=0.0.0.0 --nat=extip:172.18.102.113 --peer-exchange=true --discv5-discovery=true --cluster-id=0 --min-relay-peers-to-publish=1 --rest-filter-cache-capacity=50 --relay=false --filter=true --discv5-bootstrap-node=enr:-Kq4QEXWJfpPEPrBCJlgXGla9FJiEzYKM6P8DuVyQbGyl_-POLWKvQgMQEZDF3tDPTIdUKqCI8i2GG0MW2FsOkAtoW0BgmlkgnY0gmlwhKwS36qKbXVsdGlhZGRyc4wACgSsEt-qBqL33QOJc2VjcDI1NmsxoQM3Tqpf5eFn4Jztm4gB0Y0JVSJyxyZsW8QR-QU5DZb-PYN0Y3CCovaDdWRwgqL4hXdha3UyBQ --filternode=/ip4/172.18.223.170/tcp/41718/p2p/16Uiu2HAmGNtM2rQ8abySFNhqPDFY4cmfAEpfo9Z9fD3NekoFR2ip)
docker network connect --ip 172.18.102.113 waku $container_id3
container_id4=$(docker run -d -i -t -p 6707:6707 -p 6708:6708 -p 6709:6709 -p 6710:6710 -p 6711:6711 harbor.status.im/wakuorg/go-waku:latest --listen-address=0.0.0.0 --rest=true --rest-admin=true --websocket-support=true --log-level=DEBUG --rest-relay-cache-capacity=100 --websocket-port=6709 --rest-port=6707 --tcp-port=6708 --discv5-udp-port=6710 --rest-address=0.0.0.0 --nat=extip:172.18.156.205 --peer-exchange=true --discv5-discovery=true --cluster-id=0 --min-relay-peers-to-publish=1 --rest-filter-cache-capacity=50 --relay=false --filter=true --discv5-bootstrap-node=enr:-Kq4QEXWJfpPEPrBCJlgXGla9FJiEzYKM6P8DuVyQbGyl_-POLWKvQgMQEZDF3tDPTIdUKqCI8i2GG0MW2FsOkAtoW0BgmlkgnY0gmlwhKwS36qKbXVsdGlhZGRyc4wACgSsEt-qBqL33QOJc2VjcDI1NmsxoQM3Tqpf5eFn4Jztm4gB0Y0JVSJyxyZsW8QR-QU5DZb-PYN0Y3CCovaDdWRwgqL4hXdha3UyBQ --filternode=/ip4/172.18.223.170/tcp/41718/p2p/16Uiu2HAmGNtM2rQ8abySFNhqPDFY4cmfAEpfo9Z9fD3NekoFR2ip)
docker network connect --ip 172.18.156.205 waku $container_id4
container_id5=$(docker run -d -i -t -p 30889:30889 -p 30890:30890 -p 30891:30891 -p 30892:30892 -p 30893:30893 harbor.status.im/wakuorg/go-waku:latest --listen-address=0.0.0.0 --rest=true --rest-admin=true --websocket-support=true --log-level=DEBUG --rest-relay-cache-capacity=100 --websocket-port=30891 --rest-port=30889 --tcp-port=30890 --discv5-udp-port=30892 --rest-address=0.0.0.0 --nat=extip:172.18.161.78 --peer-exchange=true --discv5-discovery=true --cluster-id=0 --min-relay-peers-to-publish=1 --rest-filter-cache-capacity=50 --relay=false --filter=true --discv5-bootstrap-node=enr:-Kq4QEXWJfpPEPrBCJlgXGla9FJiEzYKM6P8DuVyQbGyl_-POLWKvQgMQEZDF3tDPTIdUKqCI8i2GG0MW2FsOkAtoW0BgmlkgnY0gmlwhKwS36qKbXVsdGlhZGRyc4wACgSsEt-qBqL33QOJc2VjcDI1NmsxoQM3Tqpf5eFn4Jztm4gB0Y0JVSJyxyZsW8QR-QU5DZb-PYN0Y3CCovaDdWRwgqL4hXdha3UyBQ --filternode=/ip4/172.18.223.170/tcp/41718/p2p/16Uiu2HAmGNtM2rQ8abySFNhqPDFY4cmfAEpfo9Z9fD3NekoFR2ip)
docker network connect --ip 172.18.161.78 waku $container_id5
echo "Sleeping 20 seconds"
sleep 20
echo "Subscribe"
curl -v -X POST "http://127.0.0.1:41717/relay/v1/subscriptions" -H "Content-Type: application/json" -d '["/waku/2/rs/0/1"]'
curl -v -X POST "http://127.0.0.1:10628/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "aa7ae897-e14b-494a-b1c5-a5c69488ced0", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/0/1"}'
curl -v -X POST "http://127.0.0.1:12108/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "497fb697-4e1c-443b-b681-7c90f7e406bb", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/0/1"}'
curl -v -X POST "http://127.0.0.1:6707/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "bb2137a4-3d63-4afd-bc40-78eba0af4167", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/0/1"}'
curl -v -X POST "http://127.0.0.1:30889/filter/v2/subscriptions" -H "Content-Type: application/json" -d '{"requestId": "cbd1d59a-8989-4dc3-83a4-b6859e08cadf", "contentFilters": ["/test/1/waku-filter/proto"], "pubsubTopic": "/waku/2/rs/0/1"}'
echo "Sleeping 5 seconds"
sleep 5
echo "Relay from NODE 1"
curl -v -X POST "http://127.0.0.1:41717/relay/v1/messages/%2Fwaku%2F2%2Frs%2F0%2F1" -H "Content-Type: application/json" -d '{"payload": "RmlsdGVyIHdvcmtzISE=", "contentTopic": "/test/1/waku-filter/proto", "timestamp": '$(date +%s%N)'}'
echo "Sleeping 2 seconds"
sleep 2
echo "Check message in NODE 2"
response=$(curl -v -X GET "http://127.0.0.1:10628/filter/v2/messages/%2Ftest%2F1%2Fwaku-filter%2Fproto" -H "Content-Type: application/json")
if [ "$response" == "[]" ]; then
echo "Error: NODE 2 didn't find the message"
exit 1
else
echo "Success: NODE 2 received the message"
fi
echo "Check message in NODE 3"
response=$(curl -v -X GET "http://127.0.0.1:12108/filter/v2/messages/%2Fwaku%2F2%2Frs%2F0%2F1/%2Ftest%2F1%2Fwaku-filter%2Fproto" -H "Content-Type: application/json")
if [ "$response" == "[]" ]; then
echo "Error: NODE 3 didn't find the message"
exit 1
else
echo "Success: NODE 3 received the message"
fi
echo "Check message in NODE 4"
response=$(curl -v -X GET "http://127.0.0.1:6707/filter/v2/messages/%2Fwaku%2F2%2Frs%2F0%2F1/%2Ftest%2F1%2Fwaku-filter%2Fproto" -H "Content-Type: application/json")
if [ "$response" == "[]" ]; then
echo "Error: NODE 4 didn't find the message"
exit 1
else
echo "Success: NODE 4 received the message"
fi
echo "Check message in NODE 5"
response=$(curl -v -X GET "http://127.0.0.1:30889/filter/v2/messages/%2Fwaku%2F2%2Frs%2F0%2F1/%2Ftest%2F1%2Fwaku-filter%2Fproto" -H "Content-Type: application/json")
if [ "$response" == "[]" ]; then
echo "Error: NODE 5 didn't find the message"
exit 1
else
echo "Success: NODE 5 received the message"
fi