From 0c197cef8e048d2da0e4c45959463eaae083fb13 Mon Sep 17 00:00:00 2001 From: Enrico Del Fante Date: Wed, 6 Nov 2024 18:06:38 +0100 Subject: [PATCH] uniform error --- .../util/BlockBlobSidecarsTrackersPoolImpl.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java index 8d468ba90b3..55a39d8a34c 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java @@ -34,7 +34,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.tuweni.bytes.Bytes32; @@ -509,11 +508,7 @@ private BlockBlobSidecarsTracker internalOnNewBlock( // Let's try now if (!existingTracker.isLocalElFetchTriggered() && !existingTracker.isCompleted()) { fetchMissingContentFromLocalEL(slotAndBlockRoot) - .finish( - error -> - LOG.error( - "An error occurred while attempting to fetch blobs via local EL: {}", - getRootCauseMessage(error))); + .finish(this::logLocalElBlobsLookupFailure); } } }); @@ -599,11 +594,7 @@ private void onFirstSeen( .runAfterDelay( () -> this.fetchMissingContentFromLocalEL(slotAndBlockRoot) - .handleException( - error -> - LOG.warn( - "Local EL blobs lookup failed: {}", - ExceptionUtils.getRootCauseMessage(error))) + .handleException(this::logLocalElBlobsLookupFailure) .thenRun(() -> this.fetchMissingContentFromRemotePeers(slotAndBlockRoot)), fetchDelay) .finish( @@ -611,6 +602,10 @@ private void onFirstSeen( LOG.error("An error occurred while attempting to fetch missing blobs.", error)); } + private void logLocalElBlobsLookupFailure(final Throwable error) { + LOG.warn("Local EL blobs lookup failed: {}", getRootCauseMessage(error)); + } + @VisibleForTesting Duration calculateFetchDelay(final SlotAndBlockRoot slotAndBlockRoot) { final UInt64 slot = slotAndBlockRoot.getSlot();