-
Notifications
You must be signed in to change notification settings - Fork 21
/
invalid_msg_slot.go
125 lines (120 loc) · 6.48 KB
/
invalid_msg_slot.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package preconsensus
import (
"github.com/attestantio/go-eth2-client/spec"
"github.com/bloxapp/ssv-spec/ssv/spectest/tests"
"github.com/bloxapp/ssv-spec/types"
"github.com/bloxapp/ssv-spec/types/testingutils"
)
// InvalidMessageSlot tests a valid SignedPartialSignatureMessage an invalid msg slot
func InvalidMessageSlot() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
invalidateSlot := func(msg *types.SignedPartialSignatureMessage) *types.SignedPartialSignatureMessage {
msg.Message.Slot = testingutils.TestingDutySlot2
return msg
}
return &tests.MultiMsgProcessingSpecTest{
Name: "pre consensus invalid msg slot",
Tests: []*tests.MsgProcessingSpecTest{
{
Name: "sync committee aggregator selection proof",
Runner: testingutils.SyncCommitteeContributionRunner(ks),
Duty: &testingutils.TestingSyncCommitteeContributionDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommitteeContribution(nil, invalidateSlot(testingutils.PreConsensusContributionProofMsg(ks.Shares[1], ks.Shares[1], 1, 1)))),
},
PostDutyRunnerStateRoot: "29862cc6054edc8547efcb5ae753290971d664b9c39768503b4d66e1b52ecb06",
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusContributionProofMsg(ks.Shares[1], ks.Shares[1], 1, 1), // broadcasts when starting a new duty
},
ExpectedError: "failed processing sync committee selection proof message: invalid pre-consensus message: invalid partial sig slot",
},
{
Name: "aggregator selection proof",
Runner: testingutils.AggregatorRunner(ks),
Duty: &testingutils.TestingAggregatorDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAggregator(nil, invalidateSlot(testingutils.PreConsensusSelectionProofMsg(ks.Shares[1], ks.Shares[1], 1, 1)))),
},
PostDutyRunnerStateRoot: "c54e71de23c3957b73abbb0e7b9e195b3f8f6370d62fbec256224faecf177fee",
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusSelectionProofMsg(ks.Shares[1], ks.Shares[1], 1, 1), // broadcasts when starting a new duty
},
ExpectedError: "failed processing selection proof message: invalid pre-consensus message: invalid partial sig slot",
},
{
Name: "randao",
Runner: testingutils.ProposerRunner(ks),
Duty: testingutils.TestingProposerDutyV(spec.DataVersionDeneb),
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(nil, invalidateSlot(testingutils.PreConsensusRandaoDifferentSignerMsgV(ks.Shares[1], ks.Shares[1], 1, 1, spec.DataVersionDeneb)))),
},
PostDutyRunnerStateRoot: "56eafcb33392ded888a0fefe30ba49e52aa00ab36841cb10c9dc1aa2935af347",
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusRandaoMsgV(ks.Shares[1], 1, spec.DataVersionDeneb), // broadcasts when starting a new duty
},
ExpectedError: "failed processing randao message: invalid pre-consensus message: invalid partial sig slot",
},
{
Name: "randao (blinded block)",
Runner: testingutils.ProposerBlindedBlockRunner(ks),
Duty: testingutils.TestingProposerDutyV(spec.DataVersionDeneb),
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(nil, invalidateSlot(testingutils.PreConsensusRandaoDifferentSignerMsgV(ks.Shares[1], ks.Shares[1], 1, 1, spec.DataVersionDeneb)))),
},
PostDutyRunnerStateRoot: "2ce3241658f324f352c77909f4043934eedf38e939ae638c5ce6acf28e965646",
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusRandaoMsgV(ks.Shares[1], 1, spec.DataVersionDeneb), // broadcasts when starting a new duty
},
ExpectedError: "failed processing randao message: invalid pre-consensus message: invalid partial sig slot",
},
{
Name: "attester",
Runner: testingutils.AttesterRunner(ks),
Duty: &testingutils.TestingAttesterDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAttester(nil, invalidateSlot(testingutils.PreConsensusFailedMsg(ks.Shares[1], 1)))),
},
PostDutyRunnerStateRoot: "a52249c78fe1b1b0ee793328c1fe2a53e70c7684fdf51b64da235163a4682fdd",
OutputMessages: []*types.SignedPartialSignatureMessage{},
ExpectedError: "no pre consensus sigs required for attester role",
},
{
Name: "sync committee",
Runner: testingutils.SyncCommitteeRunner(ks),
Duty: &testingutils.TestingSyncCommitteeDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommittee(nil, invalidateSlot(testingutils.PreConsensusFailedMsg(ks.Shares[1], 1)))),
},
PostDutyRunnerStateRoot: "f1587ce0947c4cb592d8a6b95453aede2a0da6a1f4e185f45cd6e5e304da0f82",
OutputMessages: []*types.SignedPartialSignatureMessage{},
ExpectedError: "no pre consensus sigs required for sync committee role",
},
{
Name: "validator registration",
Runner: testingutils.ValidatorRegistrationRunner(ks),
Duty: &testingutils.TestingValidatorRegistrationDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgValidatorRegistration(nil, invalidateSlot(testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[1], 1)))),
},
PostDutyRunnerStateRoot: "2ac409163b617c79a2a11d3919d6834d24c5c32f06113237a12afcf43e7757a0",
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusValidatorRegistrationMsg(ks.Shares[1], 1), // broadcasts when starting a new duty
},
ExpectedError: "failed processing validator registration message: invalid pre-consensus message: invalid partial sig slot",
},
{
Name: "voluntary exit",
Runner: testingutils.VoluntaryExitRunner(ks),
Duty: &testingutils.TestingVoluntaryExitDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgVoluntaryExit(nil, invalidateSlot(testingutils.PreConsensusVoluntaryExitMsg(ks.Shares[1], 1)))),
},
PostDutyRunnerStateRoot: "2ac409163b617c79a2a11d3919d6834d24c5c32f06113237a12afcf43e7757a0",
OutputMessages: []*types.SignedPartialSignatureMessage{
testingutils.PreConsensusVoluntaryExitMsg(ks.Shares[1], 1), // broadcasts when starting a new duty
},
ExpectedError: "failed processing voluntary exit message: invalid pre-consensus message: invalid partial sig slot",
},
},
}
}