Skip to content

Commit d29842e

Browse files
authored
fix-fix-misleading-sync-error (#9681)
1 parent 3f31a21 commit d29842e

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/multipeer/BatchImporter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public SafeFuture<BatchImportResult> importBatch(final Batch batch) {
8989
if (lastBlockImportResult.isSuccessful()) {
9090
return BatchImportResult.IMPORTED_ALL_BLOCKS;
9191
} else if (lastBlockImportResult.hasFailedExecutingExecutionPayload()) {
92-
return BatchImportResult.SERVICE_OFFLINE;
92+
return BatchImportResult.EXECUTION_CLIENT_OFFLINE;
9393
} else if (lastBlockImportResult.isDataNotAvailable()) {
9494
return BatchImportResult.DATA_NOT_AVAILABLE;
9595
}
@@ -145,7 +145,7 @@ private SafeFuture<BlockImportResult> importBlock(
145145
public enum BatchImportResult {
146146
IMPORTED_ALL_BLOCKS,
147147
IMPORT_FAILED,
148-
SERVICE_OFFLINE,
148+
EXECUTION_CLIENT_OFFLINE,
149149
DATA_NOT_AVAILABLE;
150150

151151
public boolean isFailure() {

beacon/sync/src/main/java/tech/pegasys/teku/beacon/sync/forward/multipeer/BatchSync.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ private void onImportComplete(
433433
LOG.debug("Marking batch {} as invalid because it extends from an invalid block", batch);
434434
batch.markAsInvalid();
435435
}
436-
} else if (result == BatchImportResult.SERVICE_OFFLINE
436+
} else if (result == BatchImportResult.EXECUTION_CLIENT_OFFLINE
437437
|| result == BatchImportResult.DATA_NOT_AVAILABLE) {
438438
if (!scheduledProgressSync) {
439-
LOG.warn("Unable to import blocks because execution client is offline.");
439+
LOG.warn("Unable to import blocks: {}", result);
440440
asyncRunner
441441
.runAfterDelay(
442442
() ->

beacon/sync/src/test/java/tech/pegasys/teku/beacon/sync/forward/multipeer/BatchImporterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ void shouldNotDisconnectPeersWhenServiceOffline() {
240240
ignoreFuture(verify(blockImporter).importBlock(block2));
241241
verifyNoMoreInteractions(blockImporter);
242242

243-
// Import failed due to service being offline
243+
// Import failed due to execution being offline
244244
importResult2.complete(BlockImportResult.failedExecutionPayloadExecution(new Error()));
245-
assertThat(result).isCompletedWithValue(BatchImportResult.SERVICE_OFFLINE);
245+
assertThat(result).isCompletedWithValue(BatchImportResult.EXECUTION_CLIENT_OFFLINE);
246246
verify(batch).getSource();
247247
verify(syncSource, never()).disconnectCleanly(any());
248248

beacon/sync/src/test/java/tech/pegasys/teku/beacon/sync/forward/multipeer/BatchSyncTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
import static org.mockito.Mockito.verifyNoInteractions;
2222
import static org.mockito.Mockito.verifyNoMoreInteractions;
2323
import static org.mockito.Mockito.when;
24+
import static tech.pegasys.teku.beacon.sync.forward.multipeer.BatchImporter.BatchImportResult.EXECUTION_CLIENT_OFFLINE;
2425
import static tech.pegasys.teku.beacon.sync.forward.multipeer.BatchImporter.BatchImportResult.IMPORTED_ALL_BLOCKS;
2526
import static tech.pegasys.teku.beacon.sync.forward.multipeer.BatchImporter.BatchImportResult.IMPORT_FAILED;
26-
import static tech.pegasys.teku.beacon.sync.forward.multipeer.BatchImporter.BatchImportResult.SERVICE_OFFLINE;
2727
import static tech.pegasys.teku.beacon.sync.forward.multipeer.batches.BatchAssert.assertThatBatch;
2828
import static tech.pegasys.teku.beacon.sync.forward.multipeer.chains.TargetChainTestUtil.chainWith;
2929
import static tech.pegasys.teku.infrastructure.async.SafeFuture.completedFuture;
@@ -939,7 +939,7 @@ void shouldPauseImportingWhenImportingServiceOffline() {
939939
batch2, chainBuilder.generateBlockAtSlot(batch2.getFirstSlot()).getBlock());
940940

941941
// But then it turns out that a batch0 is not processed because importing is offline
942-
batches.getImportResult(batch0).complete(SERVICE_OFFLINE);
942+
batches.getImportResult(batch0).complete(EXECUTION_CLIENT_OFFLINE);
943943

944944
// This shouldn't make batches invalid
945945
batches.assertNotMarkedInvalid(batch0);

0 commit comments

Comments
 (0)