From 22f82a6127ea1f1e9e93dc0fc00374f2ad460a7a Mon Sep 17 00:00:00 2001 From: thinkAfCod Date: Fri, 26 Apr 2024 23:25:16 +0800 Subject: [PATCH] log: level --- .../src/main/java/io/optimism/driver/Driver.java | 10 ++++++---- .../src/main/java/io/optimism/driver/EngineDriver.java | 4 ++-- .../java/io/optimism/network/AbstractTopicHandler.java | 5 ++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hildr-node/src/main/java/io/optimism/driver/Driver.java b/hildr-node/src/main/java/io/optimism/driver/Driver.java index 6f80c80b..5c4e9755 100644 --- a/hildr-node/src/main/java/io/optimism/driver/Driver.java +++ b/hildr-node/src/main/java/io/optimism/driver/Driver.java @@ -486,7 +486,10 @@ private void advanceUnsafeHead() throws ExecutionException, InterruptedException payload = this.unsafeBlockQueue.poll()) { BigInteger unsafeBlockNum = payload.blockNumber(); BigInteger syncedBlockNum = Driver.this.engineDriver.getUnsafeHead().number(); - if (Driver.this.config.syncMode().isEl()) { + if (syncedBlockNum.compareTo(BigInteger.ZERO) == 0) { + this.futureUnsafeBlocks.add(payload); + break; + } else if (this.engineDriver.isEngineSyncing() && unsafeBlockNum.compareTo(syncedBlockNum) > 0) { this.futureUnsafeBlocks.add(payload); } else if (unsafeBlockNum.compareTo(syncedBlockNum) > 0 && unsafeBlockNum.subtract(syncedBlockNum).compareTo(BigInteger.valueOf(1024L)) < 0) { @@ -498,9 +501,8 @@ private void advanceUnsafeHead() throws ExecutionException, InterruptedException } LOGGER.debug("will handle future unsafe blocks: size={}", this.futureUnsafeBlocks.size()); Optional nextUnsafePayload; - if (Driver.this.engineDriver.isEngineSyncing()) { - nextUnsafePayload = Optional.of(this.futureUnsafeBlocks.getLast()); - this.futureUnsafeBlocks = Lists.newArrayList(); + if (this.engineDriver.isEngineSyncing()) { + nextUnsafePayload = Optional.of(this.futureUnsafeBlocks.removeFirst()); } else { nextUnsafePayload = Iterables.tryFind(this.futureUnsafeBlocks, input -> input.parentHash() .equalsIgnoreCase( diff --git a/hildr-node/src/main/java/io/optimism/driver/EngineDriver.java b/hildr-node/src/main/java/io/optimism/driver/EngineDriver.java index bd933051..ff644ae5 100644 --- a/hildr-node/src/main/java/io/optimism/driver/EngineDriver.java +++ b/hildr-node/src/main/java/io/optimism/driver/EngineDriver.java @@ -331,8 +331,8 @@ private void updateForkchoice() throws InterruptedException, ExecutionException var forkChoiceUpdate = forkChoiceUpdateFuture.get(); if (forkChoiceUpdate.hasError()) { - throw new ForkchoiceUpdateException( - "could not accept new forkchoice: %s".formatted(forkChoiceUpdate.getError().getMessage())); + throw new ForkchoiceUpdateException("could not accept new forkchoice: %s" + .formatted(forkChoiceUpdate.getError().getMessage())); } var forkChoiceUpdateStatus = forkChoiceUpdate.getForkChoiceUpdate().payloadStatus(); var updateStatus = forkChoiceUpdateStatus.getStatus(); diff --git a/hildr-node/src/main/java/io/optimism/network/AbstractTopicHandler.java b/hildr-node/src/main/java/io/optimism/network/AbstractTopicHandler.java index bd86353d..04fa2eef 100644 --- a/hildr-node/src/main/java/io/optimism/network/AbstractTopicHandler.java +++ b/hildr-node/src/main/java/io/optimism/network/AbstractTopicHandler.java @@ -362,7 +362,10 @@ protected void processMessage( case IGNORE -> LOGGER.debug("Ignoring message for topic: {}", topic); case SAVE_FOR_FUTURE -> LOGGER.debug("Deferring message for topic: {}", topic); case ACCEPT -> { - LOGGER.info("Accepting message for topic: {}", topic); + LOGGER.info( + "Accepting message for topic: {}, number: {}", + topic, + blockMessage.payloadEnvelop.executionPayload().blockNumber()); this.unsafeBlockQueue.offer(blockMessage.payloadEnvelop.executionPayload()); } default -> throw new UnsupportedOperationException(