Skip to content

Commit

Permalink
check F and NODES on launch
Browse files Browse the repository at this point in the history
  • Loading branch information
pysel committed Oct 15, 2023
1 parent 65c1925 commit c43d846
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CURTIME := $(shell date +%s) # current system time in UNIX
launch:
@rm -rf output.txt
@./scripts/generate_config.sh ${NODES}
./scripts/launch_with_X_nodes.sh ${NODES} ${F} ${CURTIME} &
./scripts/launch_with_X_nodes.sh ${NODES} ${F} ${CURTIME}

# launch-default launches a protocol with 1 leader and 9 followers
# sets F to 8 (hence, 8 Byzantine nodes can be tolerated)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ where `X` is a number of nodes and `Y` is a number of Byzantine nodes a protocol
(in other words, a number of stages a protocol will execute).

Note: available values for `Y`: [0; X-2].

Reason: there should be at least 2 honest nodes in the system.

Note#2: available values for `X`: 3+.

Reason: there should be at least 3 nodes in the consensus instance (otherwise, it's trivial).

### Default way

To run a protocol in default mode, execute:
Expand Down
12 changes: 12 additions & 0 deletions scripts/launch_with_X_nodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ num_of_nodes=$1
F=$2
curtime=$3

upperbound_F=$(($num_of_nodes - 2))

if [ $num_of_nodes -lt 3 ]; then
echo -e "\033[31mERROR:\033[0m Number of nodes should be at least 3: got $num_of_nodes, expected 3 or more" >&2
exit 1
fi

if [ $F -gt $upperbound_F ]; then
echo -e "\033[31mERROR:\033[0m F should not be set to more than number of nodes - 2: got $F, expected $upperbound_F or less" >&2
exit 1
fi

cargo run $(pwd)/config.txt 0 $F $curtime & # launch leader

for ((i=1; i<$num_of_nodes; i++))
Expand Down

0 comments on commit c43d846

Please sign in to comment.