-
Notifications
You must be signed in to change notification settings - Fork 21
/
current_instance_past_round.go
55 lines (47 loc) · 1.95 KB
/
current_instance_past_round.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
package decided
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/herumi/bls-eth-go-binary/bls"
)
// CurrentInstancePastRound tests a decided msg received for current running instance for a past round
func CurrentInstancePastRound() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
rcMsgs := []*qbft.SignedMessage{
testingutils.TestingRoundChangeMessageWithRound(ks.Shares[1], 1, 2),
testingutils.TestingRoundChangeMessageWithRound(ks.Shares[2], 2, 2),
testingutils.TestingRoundChangeMessageWithRound(ks.Shares[3], 3, 2),
}
msgs := []*qbft.SignedMessage{
testingutils.TestingProposalMessage(ks.Shares[1], 1),
testingutils.TestingPrepareMessage(ks.Shares[1], 1),
testingutils.TestingPrepareMessage(ks.Shares[2], 2),
}
msgs = append(msgs, rcMsgs...)
msgs = append(msgs, []*qbft.SignedMessage{
testingutils.TestingProposalMessageWithRoundAndRC(ks.Shares[1], 1, 2,
testingutils.MarshalJustifications(rcMsgs)),
testingutils.TestingPrepareMessageWithRound(ks.Shares[1], 1, 2),
testingutils.TestingPrepareMessageWithRound(ks.Shares[2], 2, 2),
testingutils.TestingPrepareMessageWithRound(ks.Shares[3], 3, 2),
testingutils.TestingCommitMessageWithRound(ks.Shares[1], 1, 2),
testingutils.TestingCommitMessageWithRound(ks.Shares[2], 2, 2),
testingutils.TestingCommitMultiSignerMessage([]*bls.SecretKey{ks.Shares[1], ks.Shares[2], ks.Shares[3]}, []types.OperatorID{1, 2, 3}),
}...)
return &tests.ControllerSpecTest{
Name: "decide current instance past round",
RunInstanceData: []*tests.RunInstanceData{
{
InputValue: []byte{1, 2, 3, 4},
InputMessages: msgs,
ExpectedDecidedState: tests.DecidedState{
DecidedCnt: 1,
DecidedVal: testingutils.TestingQBFTFullData,
},
ControllerPostRoot: "a96bbf6034a156f6a7196c255e60b5f6a592ab30130cab0d3b4ac2cbc1dd9ac4",
},
},
}
}