Skip to content

Commit

Permalink
Spec - check att and sync duties exist before submitting (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
y0sher authored Jul 22, 2024
1 parent 9f64a7b commit 6921f58
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions ssv/committee_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,29 +257,34 @@ func (cr CommitteeRunner) ProcessPostConsensus(signedMsg *types.PartialSignature
}

// Submit multiple attestations
attestations := make([]*phase0.Attestation, 0)
attestations := make([]*phase0.Attestation, 0, len(attestationsToSubmit))
for _, att := range attestationsToSubmit {
attestations = append(attestations, att)
}
if err := cr.beacon.SubmitAttestations(attestations); err != nil {
return errors.Wrap(err, "could not submit to Beacon chain reconstructed attestation")
}
// Record successful submissions
for validator := range attestationsToSubmit {
cr.RecordSubmission(types.BNRoleAttester, validator)

if len(attestations) > 0 {
if err := cr.beacon.SubmitAttestations(attestations); err != nil {
return errors.Wrap(err, "could not submit to Beacon chain reconstructed attestation")
}
// Record successful submissions
for validator := range attestationsToSubmit {
cr.RecordSubmission(types.BNRoleAttester, validator)
}
}

// Submit multiple sync committee
syncCommitteeMessages := make([]*altair.SyncCommitteeMessage, 0)
syncCommitteeMessages := make([]*altair.SyncCommitteeMessage, 0, len(syncCommitteeMessagesToSubmit))
for _, syncMsg := range syncCommitteeMessagesToSubmit {
syncCommitteeMessages = append(syncCommitteeMessages, syncMsg)
}
if err := cr.beacon.SubmitSyncMessages(syncCommitteeMessages); err != nil {
return errors.Wrap(err, "could not submit to Beacon chain reconstructed signed sync committee")
}
// Record successful submissions
for validator := range syncCommitteeMessagesToSubmit {
cr.RecordSubmission(types.BNRoleSyncCommittee, validator)
if len(syncCommitteeMessages) > 0 {
if err := cr.beacon.SubmitSyncMessages(syncCommitteeMessages); err != nil {
return errors.Wrap(err, "could not submit to Beacon chain reconstructed signed sync committee")
}
// Record successful submissions
for validator := range syncCommitteeMessagesToSubmit {
cr.RecordSubmission(types.BNRoleSyncCommittee, validator)
}
}

if anyErr != nil {
Expand Down

0 comments on commit 6921f58

Please sign in to comment.