forked from ssvlabs/ssv-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
late_decided.go
50 lines (48 loc) · 1.81 KB
/
late_decided.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
package decided
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"
"github.com/herumi/bls-eth-go-binary/bls"
)
// LateDecided tests processing a decided msg for a just decided instance
func LateDecided() *tests.ControllerSpecTest {
identifier := types.NewMsgID(testingutils.TestingValidatorPubKey[:], types.BNRoleAttester)
ks := testingutils.Testing4SharesSet()
msgs := testingutils.DecidingMsgsForHeight([]byte{1, 2, 3, 4}, identifier[:], qbft.FirstHeight, testingutils.Testing4SharesSet())
msgs = append(msgs, testingutils.MultiSignQBFTMsg(
[]*bls.SecretKey{ks.Shares[1], ks.Shares[2], ks.Shares[4]},
[]types.OperatorID{1, 2, 4},
&qbft.Message{
MsgType: qbft.CommitMsgType,
Height: qbft.FirstHeight,
Round: qbft.FirstRound,
Identifier: identifier[:],
Data: testingutils.CommitDataBytes([]byte{1, 2, 3, 4}),
}))
return &tests.ControllerSpecTest{
Name: "decide late decided",
RunInstanceData: []*tests.RunInstanceData{
{
InputValue: []byte{1, 2, 3, 4},
InputMessages: msgs,
ExpectedDecidedState: tests.DecidedState{
DecidedCnt: 1,
DecidedVal: []byte{1, 2, 3, 4},
BroadcastedDecided: testingutils.MultiSignQBFTMsg(
[]*bls.SecretKey{ks.Shares[1], ks.Shares[2], ks.Shares[3]},
[]types.OperatorID{1, 2, 3},
&qbft.Message{
MsgType: qbft.CommitMsgType,
Height: qbft.FirstHeight,
Round: qbft.FirstRound,
Identifier: identifier[:],
Data: testingutils.CommitDataBytes([]byte{1, 2, 3, 4}),
}),
},
ControllerPostRoot: "f82a7925fa41a67b245d6f97b13c1d272632ac4efe0380847ac8c9378f5bb04b",
},
},
}
}