diff --git a/ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/worldstate/PrunerIntegrationTest.java b/ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/forest/pruner/PrunerIntegrationTest.java similarity index 97% rename from ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/worldstate/PrunerIntegrationTest.java rename to ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/forest/pruner/PrunerIntegrationTest.java index 69e5fa16050..c640ed6960c 100644 --- a/ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/worldstate/PrunerIntegrationTest.java +++ b/ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/forest/pruner/PrunerIntegrationTest.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.worldstate; +package org.hyperledger.besu.ethereum.forest.pruner; import static org.assertj.core.api.Assertions.assertThat; import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryBlockchain; @@ -26,15 +26,15 @@ import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.forest.ForestWorldStateArchive; -import org.hyperledger.besu.ethereum.forest.pruner.MarkSweepPruner; -import org.hyperledger.besu.ethereum.forest.pruner.Pruner; import org.hyperledger.besu.ethereum.forest.pruner.Pruner.PruningPhase; -import org.hyperledger.besu.ethereum.forest.pruner.PrunerConfiguration; import org.hyperledger.besu.ethereum.forest.storage.ForestWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.storage.keyvalue.WorldStatePreimageKeyValueStorage; import org.hyperledger.besu.ethereum.trie.MerkleTrie; import org.hyperledger.besu.ethereum.trie.patricia.StoredMerklePatriciaTrie; +import org.hyperledger.besu.ethereum.worldstate.StateTrieAccountValue; +import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; +import org.hyperledger.besu.ethereum.worldstate.WorldStateStorage; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.evm.worldstate.WorldState; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/forest/pruner/Pruner.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/forest/pruner/Pruner.java index 984873ab060..3b37672b7dc 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/forest/pruner/Pruner.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/forest/pruner/Pruner.java @@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; +import com.google.common.annotations.VisibleForTesting; import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +50,8 @@ public class Pruner { private final AtomicReference state = new AtomicReference<>(State.IDLE); private final ExecutorService executorService; - public Pruner( + @VisibleForTesting + Pruner( final MarkSweepPruner pruningStrategy, final Blockchain blockchain, final PrunerConfiguration prunerConfiguration, diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/MarkSweepPrunerTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/pruner/MarkSweepPrunerTest.java similarity index 97% rename from ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/MarkSweepPrunerTest.java rename to ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/pruner/MarkSweepPrunerTest.java index 918ddbf993a..01fb80b164c 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/MarkSweepPrunerTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/pruner/MarkSweepPrunerTest.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.worldstate; +package org.hyperledger.besu.ethereum.forest.pruner; import static org.assertj.core.api.Assertions.assertThat; import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryBlockchain; @@ -29,12 +29,14 @@ import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.forest.ForestWorldStateArchive; -import org.hyperledger.besu.ethereum.forest.pruner.MarkSweepPruner; import org.hyperledger.besu.ethereum.forest.storage.ForestWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.storage.keyvalue.WorldStatePreimageKeyValueStorage; import org.hyperledger.besu.ethereum.trie.MerkleTrie; import org.hyperledger.besu.ethereum.trie.patricia.StoredMerklePatriciaTrie; +import org.hyperledger.besu.ethereum.worldstate.StateTrieAccountValue; +import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; +import org.hyperledger.besu.ethereum.worldstate.WorldStateStorage; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.evm.worldstate.WorldState; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/PrunerTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/pruner/PrunerTest.java similarity index 97% rename from ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/PrunerTest.java rename to ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/pruner/PrunerTest.java index 50c9e926799..a8cd0f8f1ad 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/PrunerTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/pruner/PrunerTest.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.worldstate; +package org.hyperledger.besu.ethereum.forest.pruner; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.anyLong; @@ -29,9 +29,6 @@ import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockDataGenerator.BlockOptions; import org.hyperledger.besu.ethereum.core.TransactionReceipt; -import org.hyperledger.besu.ethereum.forest.pruner.MarkSweepPruner; -import org.hyperledger.besu.ethereum.forest.pruner.Pruner; -import org.hyperledger.besu.ethereum.forest.pruner.PrunerConfiguration; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStoragePrefixedKeyBlockchainStorage; import org.hyperledger.besu.ethereum.storage.keyvalue.VariablesKeyValueStorage; diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/storage/keyvalue/KeyValueStorageWorldStateStorageTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/storage/ForestKeyValueStorageWorldStateStorageTest.java similarity index 97% rename from ethereum/core/src/test/java/org/hyperledger/besu/ethereum/storage/keyvalue/KeyValueStorageWorldStateStorageTest.java rename to ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/storage/ForestKeyValueStorageWorldStateStorageTest.java index 504c7fe4929..737e0e5d8fa 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/storage/keyvalue/KeyValueStorageWorldStateStorageTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/storage/ForestKeyValueStorageWorldStateStorageTest.java @@ -12,12 +12,11 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.storage.keyvalue; +package org.hyperledger.besu.ethereum.forest.storage; import static org.assertj.core.api.Assertions.assertThat; import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.ethereum.forest.storage.ForestWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.forest.storage.ForestWorldStateKeyValueStorage.Updater; import org.hyperledger.besu.ethereum.trie.MerkleTrie; import org.hyperledger.besu.services.kvstore.InMemoryKeyValueStorage; @@ -26,7 +25,7 @@ import org.apache.tuweni.units.bigints.UInt256; import org.junit.jupiter.api.Test; -public class KeyValueStorageWorldStateStorageTest { +public class ForestKeyValueStorageWorldStateStorageTest { @Test public void getCode_returnsEmpty() { diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/DefaultMutableWorldStateTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/worldview/ForestMutableWorldStateTest.java similarity index 99% rename from ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/DefaultMutableWorldStateTest.java rename to ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/worldview/ForestMutableWorldStateTest.java index 2406edb3533..e2122267b5b 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/DefaultMutableWorldStateTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/forest/worldview/ForestMutableWorldStateTest.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.besu.ethereum.worldstate; +package org.hyperledger.besu.ethereum.forest.worldview; import static org.assertj.core.api.Assertions.assertThat; import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryWorldState; @@ -22,7 +22,6 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.forest.storage.ForestWorldStateKeyValueStorage; -import org.hyperledger.besu.ethereum.forest.worldview.ForestMutableWorldState; import org.hyperledger.besu.ethereum.storage.keyvalue.WorldStatePreimageKeyValueStorage; import org.hyperledger.besu.ethereum.trie.MerkleTrie; import org.hyperledger.besu.evm.account.AccountStorageEntry; @@ -48,7 +47,7 @@ // TODO: make that an abstract mutable world state test, and create sub-class for all world state // implementations. -class DefaultMutableWorldStateTest { +class ForestMutableWorldStateTest { // The following test cases are loosely derived from the testTransactionToItself // GeneralStateReferenceTest.