Skip to content

Commit

Permalink
add error log (#8135)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr authored Mar 25, 2024
1 parent 6bad944 commit 1d8255a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ public synchronized void onCompletedBlockAndBlobSidecars(
totalBlobSidecars += (int) addedBlobs;
sizeGauge.set(totalBlobSidecars, GAUGE_BLOB_SIDECARS_LABEL);

if (!blobSidecarsTracker.isCompleted()) {
LOG.error(
"Tracker for block {} is supposed to be completed but it is not. Missing blob sidecars: {}",
block.toLogString(),
blobSidecarsTracker.getMissingBlobSidecars().count());
}

if (orderedBlobSidecarsTrackers.add(slotAndBlockRoot)) {
sizeGauge.set(orderedBlobSidecarsTrackers.size(), GAUGE_BLOB_SIDECARS_TRACKERS_LABEL);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.hyperledger.besu.metrics.prometheus.PrometheusMetricsSystem;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tech.pegasys.infrastructure.logging.LogCaptor;
import tech.pegasys.teku.infrastructure.async.StubAsyncRunner;
import tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory;
import tech.pegasys.teku.infrastructure.time.StubTimeProvider;
Expand Down Expand Up @@ -227,6 +228,31 @@ public void onNewBlock_shouldIgnorePreDenebBlocks() {
assertBlobSidecarsTrackersCount(0);
}

@Test
public void onCompletedBlockAndBlobSidecars_shouldLogWarningWhenNotCompleted() {
try (final LogCaptor logCaptor = LogCaptor.forClass(BlockBlobSidecarsTrackersPoolImpl.class)) {
final SignedBeaconBlock block = dataStructureUtil.randomSignedBeaconBlock(currentSlot);
final int expectedBlobs =
block
.getMessage()
.getBody()
.toVersionDeneb()
.orElseThrow()
.getBlobKzgCommitments()
.size();

assertThat(expectedBlobs).isGreaterThan(0);

blockBlobSidecarsTrackersPool.onCompletedBlockAndBlobSidecars(block, List.of());

logCaptor.assertErrorLog(
"Tracker for block "
+ block.toLogString()
+ " is supposed to be completed but it is not. Missing blob sidecars: "
+ expectedBlobs);
}
}

@Test
public void onNewBlobSidecarOnNewBlock_addTrackerWithBothBlockAndBlobSidecar() {
final SignedBeaconBlock block = dataStructureUtil.randomSignedBeaconBlock(currentSlot);
Expand Down

0 comments on commit 1d8255a

Please sign in to comment.