commit
d0021c93f0
@ -1,3 +1,3 @@ |
||||
#!/bin/bash -x |
||||
cd /home/ec2-user/projects/src/harmony-benchmark |
||||
./deploy_linux.sh local_iplist2.txt |
||||
./deploy_linux.sh local_config2.txt |
@ -0,0 +1,34 @@ |
||||
package consensus |
||||
|
||||
import ( |
||||
"harmony-benchmark/p2p" |
||||
"testing" |
||||
) |
||||
|
||||
func TestConstructAnnounceMessage(test *testing.T) { |
||||
header := getBlockHeader() |
||||
leader := p2p.Peer{Ip: "1", Port: "2"} |
||||
validator := p2p.Peer{Ip: "3", Port: "5"} |
||||
consensus := NewConsensus("1", "2", "0", []p2p.Peer{leader, validator}, leader) |
||||
consensus.blockHash = getBlockHash(make([]byte, 10)) |
||||
msg, err := consensus.constructAnnounceMessage() |
||||
|
||||
if err != nil { |
||||
test.Error("Annouce message is not constructed successfully") |
||||
} |
||||
if len(msg) != 1+1+1+4+32+2+4+64+len(header) { |
||||
test.Errorf("Annouce message is not constructed in the correct size: %d", len(msg)) |
||||
} |
||||
} |
||||
|
||||
func TestConstructChallengeMessage(test *testing.T) { |
||||
leader := p2p.Peer{Ip: "1", Port: "2"} |
||||
validator := p2p.Peer{Ip: "3", Port: "5"} |
||||
consensus := NewConsensus("1", "2", "0", []p2p.Peer{leader, validator}, leader) |
||||
consensus.blockHash = getBlockHash(make([]byte, 10)) |
||||
msg := consensus.constructChallengeMessage() |
||||
|
||||
if len(msg) != 1+1+1+4+32+2+33+33+32+64 { |
||||
test.Errorf("Annouce message is not constructed in the correct size: %d", len(msg)) |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
package consensus |
||||
|
||||
import ( |
||||
"harmony-benchmark/common" |
||||
"harmony-benchmark/p2p" |
||||
"testing" |
||||
) |
||||
|
||||
func TestNewConsensus(test *testing.T) { |
||||
leader := p2p.Peer{Ip: "1", Port: "2"} |
||||
validator := p2p.Peer{Ip: "3", Port: "5"} |
||||
consensus := NewConsensus("1", "2", "0", []p2p.Peer{leader, validator}, leader) |
||||
if consensus.consensusId != 0 { |
||||
test.Errorf("Consensus Id is initialized to the wrong value: %d", consensus.consensusId) |
||||
} |
||||
|
||||
if consensus.IsLeader != true { |
||||
test.Error("Consensus should belong to a leader") |
||||
} |
||||
|
||||
if consensus.ReadySignal == nil { |
||||
test.Error("Consensus ReadySignal should be initialized") |
||||
} |
||||
|
||||
if consensus.actionType != byte(common.CONSENSUS) { |
||||
test.Error("Consensus actionType should be CONSENSUS") |
||||
} |
||||
|
||||
if consensus.msgCategory != byte(common.COMMITTEE) { |
||||
test.Error("Consensus msgCategory should be COMMITTEE") |
||||
} |
||||
|
||||
if consensus.leader != leader { |
||||
test.Error("Consensus Leader is set to wrong Peer") |
||||
} |
||||
} |
@ -0,0 +1,30 @@ |
||||
package consensus |
||||
|
||||
import ( |
||||
"harmony-benchmark/p2p" |
||||
"testing" |
||||
) |
||||
|
||||
func TestConstructCommitMessage(test *testing.T) { |
||||
leader := p2p.Peer{Ip: "1", Port: "2"} |
||||
validator := p2p.Peer{Ip: "3", Port: "5"} |
||||
consensus := NewConsensus("1", "2", "0", []p2p.Peer{leader, validator}, leader) |
||||
consensus.blockHash = getBlockHash(make([]byte, 10)) |
||||
msg := consensus.constructCommitMessage() |
||||
|
||||
if len(msg) != 1+1+1+4+32+2+33+64 { |
||||
test.Errorf("Commit message is not constructed in the correct size: %d", len(msg)) |
||||
} |
||||
} |
||||
|
||||
func TestConstructResponseMessage(test *testing.T) { |
||||
leader := p2p.Peer{Ip: "1", Port: "2"} |
||||
validator := p2p.Peer{Ip: "3", Port: "5"} |
||||
consensus := NewConsensus("1", "2", "0", []p2p.Peer{leader, validator}, leader) |
||||
consensus.blockHash = getBlockHash(make([]byte, 10)) |
||||
msg := consensus.constructResponseMessage() |
||||
|
||||
if len(msg) != 1+1+1+4+32+2+32+64 { |
||||
test.Errorf("Response message is not constructed in the correct size: %d", len(msg)) |
||||
} |
||||
} |
@ -1,9 +1,9 @@ |
||||
./kill_node.sh |
||||
ipfile=$1 |
||||
config=$1 |
||||
while IFS='' read -r line || [[ -n "$line" ]]; do |
||||
IFS=' ' read ip port mode <<< $line |
||||
#echo $ip $port $mode $ipfile |
||||
go run ./benchmark_main.go -ip $ip -port $port -ipfile $ipfile& |
||||
done < $ipfile |
||||
#echo $ip $port $mode $config |
||||
go run ./benchmark_main.go -ip $ip -port $port -config_file $config& |
||||
done < $config |
||||
|
||||
go run ./aws-code/transaction_generator.go -ipfile $ipfile |
||||
go run ./aws-code/transaction_generator.go -config_file $config |
@ -0,0 +1,101 @@ |
||||
127.0.0.1 9001 validator 0 |
||||
127.0.0.1 9002 validator 0 |
||||
127.0.0.1 9003 validator 0 |
||||
127.0.0.1 9004 validator 0 |
||||
127.0.0.1 9005 validator 0 |
||||
127.0.0.1 9006 validator 0 |
||||
127.0.0.1 9007 validator 0 |
||||
127.0.0.1 9008 validator 0 |
||||
127.0.0.1 9009 validator 0 |
||||
127.0.0.1 9010 validator 0 |
||||
127.0.0.1 9011 validator 0 |
||||
127.0.0.1 9012 validator 0 |
||||
127.0.0.1 9013 validator 0 |
||||
127.0.0.1 9014 validator 0 |
||||
127.0.0.1 9015 validator 0 |
||||
127.0.0.1 9016 validator 0 |
||||
127.0.0.1 9017 validator 0 |
||||
127.0.0.1 9018 validator 0 |
||||
127.0.0.1 9019 validator 0 |
||||
127.0.0.1 9020 validator 0 |
||||
127.0.0.1 9021 validator 0 |
||||
127.0.0.1 9022 validator 0 |
||||
127.0.0.1 9023 validator 0 |
||||
127.0.0.1 9024 validator 0 |
||||
127.0.0.1 9025 validator 0 |
||||
127.0.0.1 9026 validator 0 |
||||
127.0.0.1 9027 validator 0 |
||||
127.0.0.1 9028 validator 0 |
||||
127.0.0.1 9029 validator 0 |
||||
127.0.0.1 9030 validator 0 |
||||
127.0.0.1 9031 validator 0 |
||||
127.0.0.1 9032 validator 0 |
||||
127.0.0.1 9033 validator 0 |
||||
127.0.0.1 9034 validator 0 |
||||
127.0.0.1 9035 validator 0 |
||||
127.0.0.1 9036 validator 0 |
||||
127.0.0.1 9037 validator 0 |
||||
127.0.0.1 9038 validator 0 |
||||
127.0.0.1 9039 validator 0 |
||||
127.0.0.1 9040 validator 0 |
||||
127.0.0.1 9041 validator 0 |
||||
127.0.0.1 9042 validator 0 |
||||
127.0.0.1 9043 validator 0 |
||||
127.0.0.1 9044 validator 0 |
||||
127.0.0.1 9045 validator 0 |
||||
127.0.0.1 9046 validator 0 |
||||
127.0.0.1 9047 validator 0 |
||||
127.0.0.1 9048 validator 0 |
||||
127.0.0.1 9049 validator 0 |
||||
127.0.0.1 9050 validator 0 |
||||
127.0.0.1 9051 validator 0 |
||||
127.0.0.1 9052 validator 0 |
||||
127.0.0.1 9053 validator 0 |
||||
127.0.0.1 9054 validator 0 |
||||
127.0.0.1 9055 validator 0 |
||||
127.0.0.1 9056 validator 0 |
||||
127.0.0.1 9057 validator 0 |
||||
127.0.0.1 9058 validator 0 |
||||
127.0.0.1 9059 validator 0 |
||||
127.0.0.1 9060 validator 0 |
||||
127.0.0.1 9061 validator 0 |
||||
127.0.0.1 9062 validator 0 |
||||
127.0.0.1 9063 validator 0 |
||||
127.0.0.1 9064 validator 0 |
||||
127.0.0.1 9065 validator 0 |
||||
127.0.0.1 9066 validator 0 |
||||
127.0.0.1 9067 validator 0 |
||||
127.0.0.1 9068 validator 0 |
||||
127.0.0.1 9069 validator 0 |
||||
127.0.0.1 9070 validator 0 |
||||
127.0.0.1 9071 validator 0 |
||||
127.0.0.1 9072 validator 0 |
||||
127.0.0.1 9073 validator 0 |
||||
127.0.0.1 9074 validator 0 |
||||
127.0.0.1 9075 validator 0 |
||||
127.0.0.1 9076 validator 0 |
||||
127.0.0.1 9077 validator 0 |
||||
127.0.0.1 9078 validator 0 |
||||
127.0.0.1 9079 validator 0 |
||||
127.0.0.1 9080 validator 0 |
||||
127.0.0.1 9081 validator 0 |
||||
127.0.0.1 9082 validator 0 |
||||
127.0.0.1 9083 validator 0 |
||||
127.0.0.1 9084 validator 0 |
||||
127.0.0.1 9085 validator 0 |
||||
127.0.0.1 9086 validator 0 |
||||
127.0.0.1 9087 validator 0 |
||||
127.0.0.1 9088 validator 0 |
||||
127.0.0.1 9089 validator 0 |
||||
127.0.0.1 9090 validator 0 |
||||
127.0.0.1 9091 validator 0 |
||||
127.0.0.1 9092 validator 0 |
||||
127.0.0.1 9093 validator 0 |
||||
127.0.0.1 9094 validator 0 |
||||
127.0.0.1 9095 validator 0 |
||||
127.0.0.1 9096 validator 0 |
||||
127.0.0.1 9097 validator 0 |
||||
127.0.0.1 9098 validator 0 |
||||
127.0.0.1 9099 validator 0 |
||||
127.0.0.1 9100 validator 0 |
||||
127.0.0.1 9000 leader 0 |
@ -0,0 +1,11 @@ |
||||
127.0.0.1 9001 validator 0 |
||||
127.0.0.1 9002 validator 0 |
||||
127.0.0.1 9003 validator 0 |
||||
127.0.0.1 9004 validator 0 |
||||
127.0.0.1 9005 validator 0 |
||||
127.0.0.1 9006 validator 0 |
||||
127.0.0.1 9007 validator 0 |
||||
127.0.0.1 9008 validator 0 |
||||
127.0.0.1 9009 validator 0 |
||||
127.0.0.1 9010 validator 0 |
||||
127.0.0.1 9000 leader 0 |
@ -0,0 +1,22 @@ |
||||
127.0.0.1 9010 validator 0 |
||||
127.0.0.1 9011 validator 0 |
||||
127.0.0.1 9012 validator 0 |
||||
127.0.0.1 9013 validator 0 |
||||
127.0.0.1 9014 validator 0 |
||||
127.0.0.1 9015 validator 0 |
||||
127.0.0.1 9016 validator 0 |
||||
127.0.0.1 9017 validator 0 |
||||
127.0.0.1 9018 validator 0 |
||||
127.0.0.1 9019 validator 0 |
||||
127.0.0.1 9020 validator 1 |
||||
127.0.0.1 9021 validator 1 |
||||
127.0.0.1 9022 validator 1 |
||||
127.0.0.1 9023 validator 1 |
||||
127.0.0.1 9024 validator 1 |
||||
127.0.0.1 9025 validator 1 |
||||
127.0.0.1 9026 validator 1 |
||||
127.0.0.1 9027 validator 1 |
||||
127.0.0.1 9028 validator 1 |
||||
127.0.0.1 9029 validator 1 |
||||
127.0.0.1 9000 leader 0 |
||||
127.0.0.1 9001 leader 1 |
@ -1,101 +0,0 @@ |
||||
127.0.0.1 9001 validator |
||||
127.0.0.1 9002 validator |
||||
127.0.0.1 9003 validator |
||||
127.0.0.1 9004 validator |
||||
127.0.0.1 9005 validator |
||||
127.0.0.1 9006 validator |
||||
127.0.0.1 9007 validator |
||||
127.0.0.1 9008 validator |
||||
127.0.0.1 9009 validator |
||||
127.0.0.1 9010 validator |
||||
127.0.0.1 9011 validator |
||||
127.0.0.1 9012 validator |
||||
127.0.0.1 9013 validator |
||||
127.0.0.1 9014 validator |
||||
127.0.0.1 9015 validator |
||||
127.0.0.1 9016 validator |
||||
127.0.0.1 9017 validator |
||||
127.0.0.1 9018 validator |
||||
127.0.0.1 9019 validator |
||||
127.0.0.1 9020 validator |
||||
127.0.0.1 9021 validator |
||||
127.0.0.1 9022 validator |
||||
127.0.0.1 9023 validator |
||||
127.0.0.1 9024 validator |
||||
127.0.0.1 9025 validator |
||||
127.0.0.1 9026 validator |
||||
127.0.0.1 9027 validator |
||||
127.0.0.1 9028 validator |
||||
127.0.0.1 9029 validator |
||||
127.0.0.1 9030 validator |
||||
127.0.0.1 9031 validator |
||||
127.0.0.1 9032 validator |
||||
127.0.0.1 9033 validator |
||||
127.0.0.1 9034 validator |
||||
127.0.0.1 9035 validator |
||||
127.0.0.1 9036 validator |
||||
127.0.0.1 9037 validator |
||||
127.0.0.1 9038 validator |
||||
127.0.0.1 9039 validator |
||||
127.0.0.1 9040 validator |
||||
127.0.0.1 9041 validator |
||||
127.0.0.1 9042 validator |
||||
127.0.0.1 9043 validator |
||||
127.0.0.1 9044 validator |
||||
127.0.0.1 9045 validator |
||||
127.0.0.1 9046 validator |
||||
127.0.0.1 9047 validator |
||||
127.0.0.1 9048 validator |
||||
127.0.0.1 9049 validator |
||||
127.0.0.1 9050 validator |
||||
127.0.0.1 9051 validator |
||||
127.0.0.1 9052 validator |
||||
127.0.0.1 9053 validator |
||||
127.0.0.1 9054 validator |
||||
127.0.0.1 9055 validator |
||||
127.0.0.1 9056 validator |
||||
127.0.0.1 9057 validator |
||||
127.0.0.1 9058 validator |
||||
127.0.0.1 9059 validator |
||||
127.0.0.1 9060 validator |
||||
127.0.0.1 9061 validator |
||||
127.0.0.1 9062 validator |
||||
127.0.0.1 9063 validator |
||||
127.0.0.1 9064 validator |
||||
127.0.0.1 9065 validator |
||||
127.0.0.1 9066 validator |
||||
127.0.0.1 9067 validator |
||||
127.0.0.1 9068 validator |
||||
127.0.0.1 9069 validator |
||||
127.0.0.1 9070 validator |
||||
127.0.0.1 9071 validator |
||||
127.0.0.1 9072 validator |
||||
127.0.0.1 9073 validator |
||||
127.0.0.1 9074 validator |
||||
127.0.0.1 9075 validator |
||||
127.0.0.1 9076 validator |
||||
127.0.0.1 9077 validator |
||||
127.0.0.1 9078 validator |
||||
127.0.0.1 9079 validator |
||||
127.0.0.1 9080 validator |
||||
127.0.0.1 9081 validator |
||||
127.0.0.1 9082 validator |
||||
127.0.0.1 9083 validator |
||||
127.0.0.1 9084 validator |
||||
127.0.0.1 9085 validator |
||||
127.0.0.1 9086 validator |
||||
127.0.0.1 9087 validator |
||||
127.0.0.1 9088 validator |
||||
127.0.0.1 9089 validator |
||||
127.0.0.1 9090 validator |
||||
127.0.0.1 9091 validator |
||||
127.0.0.1 9092 validator |
||||
127.0.0.1 9093 validator |
||||
127.0.0.1 9094 validator |
||||
127.0.0.1 9095 validator |
||||
127.0.0.1 9096 validator |
||||
127.0.0.1 9097 validator |
||||
127.0.0.1 9098 validator |
||||
127.0.0.1 9099 validator |
||||
127.0.0.1 9100 validator |
||||
127.0.0.1 9000 leader |
@ -1,11 +0,0 @@ |
||||
127.0.0.1 9001 validator |
||||
127.0.0.1 9002 validator |
||||
127.0.0.1 9003 validator |
||||
127.0.0.1 9004 validator |
||||
127.0.0.1 9005 validator |
||||
127.0.0.1 9006 validator |
||||
127.0.0.1 9007 validator |
||||
127.0.0.1 9008 validator |
||||
127.0.0.1 9009 validator |
||||
127.0.0.1 9010 validator |
||||
127.0.0.1 9000 leader |
Loading…
Reference in new issue