-
Notifications
You must be signed in to change notification settings - Fork 21
/
valid_no_duty_runnnig.go
104 lines (97 loc) · 4.57 KB
/
valid_no_duty_runnnig.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
package pre_consensus_justifications
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"
)
// ValidNoRunningDuty tests a valid pre-consensus justification for a runner that has no running duty
func ValidNoRunningDuty() tests.SpecTest {
ks := testingutils.Testing4SharesSet()
msgF := func(obj *types.ConsensusData, id []byte) *qbft.SignedMessage {
fullData, _ := obj.Encode()
root, _ := qbft.HashDataRoot(fullData)
msg := &qbft.Message{
MsgType: qbft.ProposalMsgType,
Height: 1,
Round: qbft.FirstRound,
Identifier: id,
Root: root,
}
signed := testingutils.SignQBFTMsg(ks.Shares[1], 1, msg)
signed.FullData = fullData
return signed
}
return &tests.MultiMsgProcessingSpecTest{
Name: "pre consensus justification valid no running duty",
Tests: []*tests.MsgProcessingSpecTest{
{
Name: "sync committee aggregator selection proof",
Runner: decideFirstHeight(testingutils.SyncCommitteeContributionRunner(ks)),
Duty: &testingutils.TestingSyncCommitteeContributionDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommitteeContribution(msgF(testingutils.TestContributionProofWithJustificationsConsensusData(ks), testingutils.SyncCommitteeContributionMsgID), nil)),
},
PostDutyRunnerStateRoot: "118bb07beaee54ffa3f4a676f752cdf391692b5981066b4827a8c29d100756ed",
OutputMessages: []*types.SignedPartialSignatureMessage{},
DontStartDuty: true,
},
{
Name: "aggregator selection proof",
Runner: decideFirstHeight(testingutils.AggregatorRunner(ks)),
Duty: &testingutils.TestingAggregatorDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAggregator(msgF(testingutils.TestSelectionProofWithJustificationsConsensusData(ks), testingutils.AggregatorMsgID), nil)),
},
PostDutyRunnerStateRoot: "8739b666e50accff30ff3f3b6fe6f75eba4d0eec340efd008dc9f66239155292",
OutputMessages: []*types.SignedPartialSignatureMessage{},
DontStartDuty: true,
},
{
Name: "randao",
Runner: decideFirstHeight(testingutils.ProposerRunner(ks)),
Duty: testingutils.TestingProposerDutyV(spec.DataVersionDeneb),
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(msgF(testingutils.TestProposerWithJustificationsConsensusDataV(ks, spec.DataVersionDeneb), testingutils.ProposerMsgID), nil)),
},
PostDutyRunnerStateRoot: "a7762b4ffea3d8fc26474348d8222a8ab13c985bbe5a1140b115ce1788acf7e3",
OutputMessages: []*types.SignedPartialSignatureMessage{},
DontStartDuty: true,
},
{
Name: "randao (blinded block)",
Runner: decideFirstHeight(testingutils.ProposerBlindedBlockRunner(ks)),
Duty: testingutils.TestingProposerDutyV(spec.DataVersionDeneb),
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgProposer(msgF(testingutils.TestProposerBlindedWithJustificationsConsensusDataV(ks, spec.DataVersionDeneb), testingutils.ProposerMsgID), nil)),
},
PostDutyRunnerStateRoot: "1d3ddfd3bce80e7795ed4bfe3a23b943f395dcdb0f6d0844f25a149e6d1bea28",
OutputMessages: []*types.SignedPartialSignatureMessage{},
DontStartDuty: true,
},
{
Name: "attester",
Runner: decideFirstHeight(testingutils.AttesterRunner(ks)),
Duty: &testingutils.TestingAttesterDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgAttester(msgF(testingutils.TestAttesterConsensusData, testingutils.AttesterMsgID), nil)),
},
PostDutyRunnerStateRoot: "97ba097765d1b3e9e1b0dde97723d5ec3100e12ed197d567cdba32315409d20b",
OutputMessages: []*types.SignedPartialSignatureMessage{},
DontStartDuty: true,
},
{
Name: "sync committee",
Runner: decideFirstHeight(testingutils.SyncCommitteeRunner(ks)),
Duty: &testingutils.TestingSyncCommitteeDuty,
Messages: []*types.SignedSSVMessage{
testingutils.SignedSSVMessageF(ks, testingutils.SSVMsgSyncCommittee(msgF(testingutils.TestSyncCommitteeConsensusData, testingutils.SyncCommitteeMsgID), nil)),
},
PostDutyRunnerStateRoot: "631bde3df3e21a17dac94c01623d58cc02b1c99f52120e85f0592c3d2626dddd",
OutputMessages: []*types.SignedPartialSignatureMessage{},
DontStartDuty: true,
},
},
}
}