feat: log agent, version and peerid for batched gossip errors (#8604)

**Motivation**

Logs client meta for batch processed gossip errors
This commit is contained in:
Matthew Keil
2025-11-04 09:51:03 -05:00
committed by GitHub
parent 782dc5ee45
commit 801b1f4f52

View File

@@ -46,13 +46,19 @@ export function getGossipValidatorBatchFn(
}))
);
return results.map((e) => {
return results.map((e, i) => {
if (e == null) {
return TopicValidatorResult.Accept;
}
const {clientAgent, clientVersion, propagationSource} = messageInfos[i];
if (!(e instanceof AttestationError)) {
logger.debug(`Gossip batch validation ${type} threw a non-AttestationError`, {}, e as Error);
logger.debug(
`Gossip batch validation ${type} threw a non-AttestationError`,
{peerId: prettyPrintPeerIdStr(propagationSource), clientAgent, clientVersion},
e as Error
);
metrics?.networkProcessor.gossipValidationIgnore.inc({topic: type});
return TopicValidatorResult.Ignore;
}
@@ -67,7 +73,11 @@ export function getGossipValidatorBatchFn(
metrics?.networkProcessor.gossipValidationReject.inc({topic: type});
// only beacon_attestation topic is validated in batch
metrics?.networkProcessor.gossipAttestationRejectByReason.inc({reason: e.type.code});
logger.debug(`Gossip validation ${type} rejected`, {}, e);
logger.debug(
`Gossip validation ${type} rejected`,
{peerId: prettyPrintPeerIdStr(propagationSource), clientAgent, clientVersion},
e
);
return TopicValidatorResult.Reject;
}
});
@@ -125,7 +135,11 @@ export function getGossipValidatorFn(gossipHandlers: GossipHandlers, modules: Va
} catch (e) {
if (!(e instanceof GossipActionError)) {
// not deserve to log error here, it looks too dangerous to users
logger.debug(`Gossip validation ${type} threw a non-GossipActionError`, {}, e as Error);
logger.debug(
`Gossip validation ${type} threw a non-GossipActionError`,
{peerId: prettyPrintPeerIdStr(propagationSource), clientAgent, clientVersion},
e as Error
);
return TopicValidatorResult.Ignore;
}