forked from ssvlabs/ssv-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
f1_different_future_rounds.go
74 lines (69 loc) · 2.73 KB
/
f1_different_future_rounds.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package roundchange
import (
"github.com/MatheusFranco99/ssv-spec-AleaBFT/qbft"
"github.com/MatheusFranco99/ssv-spec-AleaBFT/qbft/spectest/tests"
"github.com/MatheusFranco99/ssv-spec-AleaBFT/types"
"github.com/MatheusFranco99/ssv-spec-AleaBFT/types/testingutils"
)
// F1DifferentFutureRounds tests f+1 speedup with one rc prev prepared
func F1DifferentFutureRounds() *tests.MsgProcessingSpecTest {
pre := testingutils.BaseInstance()
prepareMsgs := []*qbft.SignedMessage{
testingutils.SignQBFTMsg(testingutils.Testing4SharesSet().Shares[1], types.OperatorID(1), &qbft.Message{
MsgType: qbft.PrepareMsgType,
Height: qbft.FirstHeight,
Round: qbft.FirstRound,
Identifier: []byte{1, 2, 3, 4},
Data: testingutils.PrepareDataBytes([]byte{1, 2, 3, 4}),
}),
testingutils.SignQBFTMsg(testingutils.Testing4SharesSet().Shares[2], types.OperatorID(2), &qbft.Message{
MsgType: qbft.PrepareMsgType,
Height: qbft.FirstHeight,
Round: qbft.FirstRound,
Identifier: []byte{1, 2, 3, 4},
Data: testingutils.PrepareDataBytes([]byte{1, 2, 3, 4}),
}),
testingutils.SignQBFTMsg(testingutils.Testing4SharesSet().Shares[3], types.OperatorID(3), &qbft.Message{
MsgType: qbft.PrepareMsgType,
Height: qbft.FirstHeight,
Round: qbft.FirstRound,
Identifier: []byte{1, 2, 3, 4},
Data: testingutils.PrepareDataBytes([]byte{1, 2, 3, 4}),
}),
}
msgs := []*qbft.SignedMessage{
testingutils.SignQBFTMsg(testingutils.Testing4SharesSet().Shares[1], types.OperatorID(1), &qbft.Message{
MsgType: qbft.RoundChangeMsgType,
Height: qbft.FirstHeight,
Round: 5,
Identifier: []byte{1, 2, 3, 4},
Data: testingutils.RoundChangeDataBytes(nil, qbft.NoRound),
}),
testingutils.SignQBFTMsg(testingutils.Testing4SharesSet().Shares[2], types.OperatorID(2), &qbft.Message{
MsgType: qbft.RoundChangeMsgType,
Height: qbft.FirstHeight,
Round: 10,
Identifier: []byte{1, 2, 3, 4},
Data: testingutils.RoundChangePreparedDataBytes([]byte{1, 2, 3, 4}, qbft.FirstRound, prepareMsgs),
}),
}
return &tests.MsgProcessingSpecTest{
Name: "round change f+1 prepared",
Pre: pre,
PostRoot: "342d0646bc8da4112539b97c68f21ef98bb784a2f97923bc1a81ff92656b8e92",
InputMessages: msgs,
OutputMessages: []*qbft.SignedMessage{
testingutils.SignQBFTMsg(testingutils.Testing4SharesSet().Shares[1], types.OperatorID(1), &qbft.Message{
MsgType: qbft.RoundChangeMsgType,
Height: qbft.FirstHeight,
Round: 5,
Identifier: []byte{1, 2, 3, 4},
Data: testingutils.RoundChangeDataBytes(nil, qbft.NoRound),
}),
},
ExpectedTimerState: &testingutils.TimerState{
Timeouts: 1,
Round: qbft.Round(5),
},
}
}