-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
byzantine strategy: null proposal leader
- Loading branch information
Showing
12 changed files
with
102 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# This script is used to set the leader strategy in config file. | ||
# Usage: ./set_leader_strategy.sh <strategy> | ||
# <strategy> can be one of the following: | ||
# 1. "leader" (corresponds to honest behavior) | ||
# 2. "leader_null_proposal" (corresponds to malicious behavior: no proposal send out during genesis stage) | ||
|
||
strategy=$1 | ||
valid_strategies=("leader" "leader_null_proposal") | ||
|
||
if [[ ! " ${valid_strategies[@]} " =~ " ${strategy} " ]]; then | ||
echo -e "\033[31mERROR:\033[0m Invalid strategy: got $strategy, expected one of [${valid_strategies[@]}]" >&2 | ||
exit 1 | ||
fi | ||
|
||
awk 'NR==1 { $2="'"$strategy"'" } 1' config.txt > tmp.txt && mv tmp.txt config.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use std::process::exit; | ||
|
||
use crate::consensus::ConsensusNode; | ||
|
||
use super::GenesisStrategy; | ||
|
||
pub struct NullProposalStrategy; | ||
|
||
impl GenesisStrategy for NullProposalStrategy { | ||
// no proposal is sent by the leader | ||
fn genesis_stage(&self, mut _self_node: ConsensusNode) { exit(0) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters