|
|
@ -148,21 +148,21 @@ func TestEvenNodes(t *testing.T) { |
|
|
|
sign(stakedVote, sKeys[reg], Prepare) |
|
|
|
sign(stakedVote, sKeys[reg], Prepare) |
|
|
|
achieved := stakedVote.IsQuorumAchieved(Prepare) |
|
|
|
achieved := stakedVote.IsQuorumAchieved(Prepare) |
|
|
|
if achieved { |
|
|
|
if achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, QuorumAchieved: %s, Expected: false (All Staker nodes = 32%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, QuorumAchieved: %s, Expected: false (All Staker nodes = 32%%)", |
|
|
|
Prepare, strconv.FormatBool(achieved)) |
|
|
|
Prepare, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// Commit
|
|
|
|
// Commit
|
|
|
|
sign(stakedVote, sKeys[reg], Commit) |
|
|
|
sign(stakedVote, sKeys[reg], Commit) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(Commit) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(Commit) |
|
|
|
if achieved { |
|
|
|
if achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, QuorumAchieved: %s, Expected: false (All Staker nodes = 32%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, QuorumAchieved: %s, Expected: false (All Staker nodes = 32%%)", |
|
|
|
Commit, strconv.FormatBool(achieved)) |
|
|
|
Commit, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// ViewChange
|
|
|
|
// ViewChange
|
|
|
|
sign(stakedVote, sKeys[reg], ViewChange) |
|
|
|
sign(stakedVote, sKeys[reg], ViewChange) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(ViewChange) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(ViewChange) |
|
|
|
if achieved { |
|
|
|
if achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, Got: %s, Expected: false (All Staker nodes = 32%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, Got: %s, Expected: false (All Staker nodes = 32%%)", |
|
|
|
ViewChange, strconv.FormatBool(achieved)) |
|
|
|
ViewChange, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// RewardThreshold
|
|
|
|
// RewardThreshold
|
|
|
@ -176,21 +176,21 @@ func TestEvenNodes(t *testing.T) { |
|
|
|
sign(stakedVote, sKeys[hmy], Prepare) |
|
|
|
sign(stakedVote, sKeys[hmy], Prepare) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(Prepare) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(Prepare) |
|
|
|
if !achieved { |
|
|
|
if !achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, QuorumAchieved: %s, Expected: true (All nodes = 100%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, QuorumAchieved: %s, Expected: true (All nodes = 100%%)", |
|
|
|
Prepare, strconv.FormatBool(achieved)) |
|
|
|
Prepare, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// Commit
|
|
|
|
// Commit
|
|
|
|
sign(stakedVote, sKeys[hmy], Commit) |
|
|
|
sign(stakedVote, sKeys[hmy], Commit) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(Commit) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(Commit) |
|
|
|
if !achieved { |
|
|
|
if !achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, QuorumAchieved: %s, Expected: true (All nodes = 100%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, QuorumAchieved: %s, Expected: true (All nodes = 100%%)", |
|
|
|
Commit, strconv.FormatBool(achieved)) |
|
|
|
Commit, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// ViewChange
|
|
|
|
// ViewChange
|
|
|
|
sign(stakedVote, sKeys[hmy], ViewChange) |
|
|
|
sign(stakedVote, sKeys[hmy], ViewChange) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(ViewChange) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(ViewChange) |
|
|
|
if !achieved { |
|
|
|
if !achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, Got: %s, Expected: true (All nodes = 100%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, Got: %s, Expected: true (All nodes = 100%%)", |
|
|
|
ViewChange, strconv.FormatBool(achieved)) |
|
|
|
ViewChange, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// RewardThreshold
|
|
|
|
// RewardThreshold
|
|
|
@ -215,21 +215,21 @@ func Test33HarmonyNodes(t *testing.T) { |
|
|
|
sign(stakedVote, sKeys, Prepare) |
|
|
|
sign(stakedVote, sKeys, Prepare) |
|
|
|
achieved := stakedVote.IsQuorumAchieved(Prepare) |
|
|
|
achieved := stakedVote.IsQuorumAchieved(Prepare) |
|
|
|
if !achieved { |
|
|
|
if !achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, QuorumAchieved: %s, Expected: true (All Harmony nodes = 68%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, QuorumAchieved: %s, Expected: true (All Harmony nodes = 68%%)", |
|
|
|
Prepare, strconv.FormatBool(achieved)) |
|
|
|
Prepare, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// Commit
|
|
|
|
// Commit
|
|
|
|
sign(stakedVote, sKeys, Commit) |
|
|
|
sign(stakedVote, sKeys, Commit) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(Commit) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(Commit) |
|
|
|
if !achieved { |
|
|
|
if !achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, QuorumAchieved: %s, Expected: true (All Harmony nodes = 68%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, QuorumAchieved: %s, Expected: true (All Harmony nodes = 68%%)", |
|
|
|
Commit, strconv.FormatBool(achieved)) |
|
|
|
Commit, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// ViewChange
|
|
|
|
// ViewChange
|
|
|
|
sign(stakedVote, sKeys, ViewChange) |
|
|
|
sign(stakedVote, sKeys, ViewChange) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(ViewChange) |
|
|
|
achieved = stakedVote.IsQuorumAchieved(ViewChange) |
|
|
|
if !achieved { |
|
|
|
if !achieved { |
|
|
|
t.Errorf("[IsQuorumAchieved] MessageType: %s, Got: %s, Expected: true (All Harmony nodes = 68%%)", |
|
|
|
t.Errorf("[IsQuorumAchieved] Phase: %s, Got: %s, Expected: true (All Harmony nodes = 68%%)", |
|
|
|
ViewChange, strconv.FormatBool(achieved)) |
|
|
|
ViewChange, strconv.FormatBool(achieved)) |
|
|
|
} |
|
|
|
} |
|
|
|
// RewardThreshold
|
|
|
|
// RewardThreshold
|
|
|
|