-
Notifications
You must be signed in to change notification settings - Fork 20
/
round_1.go
47 lines (41 loc) · 1.42 KB
/
round_1.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package timeout
import (
"github.com/bloxapp/ssv-spec/qbft"
"github.com/bloxapp/ssv-spec/qbft/spectest/tests"
"github.com/bloxapp/ssv-spec/types"
"github.com/bloxapp/ssv-spec/types/testingutils"
"github.com/bloxapp/ssv-spec/types/testingutils/comparable"
)
// Round1 tests calling UponRoundTimeout for round 1, testing state and broadcasted msgs
func Round1() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
sc := round1StateComparison()
pre := testingutils.BaseInstance()
pre.State.ProposalAcceptedForCurrentRound = testingutils.TestingProposalMessage(ks.Shares[1], types.OperatorID(1))
return &SpecTest{
Name: "round 1",
Pre: pre,
PostRoot: sc.Root(),
PostState: sc.ExpectedState,
OutputMessages: []*qbft.SignedMessage{
testingutils.SignQBFTMsg(ks.Shares[1], types.OperatorID(1), &qbft.Message{
MsgType: qbft.RoundChangeMsgType,
Height: qbft.FirstHeight,
Round: 2,
Identifier: testingutils.TestingIdentifier,
Root: [32]byte{},
RoundChangeJustification: [][]byte{},
PrepareJustification: [][]byte{},
}),
},
ExpectedTimerState: &testingutils.TimerState{
Timeouts: 1,
Round: 2,
},
}
}
func round1StateComparison() *comparable.StateComparison {
state := testingutils.BaseInstance().State
state.Round = 2
return &comparable.StateComparison{ExpectedState: state}
}