Skip to content

Commit

Permalink
Improve error on local EL blobs lookup (Consensys#8826)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr authored Nov 6, 2024
1 parent cedae8a commit b5d4cbc
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package tech.pegasys.teku.statetransition.util;

import static com.google.common.base.Preconditions.checkArgument;
import static tech.pegasys.teku.infrastructure.exceptions.ExceptionUtil.getRootCauseMessage;
import static tech.pegasys.teku.infrastructure.time.TimeUtilities.secondsToMillis;
import static tech.pegasys.teku.statetransition.blobs.BlobSidecarManager.RemoteOrigin.LOCAL_EL;
import static tech.pegasys.teku.statetransition.blobs.BlobSidecarManager.RemoteOrigin.LOCAL_PROPOSAL;
Expand All @@ -33,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;
Expand Down Expand Up @@ -508,10 +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"));
.finish(this::logLocalElBlobsLookupFailure);
}
}
});
Expand Down Expand Up @@ -597,18 +594,18 @@ 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(
error ->
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();
Expand Down

0 comments on commit b5d4cbc

Please sign in to comment.