aboutsummaryrefslogtreecommitdiff
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
parent601fe38247a8232694a3c9af282c179e6ad1720d (diff)
add a faulty leader example
-rw-r--r--README.rst21
-rwxr-xr-xscripts/faulty_leader_demo.sh24
-rwxr-xr-xscripts/run_demo_client.sh9
3 files changed, 45 insertions, 9 deletions
diff --git a/README.rst b/README.rst
index a8ec2b4..cec827b 100644
--- a/README.rst
+++ b/README.rst
@@ -58,7 +58,16 @@ section may be incomplete and subject to changes.
cd libhotstuff/
git submodule update --init --recursive
- # ensure openssl and libevent are installed on your machine
+ # ensure openssl and libevent are installed on your machine, more
+ # specifically, you need:
+ #
+ # CMake >= 3.9 (cmake)
+ # C++14 (g++)
+ # libuv >= 1.10.0 (libuv1-dev)
+ # openssl >= 1.1.0 (libssl-dev)
+ #
+ # on Ubuntu: sudo apt-get install libssl-dev libuv1-dev cmake make
+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=ON -DHOTSTUFF_PROTO_LOG=ON
make
@@ -67,10 +76,12 @@ section may be incomplete and subject to changes.
# Fault tolerance:
- # Try to run run_demo.sh first and then run_demo_client.sh, then 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.
+ # 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. Or try the following script:
+ # scripts/faulty_leader_demo.sh
TODO
====
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