-
Notifications
You must be signed in to change notification settings - Fork 21
/
invalid_beacon_sig_in_quorum.go
135 lines (132 loc) · 7.12 KB
/
invalid_beacon_sig_in_quorum.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
126
127
128
129
130
131
132
133
134
135
package postconsensus
import (
"github.com/attestantio/go-eth2-client/spec"
"github.com/bloxapp/ssv-spec/qbft"
"github.com/bloxapp/ssv-spec/ssv/spectest/tests"
"github.com/bloxapp/ssv-spec/types"
"github.com/bloxapp/ssv-spec/types/testingutils"
)
// InvalidBeaconSignatureInQuorum tests a quorum with an invalid PartialSignatureMessage signature
func InvalidBeaconSignatureInQuorum() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
expectedError := "got post-consensus quorum but it has invalid signatures: could not reconstruct beacon sig: failed to verify reconstruct signature: could not reconstruct a valid signature"
return &tests.MultiMsgProcessingSpecTest{
Name: "post consensus invalid beacon signature in quorum",
Tests: []*tests.MsgProcessingSpecTest{
{
Name: "sync committee contribution",
Runner: decideRunner(
testingutils.SyncCommitteeContributionRunner(ks),
&testingutils.TestingSyncCommitteeContributionDuty,
testingutils.TestSyncCommitteeContributionConsensusData,
),
Duty: &testingutils.TestingSyncCommitteeContributionDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommitteeContribution(nil, testingutils.PostConsensusWrongSigSyncCommitteeContributionMsg(ks.Shares[1], 1, ks))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommitteeContribution(nil, testingutils.PostConsensusSyncCommitteeContributionMsg(ks.Shares[2], 2, ks))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommitteeContribution(nil, testingutils.PostConsensusSyncCommitteeContributionMsg(ks.Shares[3], 3, ks))),
},
PostDutyRunnerStateRoot: "f58387d4d4051a2de786e4cbf9dc370a8b19a544f52af04f71195feb3863fc5c",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{},
DontStartDuty: true,
ExpectedError: expectedError,
},
{
Name: "sync committee",
Runner: decideRunner(
testingutils.SyncCommitteeRunner(ks),
&testingutils.TestingSyncCommitteeDuty,
testingutils.TestSyncCommitteeConsensusData,
),
Duty: &testingutils.TestingSyncCommitteeDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommittee(nil, testingutils.PostConsensusWrongSigSyncCommitteeMsg(ks.Shares[1], 1))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommittee(nil, testingutils.PostConsensusSyncCommitteeMsg(ks.Shares[2], 2))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommittee(nil, testingutils.PostConsensusSyncCommitteeMsg(ks.Shares[3], 3))),
},
PostDutyRunnerStateRoot: "599f535071e53121470fc10c80fad5d103340eba90dcd9672cff3e7a874de276",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{},
DontStartDuty: true,
ExpectedError: expectedError,
},
{
Name: "proposer",
Runner: decideRunner(
testingutils.ProposerRunner(ks),
testingutils.TestingProposerDutyV(spec.DataVersionDeneb),
testingutils.TestProposerConsensusDataV(spec.DataVersionDeneb),
),
Duty: testingutils.TestingProposerDutyV(spec.DataVersionDeneb),
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(nil, testingutils.PostConsensusWrongSigProposerMsgV(ks.Shares[1], 1, spec.DataVersionDeneb))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(nil, testingutils.PostConsensusProposerMsgV(ks.Shares[2], 2, spec.DataVersionDeneb))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(nil, testingutils.PostConsensusProposerMsgV(ks.Shares[3], 3, spec.DataVersionDeneb))),
},
PostDutyRunnerStateRoot: "ff213af6f0bf2350bb37f48021c137dd5552b1c25cb5c6ebd0c1d27debf6080e",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{},
DontStartDuty: true,
ExpectedError: expectedError,
},
{
Name: "proposer (blinded block)",
Runner: decideRunner(
testingutils.ProposerBlindedBlockRunner(ks),
testingutils.TestingProposerDutyV(spec.DataVersionDeneb),
testingutils.TestProposerBlindedBlockConsensusDataV(spec.DataVersionDeneb),
),
Duty: testingutils.TestingProposerDutyV(spec.DataVersionDeneb),
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(nil, testingutils.PostConsensusWrongSigProposerMsgV(ks.Shares[1], 1, spec.DataVersionDeneb))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(nil, testingutils.PostConsensusProposerMsgV(ks.Shares[2], 2, spec.DataVersionDeneb))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(nil, testingutils.PostConsensusProposerMsgV(ks.Shares[3], 3, spec.DataVersionDeneb))),
},
PostDutyRunnerStateRoot: "9b4524d5100835df4d71d0a1e559acdc33d541c44a746ebda115c5e7f3eaa85a",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{},
DontStartDuty: true,
ExpectedError: expectedError,
},
{
Name: "aggregator",
Runner: decideRunner(
testingutils.AggregatorRunner(ks),
&testingutils.TestingAggregatorDuty,
testingutils.TestAggregatorConsensusData,
),
Duty: &testingutils.TestingAggregatorDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAggregator(nil, testingutils.PostConsensusWrongSigAggregatorMsg(ks.Shares[1], 1))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAggregator(nil, testingutils.PostConsensusAggregatorMsg(ks.Shares[2], 2))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAggregator(nil, testingutils.PostConsensusAggregatorMsg(ks.Shares[3], 3))),
},
PostDutyRunnerStateRoot: "1fb182fb19e446d61873abebc0ac85a3a9637b51d139cdbd7d8cb70cf7ffec82",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{},
DontStartDuty: true,
ExpectedError: expectedError,
},
{
Name: "attester",
Runner: decideRunner(
testingutils.AttesterRunner(ks),
&testingutils.TestingAttesterDuty,
testingutils.TestAttesterConsensusData,
),
Duty: &testingutils.TestingAttesterDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAttester(nil, testingutils.PostConsensusWrongSigAttestationMsg(ks.Shares[1], 1, qbft.FirstHeight))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAttester(nil, testingutils.PostConsensusAttestationMsg(ks.Shares[2], 2, qbft.FirstHeight))),
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAttester(nil, testingutils.PostConsensusAttestationMsg(ks.Shares[3], 3, qbft.FirstHeight))),
},
PostDutyRunnerStateRoot: "f43a47e0cb007d990f6972ce764ec8d0a35ae9c14a46f41bd7cde3df7d0e5f88",
OutputMessages: []*types.SignedPartialSignatureMessage{},
BeaconBroadcastedRoots: []string{},
DontStartDuty: true,
ExpectedError: expectedError,
},
},
}
}