-
Notifications
You must be signed in to change notification settings - Fork 20
/
round_change_prepared.go
46 lines (39 loc) · 1.19 KB
/
round_change_prepared.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
package messages
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"
)
// RoundChangePrepared tests a round change prepared return value
func RoundChangePrepared() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
prepareMsgs := []*qbft.SignedMessage{
testingutils.TestingPrepareMessage(ks.Shares[1], types.OperatorID(1)),
testingutils.TestingPrepareMessage(ks.Shares[2], types.OperatorID(2)),
testingutils.TestingPrepareMessage(ks.Shares[3], types.OperatorID(3)),
}
prepareMarshalled := testingutils.MarshalJustifications(prepareMsgs)
msg := testingutils.TestingRoundChangeMessageWithParams(
ks.Shares[1], types.OperatorID(1), 2, qbft.FirstHeight, testingutils.TestingQBFTRootData, 1, prepareMarshalled)
msgRoot, err := msg.GetRoot()
if err != nil {
panic(err.Error())
}
encodedMsg, err := msg.Encode()
if err != nil {
panic(err.Error())
}
return &tests.MsgSpecTest{
Name: "round change prepared",
Messages: []*qbft.SignedMessage{
msg,
},
EncodedMessages: [][]byte{
encodedMsg,
},
ExpectedRoots: [][32]byte{
msgRoot,
},
}
}