From 634f54b53119536a120fcf1c53f7629bec0e316c Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Thu, 18 May 2023 09:30:21 +1000 Subject: [PATCH 01/11] Add more backwards sync logging to debug nimbus issue Signed-off-by: Simon Dudley --- .../eth/manager/task/GetBodiesFromPeerTask.java | 11 +++++++++++ .../eth/sync/backwardsync/BackwardSyncContext.java | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java index c5a2d1b727a..b3b7b30d4d2 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java @@ -84,6 +84,11 @@ public static GetBodiesFromPeerTask forHeaders( protected PendingPeerRequest sendRequest() { final List blockHashes = headers.stream().map(BlockHeader::getHash).collect(Collectors.toList()); + LOG.atTrace() + .setMessage("Requesting {} bodies with hashes {}.") + .addArgument(blockHashes.size()) + .addArgument(blockHashes) + .log(); final long minimumRequiredBlockNumber = headers.get(headers.size() - 1).getNumber(); return sendRequestToPeer( @@ -105,7 +110,13 @@ protected Optional> processResponse( } final BlockBodiesMessage bodiesMessage = BlockBodiesMessage.readFrom(message); + LOG.atTrace().setMessage("Received BlockBodiesMessage {}").addArgument(bodiesMessage).log(); final List bodies = bodiesMessage.bodies(protocolSchedule); + LOG.atTrace() + .setMessage("Received {} bodies: {}") + .addArgument(bodies.size()) + .addArgument(bodies) + .log(); if (bodies.size() == 0) { // Message contains no data - nothing to do LOG.debug("Message contains no data. Peer: {}", peer); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java index bc618e7c133..7d0e4e3b185 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java @@ -102,6 +102,7 @@ public synchronized boolean isSyncing() { } public synchronized void updateHead(final Hash headHash) { + LOG.atTrace().setMessage("Maybe update maybeHead to {}").addArgument(headHash).log(); if (Hash.ZERO.equals(headHash)) { maybeHead = Optional.empty(); } else { @@ -331,6 +332,11 @@ protected Void saveBlock(final Block block) { @VisibleForTesting protected void possiblyMoveHead(final Block lastSavedBlock) { final MutableBlockchain blockchain = getProtocolContext().getBlockchain(); + LOG.atTrace() + .setMessage("possibleMoveHead(lastSavedBlock={}); maybeHead={}") + .addArgument(lastSavedBlock::toLogString) + .addArgument(maybeHead) + .log(); if (maybeHead.isEmpty()) { LOG.debug("Nothing to do with the head"); return; From 8925c24d69a9f17b87e627738393cee78db117a1 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Thu, 18 May 2023 10:08:53 +1000 Subject: [PATCH 02/11] Fix NPE Signed-off-by: Simon Dudley --- .../ethereum/eth/sync/backwardsync/BackwardSyncContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java index 7d0e4e3b185..3fedf5ee1d2 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java @@ -334,7 +334,7 @@ protected void possiblyMoveHead(final Block lastSavedBlock) { final MutableBlockchain blockchain = getProtocolContext().getBlockchain(); LOG.atTrace() .setMessage("possibleMoveHead(lastSavedBlock={}); maybeHead={}") - .addArgument(lastSavedBlock::toLogString) + .addArgument(Optional.ofNullable(lastSavedBlock).map(Block::toLogString).orElse("null")) .addArgument(maybeHead) .log(); if (maybeHead.isEmpty()) { From 12eb803cda6f682e9c80de3dadf974ac85758a8c Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Thu, 18 May 2023 18:01:21 +1000 Subject: [PATCH 03/11] More logging tweaks Signed-off-by: Simon Dudley --- .../ethereum/api/jsonrpc/internal/methods/EthGetLogs.java | 1 + .../ethereum/eth/manager/task/GetBodiesFromPeerTask.java | 8 +++++++- .../RetryingGetHeadersEndingAtFromPeerByHashTask.java | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetLogs.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetLogs.java index 7561191adfc..506aa7549e7 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetLogs.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetLogs.java @@ -53,6 +53,7 @@ public String getName() { @Override public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { final FilterParameter filter = requestContext.getRequiredParameter(0, FilterParameter.class); + LOG.atTrace().setMessage("eth_getLogs FilterParameter: {}").addArgument(filter).log(); if (!filter.isValid()) { return new JsonRpcErrorResponse( diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java index b3b7b30d4d2..bd6045e0ea4 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java @@ -110,7 +110,6 @@ protected Optional> processResponse( } final BlockBodiesMessage bodiesMessage = BlockBodiesMessage.readFrom(message); - LOG.atTrace().setMessage("Received BlockBodiesMessage {}").addArgument(bodiesMessage).log(); final List bodies = bodiesMessage.bodies(protocolSchedule); LOG.atTrace() .setMessage("Received {} bodies: {}") @@ -139,6 +138,13 @@ protected Optional> processResponse( // Clear processed headers headers.clear(); } + LOG.atDebug() + .setMessage("Associated {} bodies with {} headers to get {} blocks with these hashes: {}") + .addArgument(bodies.size()) + .addArgument(headers.size()) + .addArgument(blocks.size()) + .addArgument(blocks.stream().map(Block::getHash).collect(Collectors.toList())) + .log(); return Optional.of(blocks); } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/RetryingGetHeadersEndingAtFromPeerByHashTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/RetryingGetHeadersEndingAtFromPeerByHashTask.java index e467bfba119..5b5b0cef359 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/RetryingGetHeadersEndingAtFromPeerByHashTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/RetryingGetHeadersEndingAtFromPeerByHashTask.java @@ -92,8 +92,8 @@ protected CompletableFuture> executeTaskOnCurrentPeer( return executeSubTask(task::run) .thenApply( peerResult -> { - LOG.debug( - "Get {} block headers by hash {} from peer {} has result {}", + LOG.trace( + "Got {} block headers by hash {} from peer {} has result {}", count, referenceHash, currentPeer, From 6ff83d1da8c02d2dea33b6df9cd8974e14bb05e1 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Thu, 25 May 2023 17:29:28 +1000 Subject: [PATCH 04/11] Remove BackwardSyncContext.maybeHead It's usage is not clear and it's causing besu to rewind the head to it (a large reorg) when combined with nimbus backwards sync Signed-off-by: Simon Dudley --- .../merge/blockcreation/MergeCoordinator.java | 2 +- .../backwardsync/BackwardSyncContext.java | 43 ++++++------------- .../backwardsync/BackwardSyncContextTest.java | 39 +++++++++++++++-- 3 files changed, 50 insertions(+), 34 deletions(-) diff --git a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java index 03548c893d5..2522193f390 100644 --- a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java +++ b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java @@ -469,7 +469,7 @@ public Optional getOrSyncHeadByHash(final Hash headHash, final Hash .setMessage("Appending new head block hash {} to backward sync") .addArgument(headHash::toHexString) .log(); - backwardSyncContext.updateHead(headHash); + backwardSyncContext.maybeUpdateTargetHeight(headHash); backwardSyncContext .syncBackwardsUntil(headHash) .thenRun(() -> updateFinalized(finalizedHash)); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java index 3fedf5ee1d2..cb3e1b5a77f 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java @@ -55,7 +55,6 @@ public class BackwardSyncContext { private final AtomicReference currentBackwardSyncStatus = new AtomicReference<>(); private final BackwardChain backwardChain; private int batchSize = BATCH_SIZE; - private Optional maybeHead = Optional.empty(); private final int maxRetries; private final long millisBetweenRetries = DEFAULT_MILLIS_BETWEEN_RETRIES; private final Subscribers badChainListeners = Subscribers.create(); @@ -101,18 +100,22 @@ public synchronized boolean isSyncing() { .orElse(Boolean.FALSE); } - public synchronized void updateHead(final Hash headHash) { - LOG.atTrace().setMessage("Maybe update maybeHead to {}").addArgument(headHash).log(); - if (Hash.ZERO.equals(headHash)) { - maybeHead = Optional.empty(); - } else { - maybeHead = Optional.of(headHash); + public synchronized void maybeUpdateTargetHeight(final Hash headHash) { + LOG.atTrace().setMessage("maybeUpdateTargetHeight with {}").addArgument(headHash).log(); + if (!Hash.ZERO.equals(headHash)) { Optional maybeCurrentStatus = Optional.ofNullable(currentBackwardSyncStatus.get()); maybeCurrentStatus.ifPresent( status -> backwardChain .getBlock(headHash) - .ifPresent(block -> status.updateTargetHeight(block.getHeader().getNumber()))); + .ifPresent( + block -> { + LOG.atTrace() + .setMessage("updateTargetHeight to {}") + .addArgument(block.getHeader().getNumber()) + .log(); + status.updateTargetHeight(block.getHeader().getNumber()); + })); } } @@ -332,25 +335,9 @@ protected Void saveBlock(final Block block) { @VisibleForTesting protected void possiblyMoveHead(final Block lastSavedBlock) { final MutableBlockchain blockchain = getProtocolContext().getBlockchain(); - LOG.atTrace() - .setMessage("possibleMoveHead(lastSavedBlock={}); maybeHead={}") - .addArgument(Optional.ofNullable(lastSavedBlock).map(Block::toLogString).orElse("null")) - .addArgument(maybeHead) - .log(); - if (maybeHead.isEmpty()) { - LOG.debug("Nothing to do with the head"); - return; - } - final Hash head = maybeHead.get(); - if (blockchain.getChainHead().getHash().equals(head)) { - LOG.debug("Head is already properly set"); - return; - } - - if (blockchain.contains(head)) { - LOG.debug("Changing head to {}", head); - blockchain.rewindToBlock(head); + if (blockchain.getChainHead().getHash().equals(lastSavedBlock.getHash())) { + LOG.debug("Head is already properly set to {}", lastSavedBlock.toLogString()); return; } @@ -448,10 +435,6 @@ public boolean progressLogDue() { return false; } - public CompletableFuture getCurrentFuture() { - return currentFuture; - } - public long getTargetChainHeight() { return targetChainHeight; } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java index 80bfbba1035..7c744c6b520 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java @@ -59,6 +59,7 @@ import java.util.concurrent.ExecutionException; import javax.annotation.Nonnull; +import org.apache.tuweni.bytes.Bytes; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -256,13 +257,45 @@ private Block getBlockByNumber(final int number) { } @Test - public void testUpdatingHead() { - context.updateHead(localBlockchain.getBlockByNumber(4).orElseThrow().getHash()); - context.possiblyMoveHead(null); + public void shouldMoveHead() { + final Block lastSavedBlock = localBlockchain.getBlockByNumber(4).orElseThrow(); + context.possiblyMoveHead(lastSavedBlock); assertThat(localBlockchain.getChainHeadBlock().getHeader().getNumber()).isEqualTo(4); } + @Test + public void shouldNotMoveHeadWhenAlreadyHead() { + final Block lastSavedBlock = localBlockchain.getBlockByNumber(25).orElseThrow(); + context.possiblyMoveHead(lastSavedBlock); + + assertThat(localBlockchain.getChainHeadBlock().getHeader().getNumber()).isEqualTo(25); + } + + @Test + public void shouldUpdateTargetHeightWhenStatusPresent() { + // Given + BlockHeader blockHeader = Mockito.mock(BlockHeader.class); + when(blockHeader.getParentHash()).thenReturn(Hash.fromHexStringLenient("0x41")); + when(blockHeader.getHash()).thenReturn(Hash.fromHexStringLenient("0x42")); + when(blockHeader.getNumber()).thenReturn(42L); + Block unknownBlock = Mockito.mock(Block.class); + when(unknownBlock.getHeader()).thenReturn(blockHeader); + when(unknownBlock.getHash()).thenReturn(Hash.fromHexStringLenient("0x42")); + when(unknownBlock.toRlp()).thenReturn(Bytes.EMPTY); + context.syncBackwardsUntil(unknownBlock); // set the status + assertThat(context.getStatus().getTargetChainHeight()).isEqualTo(42); + final Hash backwardChainHash = + remoteBlockchain.getBlockByNumber(LOCAL_HEIGHT + 4).get().getHash(); + final Block backwardChainBlock = backwardChain.getTrustedBlock(backwardChainHash); + + // When + context.maybeUpdateTargetHeight(backwardChainBlock.getHash()); + + // Then + assertThat(context.getStatus().getTargetChainHeight()).isEqualTo(29); + } + @Test public void shouldProcessExceptionsCorrectly() { assertThatThrownBy( From 48c8231aa205c3c1c1ad83bbced2970c431a2fb5 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Wed, 31 May 2023 08:29:16 +1000 Subject: [PATCH 05/11] Remove excess logging Signed-off-by: Simon Dudley --- .../besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java | 1 - 1 file changed, 1 deletion(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java index cb3e1b5a77f..555a2fb24db 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java @@ -101,7 +101,6 @@ public synchronized boolean isSyncing() { } public synchronized void maybeUpdateTargetHeight(final Hash headHash) { - LOG.atTrace().setMessage("maybeUpdateTargetHeight with {}").addArgument(headHash).log(); if (!Hash.ZERO.equals(headHash)) { Optional maybeCurrentStatus = Optional.ofNullable(currentBackwardSyncStatus.get()); maybeCurrentStatus.ifPresent( From 8ca06ece6355a06cffb4ff680fd5366a6776dd07 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Wed, 31 May 2023 08:45:18 +1000 Subject: [PATCH 06/11] update changelog Signed-off-by: Simon Dudley --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc11f9f18f9..ee33bba87ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Unite the tx-pool CLI options under the same Tx Pool Options group in UX. [#5466](https://github.com/hyperledger/besu/issues/5466) ### Bug Fixes +- Fix backwards sync bug where chain is rolled back too far, especially when restarting Nimbus [#5497](https://github.com/hyperledger/besu/pull/5497) ### Download Links From 203df1353f19443fcec1bf9f5fa617d879db44d9 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Mon, 5 Jun 2023 06:59:09 +1000 Subject: [PATCH 07/11] Remove more logging and move some to trace Signed-off-by: Simon Dudley --- .../ethereum/eth/manager/task/GetBodiesFromPeerTask.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java index bd6045e0ea4..1320d9f3181 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java @@ -111,11 +111,6 @@ protected Optional> processResponse( final BlockBodiesMessage bodiesMessage = BlockBodiesMessage.readFrom(message); final List bodies = bodiesMessage.bodies(protocolSchedule); - LOG.atTrace() - .setMessage("Received {} bodies: {}") - .addArgument(bodies.size()) - .addArgument(bodies) - .log(); if (bodies.size() == 0) { // Message contains no data - nothing to do LOG.debug("Message contains no data. Peer: {}", peer); @@ -138,7 +133,7 @@ protected Optional> processResponse( // Clear processed headers headers.clear(); } - LOG.atDebug() + LOG.atTrace() .setMessage("Associated {} bodies with {} headers to get {} blocks with these hashes: {}") .addArgument(bodies.size()) .addArgument(headers.size()) From 98dcdcd6e978ba54070b486450134635b190bea1 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 6 Jun 2023 08:32:22 +1000 Subject: [PATCH 08/11] Update ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java lazy log Co-authored-by: Fabio Di Fabio Signed-off-by: Simon Dudley --- .../besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java index 1320d9f3181..9e1df148c12 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTask.java @@ -138,7 +138,7 @@ protected Optional> processResponse( .addArgument(bodies.size()) .addArgument(headers.size()) .addArgument(blocks.size()) - .addArgument(blocks.stream().map(Block::getHash).collect(Collectors.toList())) + .addArgument(() -> blocks.stream().map(Block::toLogString).toList()) .log(); return Optional.of(blocks); } From ddb6043361d10c5f901dfa7369b48c03c0b96a7c Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 6 Jun 2023 08:34:09 +1000 Subject: [PATCH 09/11] Update ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java Co-authored-by: Fabio Di Fabio Signed-off-by: Simon Dudley --- .../ethereum/eth/sync/backwardsync/BackwardSyncContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java index 555a2fb24db..fc9acc98f9d 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java @@ -111,7 +111,7 @@ public synchronized void maybeUpdateTargetHeight(final Hash headHash) { block -> { LOG.atTrace() .setMessage("updateTargetHeight to {}") - .addArgument(block.getHeader().getNumber()) + .addArgument(block::toLogString) .log(); status.updateTargetHeight(block.getHeader().getNumber()); })); From 85960f04daeeb97d726786d5b70e04adfc1f9b5e Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 6 Jun 2023 08:34:43 +1000 Subject: [PATCH 10/11] Update ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java Co-authored-by: Fabio Di Fabio Signed-off-by: Simon Dudley --- .../ethereum/eth/sync/backwardsync/BackwardSyncContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java index fc9acc98f9d..8c1caa93454 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java @@ -336,7 +336,7 @@ protected void possiblyMoveHead(final Block lastSavedBlock) { final MutableBlockchain blockchain = getProtocolContext().getBlockchain(); if (blockchain.getChainHead().getHash().equals(lastSavedBlock.getHash())) { - LOG.debug("Head is already properly set to {}", lastSavedBlock.toLogString()); + LOG.atDebug().setMessage("Head is already properly set to {}").addArgument(lastSavedBlock::toLogString).log(); return; } From ec69fd427eddb6dda8e6f4836981791b16e6be0d Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 6 Jun 2023 08:44:13 +1000 Subject: [PATCH 11/11] spotless Signed-off-by: Simon Dudley --- .../ethereum/eth/sync/backwardsync/BackwardSyncContext.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java index 8c1caa93454..fc02409ce78 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContext.java @@ -336,7 +336,10 @@ protected void possiblyMoveHead(final Block lastSavedBlock) { final MutableBlockchain blockchain = getProtocolContext().getBlockchain(); if (blockchain.getChainHead().getHash().equals(lastSavedBlock.getHash())) { - LOG.atDebug().setMessage("Head is already properly set to {}").addArgument(lastSavedBlock::toLogString).log(); + LOG.atDebug() + .setMessage("Head is already properly set to {}") + .addArgument(lastSavedBlock::toLogString) + .log(); return; }