aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-02-25 16:53:27 -0500
committerDeterminant <[email protected]>2020-02-25 16:53:27 -0500
commitab5b9793e80c7235707eb33c67c92d55d8d18cca (patch)
treeeb1117f58eee02adc5dc6fef2c7ec05e90e6ce10 /scripts
parent601fe38247a8232694a3c9af282c179e6ad1720d (diff)
add a faulty leader example
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/faulty_leader_demo.sh24
-rwxr-xr-xscripts/run_demo_client.sh9
2 files changed, 29 insertions, 4 deletions
diff --git a/scripts/faulty_leader_demo.sh b/scripts/faulty_leader_demo.sh
new file mode 100755
index 0000000..a4df108
--- /dev/null
+++ b/scripts/faulty_leader_demo.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+killall hotstuff-app
+./examples/hotstuff-app --conf ./hotstuff-sec0.conf > log0 2>&1 &
+leader_pid="$!"
+rep=({1..3})
+if [[ $# -gt 0 ]]; then
+ rep=($@)
+fi
+for i in "${rep[@]}"; do
+ echo "starting replica $i"
+ #valgrind --leak-check=full ./examples/hotstuff-app --conf hotstuff-sec${i}.conf > log${i} 2>&1 &
+ #gdb -ex r -ex bt -ex q --args ./examples/hotstuff-app --conf hotstuff-sec${i}.conf > log${i} 2>&1 &
+ ./examples/hotstuff-app --conf ./hotstuff-sec${i}.conf > log${i} 2>&1 &
+done
+echo "All replicas started. Let's issue some commands to be replicated (in 5 sec)..."
+sleep 5
+echo "Start issuing commands and the leader will be killed in 5 seconds"
+./examples/hotstuff-client --idx 0 --iter -1 --max-async 4 &
+cli_pid=$!
+sleep 5
+kill "$leader_pid"
+echo "Leader is dead. Let's try to restart our clients (because the simple clients don't timeout/retry some lost requests)."
+kill "$cli_pid"
+./examples/hotstuff-client --idx 0 --iter -1 --max-async 4
diff --git a/scripts/run_demo_client.sh b/scripts/run_demo_client.sh
index c124d5d..09fafeb 100755
--- a/scripts/run_demo_client.sh
+++ b/scripts/run_demo_client.sh
@@ -1,7 +1,8 @@
#!/bin/bash
-# Try to run run_demo.sh first and then this script, then use Ctrl-C to
-# terminate the proposing replica (e.g. replica 0). Leader rotation will be
-# scheduled. Try to kill and run this script again, new commands should still
-# get through (be replicated) once the new leader becomes stable.
+# Try to run the replicas as in run_demo.sh first and then run_demo_client.sh.
+# Use Ctrl-C to terminate the proposing replica (e.g. replica 0). Leader
+# rotation will be scheduled. Try to kill and run run_demo_client.sh again, new
+# commands should still get through (be replicated) once the new leader becomes
+# stable.
./examples/hotstuff-client --idx 0 --iter -1 --max-async 4