forked from ssvlabs/ssv-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
valid_msg.go
100 lines (98 loc) · 4.5 KB
/
valid_msg.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package preconsensus
import (
"github.com/MatheusFranco99/ssv-spec-AleaBFT/ssv"
"github.com/MatheusFranco99/ssv-spec-AleaBFT/ssv/spectest/tests"
"github.com/MatheusFranco99/ssv-spec-AleaBFT/types"
"github.com/MatheusFranco99/ssv-spec-AleaBFT/types/testingutils"
)
// ValidMessage tests a valid SignedPartialSignatureMessage with multi PartialSignatureMessages
func ValidMessage() *tests.MultiMsgProcessingSpecTest {
ks := testingutils.Testing4SharesSet()
return &tests.MultiMsgProcessingSpecTest{
Name: "pre consensus valid msg",
Tests: []*tests.MsgProcessingSpecTest{
{
Name: "sync committee aggregator selection proof",
Runner: testingutils.SyncCommitteeContributionRunner(ks),
Duty: testingutils.TestingSyncCommitteeContributionDuty,
Messages: []*types.SSVMessage{
testingutils.SSVMsgSyncCommitteeContribution(nil, testingutils.PreConsensusContributionProofMsg(ks.Shares[1], ks.Shares[1], 1, 1)),
},
PostDutyRunnerStateRoot: "17a3875f3220e7a5341634eecf693b932b4887c5767bffe1b792fd79152c2cdb",
OutputMessages: []*ssv.SignedPartialSignatureMessage{
testingutils.PreConsensusContributionProofMsg(ks.Shares[1], ks.Shares[1], 1, 1), // broadcasts when starting a new duty
},
},
{
Name: "aggregator selection proof",
Runner: testingutils.AggregatorRunner(ks),
Duty: testingutils.TestingAggregatorDuty,
Messages: []*types.SSVMessage{
testingutils.SSVMsgAggregator(nil, testingutils.PreConsensusSelectionProofMsg(ks.Shares[1], ks.Shares[1], 1, 1)),
},
PostDutyRunnerStateRoot: "4c653908d40af3328f6a594571ed5f4dff93abed4be4bd48e68d32d9fa5618d0",
OutputMessages: []*ssv.SignedPartialSignatureMessage{
testingutils.PreConsensusSelectionProofMsg(ks.Shares[1], ks.Shares[1], 1, 1), // broadcasts when starting a new duty
},
},
{
Name: "randao",
Runner: testingutils.ProposerRunner(ks),
Duty: testingutils.TestingProposerDuty,
Messages: []*types.SSVMessage{
testingutils.SSVMsgProposer(nil, testingutils.PreConsensusRandaoDifferentSignerMsg(ks.Shares[1], ks.Shares[1], 1, 1)),
},
PostDutyRunnerStateRoot: "7efbd0a24888d0716831052f346fbff887eebf9556db8ea358bc2243b5d90403",
OutputMessages: []*ssv.SignedPartialSignatureMessage{
testingutils.PreConsensusRandaoMsg(ks.Shares[1], 1), // broadcasts when starting a new duty
},
},
{
Name: "randao (blinded block)",
Runner: testingutils.ProposerBlindedBlockRunner(ks),
Duty: testingutils.TestingProposerDuty,
Messages: []*types.SSVMessage{
testingutils.SSVMsgProposer(nil, testingutils.PreConsensusRandaoDifferentSignerMsg(ks.Shares[1], ks.Shares[1], 1, 1)),
},
PostDutyRunnerStateRoot: "d1b2e299e9f3decad78a8e57e9ec138b7282182f3b672b8ae338849c0d8be088",
OutputMessages: []*ssv.SignedPartialSignatureMessage{
testingutils.PreConsensusRandaoMsg(ks.Shares[1], 1), // broadcasts when starting a new duty
},
},
{
Name: "attester",
Runner: testingutils.AttesterRunner(ks),
Duty: testingutils.TestingAttesterDuty,
Messages: []*types.SSVMessage{
testingutils.SSVMsgAttester(nil, testingutils.PreConsensusFailedMsg(ks.Shares[1], 1)),
},
PostDutyRunnerStateRoot: "27a84d7d33b8851a5b0e241280ddb160049768179c74295cb9c35fb875fe44e7",
OutputMessages: []*ssv.SignedPartialSignatureMessage{},
ExpectedError: "no pre consensus sigs required for attester role",
},
{
Name: "sync committee",
Runner: testingutils.SyncCommitteeRunner(ks),
Duty: testingutils.TestingSyncCommitteeDuty,
Messages: []*types.SSVMessage{
testingutils.SSVMsgSyncCommittee(nil, testingutils.PreConsensusFailedMsg(ks.Shares[1], 1)),
},
PostDutyRunnerStateRoot: "2c4a3a6aa312f25fdb6eef98fc9036eb3db007c6a4a05f3e6137737189acce49",
OutputMessages: []*ssv.SignedPartialSignatureMessage{},
ExpectedError: "no pre consensus sigs required for sync committee role",
},
{
Name: "validator registration",
Runner: testingutils.ValidatorRegistrationRunner(ks),
Duty: testingutils.TestingValidatorRegistrationDuty,
Messages: []*types.SSVMessage{
testingutils.SSVMsgValidatorRegistration(nil, testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[1], 1)),
},
PostDutyRunnerStateRoot: "8537211ecec3ab151ca6d8e21294d64a8f828260cbc41bfa86e9e904dce801c2",
OutputMessages: []*ssv.SignedPartialSignatureMessage{
testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[1], 1), // broadcasts when starting a new duty
},
},
},
}
}