diff --git a/besu/src/main/java/org/hyperledger/besu/cli/subcommands/operator/BackupState.java b/besu/src/main/java/org/hyperledger/besu/cli/subcommands/operator/BackupState.java index e56ccd960c..62621328b4 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/subcommands/operator/BackupState.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/subcommands/operator/BackupState.java @@ -81,7 +81,7 @@ public class BackupState implements Runnable { final BesuController besuController = createBesuController(); final MutableBlockchain blockchain = besuController.getProtocolContext().getBlockchain(); - final ForestWorldStateKeyValueStorage worldStateKeyValueStorage = + final ForestWorldStateKeyValueStorage forestWorldStateKeyValueStorage = ((ForestWorldStateArchive) besuController.getProtocolContext().getWorldStateArchive()) .getWorldStateStorage(); final EthScheduler scheduler = new EthScheduler(1, 1, 1, 1, new NoOpMetricsSystem()); @@ -93,7 +93,7 @@ public class BackupState implements Runnable { blockchain, backupDir.toPath(), scheduler, - worldStateKeyValueStorage); + forestWorldStateKeyValueStorage); final BackupStatus status = backup.requestBackup(targetBlock, compress, Optional.empty()); final double refValue = Math.pow(2, 256) / 100.0d; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/bonsai/worldview/BonsaiWorldState.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/bonsai/worldview/BonsaiWorldState.java index e4e00b31b1..b1b650f437 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/bonsai/worldview/BonsaiWorldState.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/bonsai/worldview/BonsaiWorldState.java @@ -557,7 +557,7 @@ public class BonsaiWorldState return worldStateKeyValueStorage.getAccountStateTrieNode(location, nodeHash); } - protected void writeTrieNode( + private void writeTrieNode( final SegmentIdentifier segmentId, final SegmentedKeyValueStorageTransaction tx, final Bytes location, diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/forest/pruner/Pruner.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/forest/pruner/Pruner.java index 2898bfdaee..78d5aa853d 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/forest/pruner/Pruner.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/forest/pruner/Pruner.java @@ -179,11 +179,11 @@ public class Pruner { } } - public PruningPhase getPruningPhase() { + PruningPhase getPruningPhase() { return pruningPhase.get(); } - public enum PruningPhase { + enum PruningPhase { IDLE, MARK_BLOCK_CONFIRMATIONS_AWAITING, MARKING, diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateKeyValueStorage.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateKeyValueStorage.java index 5ff6a218ca..4e3d6ceee6 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateKeyValueStorage.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateKeyValueStorage.java @@ -1,5 +1,5 @@ /* - * Copyright ConsenSys AG. + * Copyright Hyperledger Besu Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -11,7 +11,6 @@ * specific language governing permissions and limitations under the License. * * SPDX-License-Identifier: Apache-2.0 - * */ package org.hyperledger.besu.ethereum.worldstate; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateStorageCoordinator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateStorageCoordinator.java index 9f38a49c61..b3abe347f3 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateStorageCoordinator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/WorldStateStorageCoordinator.java @@ -1,5 +1,5 @@ /* - * Copyright ConsenSys AG. + * Copyright Hyperledger Besu Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/LoadLocalDataStep.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/LoadLocalDataStep.java index 231b4c84bd..394023aba0 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/LoadLocalDataStep.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/LoadLocalDataStep.java @@ -69,8 +69,7 @@ public class LoadLocalDataStep { // check if node is already stored in the worldstate try { if (snapSyncState.hasPivotBlockHeader()) { - Optional existingData = - request.getExistingData(downloadState, worldStateStorageCoordinator); + Optional existingData = request.getExistingData(worldStateStorageCoordinator); if (existingData.isPresent()) { existingNodeCounter.inc(); request.setData(existingData.get()); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/AccountTrieNodeHealingRequest.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/AccountTrieNodeHealingRequest.java index e698ca58b2..e2f3353f20 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/AccountTrieNodeHealingRequest.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/AccountTrieNodeHealingRequest.java @@ -77,7 +77,6 @@ public class AccountTrieNodeHealingRequest extends TrieNodeHealingRequest { @Override public Optional getExistingData( - final SnapWorldDownloadState downloadState, final WorldStateStorageCoordinator worldStateStorageCoordinator) { return worldStateStorageCoordinator .getAccountStateTrieNode(getLocation(), getNodeHash()) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequest.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequest.java index 5cf151c51e..d1cea17684 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequest.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequest.java @@ -64,7 +64,6 @@ public class StorageTrieNodeHealingRequest extends TrieNodeHealingRequest { @Override public Optional getExistingData( - final SnapWorldDownloadState downloadState, final WorldStateStorageCoordinator worldStateStorageCoordinator) { return worldStateStorageCoordinator.getAccountStorageTrieNode( getAccountHash(), getLocation(), getNodeHash()); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/TrieNodeHealingRequest.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/TrieNodeHealingRequest.java index e0d92382bf..e114ebb426 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/TrieNodeHealingRequest.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/TrieNodeHealingRequest.java @@ -181,7 +181,6 @@ public abstract class TrieNodeHealingRequest extends SnapDataRequest } public abstract Optional getExistingData( - final SnapWorldDownloadState downloadState, final WorldStateStorageCoordinator worldStateStorageCoordinator); public abstract List getTrieNodePath(); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/AccountHealingTrackingTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/AccountHealingTrackingTest.java index ad4504cbf0..5cda25ee51 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/AccountHealingTrackingTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/AccountHealingTrackingTest.java @@ -219,8 +219,7 @@ public class AccountHealingTrackingTest { accountHash, Hash.wrap(accountStateTrie.getRootHash()), Bytes.EMPTY); - storageTrieNodeHealingRequest.getExistingData( - snapWorldDownloadState, worldStateStorageCoordinator); + storageTrieNodeHealingRequest.getExistingData(worldStateStorageCoordinator); verify(snapWorldDownloadState, never()).addAccountToHealingList(any(Bytes.class)); } } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequestTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequestTest.java index c85d4f85b2..1c4948ab90 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequestTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequestTest.java @@ -18,7 +18,6 @@ import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; import org.hyperledger.besu.ethereum.core.TrieGenerator; -import org.hyperledger.besu.ethereum.eth.sync.snapsync.SnapWorldDownloadState; import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.storage.StorageProvider; import org.hyperledger.besu.ethereum.trie.MerkleTrie; @@ -42,13 +41,11 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; -import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) class StorageTrieNodeHealingRequestTest { - @Mock private SnapWorldDownloadState downloadState; final List
accounts = List.of( Address.fromHexString("0xdeadbeef"), @@ -102,8 +99,7 @@ class StorageTrieNodeHealingRequestTest { new StorageTrieNodeHealingRequest( account0StorageRoot, account0Hash, Hash.EMPTY, Bytes.EMPTY); - Assertions.assertThat(request.getExistingData(downloadState, worldStateStorageCoordinator)) - .isPresent(); + Assertions.assertThat(request.getExistingData(worldStateStorageCoordinator)).isPresent(); } @ParameterizedTest @@ -113,7 +109,6 @@ class StorageTrieNodeHealingRequestTest { final StorageTrieNodeHealingRequest request = new StorageTrieNodeHealingRequest(Hash.EMPTY, account0Hash, Hash.EMPTY, Bytes.EMPTY); - Assertions.assertThat(request.getExistingData(downloadState, worldStateStorageCoordinator)) - .isEmpty(); + Assertions.assertThat(request.getExistingData(worldStateStorageCoordinator)).isEmpty(); } } diff --git a/ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPOutput.java b/ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPOutput.java index 494106f98f..140e60d9d2 100644 --- a/ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPOutput.java +++ b/ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPOutput.java @@ -92,7 +92,7 @@ public interface RLPOutput { /** * Writes a RLP "null", that is an empty value. * - *

This is a shortcut for writeUInt256Scalar{@code writeBytes(Bytes.EMPTY)}. + *

This is a shortcut for {@code writeBytes(Bytes.EMPTY)}. */ default void writeNull() { writeBytes(Bytes.EMPTY);