Skip to content

Commit

Permalink
feat: include more details in validator attestation logs (#7064)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Sep 5, 2024
1 parent fe6c4ac commit b05c93e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/validator/src/services/attestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {toHexString} from "@chainsafe/ssz";
import {BLSSignature, phase0, Slot, ssz, Attestation, SignedAggregateAndProof} from "@lodestar/types";
import {ForkSeq} from "@lodestar/params";
import {computeEpochAtSlot, isAggregatorFromCommitteeLength} from "@lodestar/state-transition";
import {sleep} from "@lodestar/utils";
import {prettyBytes, sleep} from "@lodestar/utils";
import {ApiClient, routes} from "@lodestar/api";
import {ChainForkConfig} from "@lodestar/config";
import {IClock, LoggerVc} from "../util/index.js";
Expand Down Expand Up @@ -242,7 +242,11 @@ export class AttestationService {
} else {
(await this.api.beacon.submitPoolAttestations({signedAttestations})).assertOk();
}
this.logger.info("Published attestations", {...logCtx, count: signedAttestations.length});
this.logger.info("Published attestations", {
...logCtx,
head: prettyBytes(headRootHex),
count: signedAttestations.length,
});
this.metrics?.publishedAttestations.inc(signedAttestations.length);
} catch (e) {
// Note: metric counts only 1 since we don't know how many signedAttestations are invalid
Expand Down Expand Up @@ -286,7 +290,8 @@ export class AttestationService {
slot: attestation.slot,
});
const aggregate = res.value();
this.metrics?.numParticipantsInAggregate.observe(aggregate.aggregationBits.getTrueBitIndexes().length);
const participants = aggregate.aggregationBits.getTrueBitIndexes().length;
this.metrics?.numParticipantsInAggregate.observe(participants);

const signedAggregateAndProofs: SignedAggregateAndProof[] = [];

Expand Down Expand Up @@ -316,7 +321,11 @@ export class AttestationService {
} else {
(await this.api.validator.publishAggregateAndProofs({signedAggregateAndProofs})).assertOk();
}
this.logger.info("Published aggregateAndProofs", {...logCtx, count: signedAggregateAndProofs.length});
this.logger.info("Published aggregateAndProofs", {
...logCtx,
participants,
count: signedAggregateAndProofs.length,
});
this.metrics?.publishedAggregates.inc(signedAggregateAndProofs.length);
} catch (e) {
this.logger.error("Error publishing aggregateAndProofs", logCtx, e as Error);
Expand Down

0 comments on commit b05c93e

Please sign in to comment.