-
Notifications
You must be signed in to change notification settings - Fork 21
/
valid_justification.go
42 lines (38 loc) · 1.68 KB
/
valid_justification.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
package roundchange
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"
)
// ValidJustification tests a valid rc quorum justification
func ValidJustification() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
pre := testingutils.BaseInstance()
pre.State.ProposalAcceptedForCurrentRound = nil // proposal resets on upon timeout
pre.State.Round = 2
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)),
}
msgs := []*qbft.SignedMessage{
testingutils.TestingRoundChangeMessageWithRoundAndRC(ks.Shares[1], types.OperatorID(1), 2,
testingutils.MarshalJustifications(prepareMsgs)),
testingutils.TestingRoundChangeMessageWithRoundAndRC(ks.Shares[2], types.OperatorID(2), 2,
testingutils.MarshalJustifications(prepareMsgs)),
testingutils.TestingRoundChangeMessageWithRoundAndRC(ks.Shares[3], types.OperatorID(3), 2,
testingutils.MarshalJustifications(prepareMsgs)),
}
return &tests.MsgProcessingSpecTest{
Name: "valid justification",
Pre: pre,
PostRoot: "9eaca08ea6e2a36551355354d358d0f48b6609ce000b5559c4fa73e6f9ec8bc8",
InputMessages: msgs,
OutputMessages: []*qbft.SignedMessage{
testingutils.TestingProposalMessageWithParams(ks.Shares[1], types.OperatorID(1), 2, qbft.FirstHeight,
testingutils.TestingQBFTRootData,
testingutils.MarshalJustifications(msgs), testingutils.MarshalJustifications(prepareMsgs)),
},
}
}