Skip to content

Commit d5ff7ec

Browse files
committed
Add inject spam script.
1 parent 954562f commit d5ff7ec

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

inject_spam.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
# Function to print the usage of the script
4+
usage() {
5+
echo "Usage: $0 --static-node <> --delay-milliseconds <>"
6+
exit 1
7+
}
8+
9+
# Default values
10+
DEFAULT_DELAY_MILLISECONDS=200
11+
12+
# Initialize variables
13+
DELAY_MILLISECONDS=$DEFAULT_DELAY_MILLISECONDS
14+
STATIC_NODE=""
15+
16+
# Parse named parameters
17+
while [[ "$#" -gt 0 ]]; do
18+
case $1 in
19+
--delay-milliseconds)
20+
DELAY_MILLISECONDS="$2"
21+
shift 2
22+
;;
23+
--static-node)
24+
STATIC_NODE="$2"
25+
shift 2
26+
;;
27+
*)
28+
echo "Unknown parameter passed: $1"
29+
usage
30+
;;
31+
esac
32+
done
33+
34+
# Validate required parameters
35+
if [[ -z "$STATIC_NODE" ]]; then
36+
echo "Error: --static-node is required."
37+
usage
38+
fi
39+
40+
# Validate delay-seconds is an integer
41+
if ! [[ "$DELAY_MILLISECONDS" =~ ^[0-9]+$ ]]; then
42+
echo "Error: --delay-milliseconds must be an integer."
43+
exit 1
44+
fi
45+
46+
# Check if default values are used and warn
47+
if [[ "$DELAY_MILLISECONDS" -eq $DEFAULT_DELAY_MILLISECONDS ]]; then
48+
echo "Warning: Using default value for --delay-milliseconds: $DEFAULT_DELAY_MILLISECONDS"
49+
fi
50+
51+
# Output the parameters as a summary
52+
echo "====================================="
53+
echo " Summary of Parameters "
54+
echo "====================================="
55+
echo "- Delay: ${DELAY_MILLISECONDS}ms"
56+
echo "- Static Node: ${STATIC_NODE}"
57+
echo "====================================="
58+
59+
# Run the command
60+
docker run -it --network waku-simulator_simulation quay.io/wakuorg/nwaku-pr:2821 \
61+
--relay=true \
62+
--rln-relay=true \
63+
--rln-relay-dynamic=true \
64+
--rln-relay-eth-client-address=http://foundry:8545 \
65+
--rln-relay-eth-contract-address=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 \
66+
--rln-relay-epoch-sec=1 \
67+
--rln-relay-user-message-limit=1 \
68+
--log-level=DEBUG \
69+
--staticnode=${STATIC_NODE} \
70+
--pubsub-topic=/waku/2/rs/66/0 \
71+
--cluster-id=66 \
72+
--rln-relay-eth-private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
73+
--rln-relay-cred-path=/keystore.json \
74+
--rln-relay-cred-password=password123 \
75+
--spammer=true \
76+
--spammer-delay-between-msg=${DELAY_MILLISECONDS}
77+

0 commit comments

Comments
 (0)