Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec - Validator registration and voluntary exit now stop old duties #318

Merged
merged 17 commits into from
Nov 7, 2023
Merged
18 changes: 18 additions & 0 deletions ssv/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ func (b *BaseRunner) baseStartNewDuty(runner Runner, duty *types.Duty) error {
return runner.executeDuty(duty)
}

// baseStartNewBeaconDuty is a base func that all runner implementation can call to start a non-beacon duty
func (b *BaseRunner) baseStartNewNonBeaconDuty(runner Runner, duty *types.Duty) error {
if err := b.ShouldProcessNonBeaconDuty(duty); err != nil {
return errors.Wrap(err, "can't start non-beacon duty")
}
b.baseSetupForNewDuty(duty)
return runner.executeDuty(duty)
}

// basePreConsensusMsgProcessing is a base func that all runner implementation can call for processing a pre-consensus msg
func (b *BaseRunner) basePreConsensusMsgProcessing(runner Runner, signedMsg *types.SignedPartialSignatureMessage) (bool, [][32]byte, error) {
if err := b.ValidatePreConsensusMsg(runner, signedMsg); err != nil {
Expand Down Expand Up @@ -240,3 +249,12 @@ func (b *BaseRunner) ShouldProcessDuty(duty *types.Duty) error {
}
return nil
}

func (b *BaseRunner) ShouldProcessNonBeaconDuty(duty *types.Duty) error {
// assume StartingDuty is not nil if state is not nil
if b.State != nil && b.State.StartingDuty.Slot >= duty.Slot {
return errors.Errorf("duty for slot %d already passed. Current slot is %d", duty.Slot,
b.State.StartingDuty.Slot)
}
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"ValidatorCommitteeIndex": 0,
"ValidatorSyncCommitteeIndices": null
},
"Finished": false
"Finished": true
},
"Share": {
"OperatorID": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"ValidatorCommitteeIndex": 0,
"ValidatorSyncCommitteeIndices": null
},
"Finished": false
"Finished": true
},
"Share": {
"OperatorID": 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"BaseRunner": {
"State": {
"PreConsensusContainer": {
"Signatures": {},
"Quorum": 3
},
"PostConsensusContainer": {
"Signatures": {},
"Quorum": 3
},
"RunningInstance": null,
"DecidedValue": null,
"StartingDuty": {
"Type": 5,
"PubKey": [
142,
128,
6,
101,
81,
168,
27,
49,
130,
88,
112,
158,
218,
247,
221,
31,
99,
205,
104,
106,
14,
77,
184,
178,
155,
187,
122,
207,
230,
86,
8,
103,
122,
245,
165,
39,
217,
68,
142,
228,
120,
53,
72,
94,
2,
181,
11,
192
],
"Slot": 50,
"ValidatorIndex": 1,
"CommitteeIndex": 0,
"CommitteeLength": 0,
"CommitteesAtSlot": 0,
"ValidatorCommitteeIndex": 0,
"ValidatorSyncCommitteeIndices": null
},
"Finished": false
},
"Share": {
"OperatorID": 1,
"ValidatorPubKey": "joAGZVGoGzGCWHCe2vfdH2PNaGoOTbiym7t6z+ZWCGd69aUn2USO5Hg1SF4CtQvA",
"SharePubKey": "l9lKgR1kSTYFKp0tSs1kcYl0z2eNvv0mcyTI6fjnA0pKa32HeeJ6AZU4w8Qlw+Xn",
"Committee": [
{
"OperatorID": 1,
"PubKey": "l9lKgR1kSTYFKp0tSs1kcYl0z2eNvv0mcyTI6fjnA0pKa32HeeJ6AZU4w8Qlw+Xn"
},
{
"OperatorID": 2,
"PubKey": "przr4wl9dBcbQMcSoDHOsDcds9PEAs8s5pG5Eg87q3XU1W36DzdZFUSZm/GMU1Pt"
},
{
"OperatorID": 3,
"PubKey": "gJDgt2ZqRezF1O90GKyZ8J5sskQCn+pqCn/Mvp7gi8U53g36Zr5rq8hJPdmd0amN"
},
{
"OperatorID": 4,
"PubKey": "p8CidrcKXuM5XH1tJlXtYFKKolLU0h7KX8xSI+UMxCvRaLKAq3q1MXNU3d/PPfnk"
}
],
"Quorum": 3,
"PartialQuorum": 2,
"DomainType": [
0,
0,
3,
1
],
"FeeRecipientAddress": [
83,
89,
83,
181,
166,
4,
0,
116,
148,
140,
241,
133,
234,
167,
210,
171,
189,
102,
128,
143
],
"Graffiti": null
},
"QBFTController": null,
"BeaconNetwork": "prater",
"BeaconRoleType": 5
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"BaseRunner": {
"State": {
"PreConsensusContainer": {
"Signatures": {},
"Quorum": 3
},
"PostConsensusContainer": {
"Signatures": {},
"Quorum": 3
},
"RunningInstance": null,
"DecidedValue": null,
"StartingDuty": {
"Type": 6,
"PubKey": [
142,
128,
6,
101,
81,
168,
27,
49,
130,
88,
112,
158,
218,
247,
221,
31,
99,
205,
104,
106,
14,
77,
184,
178,
155,
187,
122,
207,
230,
86,
8,
103,
122,
245,
165,
39,
217,
68,
142,
228,
120,
53,
72,
94,
2,
181,
11,
192
],
"Slot": 50,
"ValidatorIndex": 1,
"CommitteeIndex": 0,
"CommitteeLength": 0,
"CommitteesAtSlot": 0,
"ValidatorCommitteeIndex": 0,
"ValidatorSyncCommitteeIndices": null
},
"Finished": false
},
"Share": {
"OperatorID": 1,
"ValidatorPubKey": "joAGZVGoGzGCWHCe2vfdH2PNaGoOTbiym7t6z+ZWCGd69aUn2USO5Hg1SF4CtQvA",
"SharePubKey": "l9lKgR1kSTYFKp0tSs1kcYl0z2eNvv0mcyTI6fjnA0pKa32HeeJ6AZU4w8Qlw+Xn",
"Committee": [
{
"OperatorID": 1,
"PubKey": "l9lKgR1kSTYFKp0tSs1kcYl0z2eNvv0mcyTI6fjnA0pKa32HeeJ6AZU4w8Qlw+Xn"
},
{
"OperatorID": 2,
"PubKey": "przr4wl9dBcbQMcSoDHOsDcds9PEAs8s5pG5Eg87q3XU1W36DzdZFUSZm/GMU1Pt"
},
{
"OperatorID": 3,
"PubKey": "gJDgt2ZqRezF1O90GKyZ8J5sskQCn+pqCn/Mvp7gi8U53g36Zr5rq8hJPdmd0amN"
},
{
"OperatorID": 4,
"PubKey": "p8CidrcKXuM5XH1tJlXtYFKKolLU0h7KX8xSI+UMxCvRaLKAq3q1MXNU3d/PPfnk"
}
],
"Quorum": 3,
"PartialQuorum": 2,
"DomainType": [
0,
0,
3,
1
],
"FeeRecipientAddress": [
83,
89,
83,
181,
166,
4,
0,
116,
148,
140,
241,
133,
234,
167,
210,
171,
189,
102,
128,
143
],
"Graffiti": null
},
"QBFTController": null,
"BeaconNetwork": "prater",
"BeaconRoleType": 6
}
}
Loading