Skip to content

Commit

Permalink
fix(validator): improve error handling in attestation service (#5511)
Browse files Browse the repository at this point in the history
* Improve error handling in attestation service

* Use try-catch pattern
  • Loading branch information
nflaig authored May 23, 2023
1 parent 4fd72b2 commit 186a5e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/validator/src/services/attestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,18 @@ export class AttestationService {
await Promise.all(
Array.from(dutiesByCommitteeIndex.entries()).map(([index, duties]) =>
this.runAttestationTasksPerCommittee(duties, slot, index, signal).catch((e) => {
this.logger.error("Error on attestation routine", {slot, index}, e);
this.logger.error("Error on committee attestation routine", {slot, index}, e);
})
)
);
} else {
// Beacon node's endpoint produceAttestationData return data is not dependant on committeeIndex.
// Produce a single attestation for all committees and submit unaggregated attestations in one go.
await this.runAttestationTasksGrouped(duties, slot, signal);
try {
await this.runAttestationTasksGrouped(duties, slot, signal);
} catch (e) {
this.logger.error("Error on attestation routine", {slot}, e as Error);
}
}
};

Expand Down

0 comments on commit 186a5e8

Please sign in to comment.