From 02fd0a7722d69e22d97b5061c0af03da80cbef56 Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Fri, 21 Oct 2022 18:05:09 +0200 Subject: [PATCH] Include information about why publishing the attestation failed in response (#6332) --- beacon/validator/build.gradle | 1 + .../coordinator/ValidatorApiHandler.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/beacon/validator/build.gradle b/beacon/validator/build.gradle index 2862c3c2769..dcf619a98e7 100644 --- a/beacon/validator/build.gradle +++ b/beacon/validator/build.gradle @@ -25,6 +25,7 @@ dependencies { implementation project(':data:serializer') implementation project(':data:provider') implementation project(':infrastructure:events') + implementation project(':infrastructure:exceptions') implementation project(':infrastructure:metrics') implementation 'it.unimi.dsi:fastutil' diff --git a/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java b/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java index 699f59df6fd..7f06046b371 100644 --- a/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java +++ b/beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java @@ -15,6 +15,7 @@ import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toMap; +import static tech.pegasys.teku.infrastructure.exceptions.ExceptionUtil.getMessageOrSimpleName; import static tech.pegasys.teku.infrastructure.logging.ValidatorLogger.VALIDATOR_LOGGER; import static tech.pegasys.teku.spec.config.SpecConfig.GENESIS_SLOT; @@ -493,10 +494,18 @@ private SafeFuture processAttestation(final Attestatio } }) .exceptionally( - error -> - InternalValidationResult.reject( - "Failed to send signed attestation for slot %s, block %s", - attestation.getData().getSlot(), attestation.getData().getBeaconBlockRoot())); + error -> { + LOG.error( + "Failed to send signed attestation for slot {}, block {}", + attestation.getData().getSlot(), + attestation.getData().getBeaconBlockRoot(), + error); + return InternalValidationResult.reject( + "Failed to send signed attestation for slot %s, block %s: %s", + attestation.getData().getSlot(), + attestation.getData().getBeaconBlockRoot(), + getMessageOrSimpleName(error)); + }); } private List convertAttestationProcessingResultsToErrorList(