Skip to content

Commit

Permalink
move tests
Browse files Browse the repository at this point in the history
Signed-off-by: Karim Taam <[email protected]>
  • Loading branch information
matkt committed Dec 13, 2023
1 parent 2735576 commit 8f389bd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -49,7 +50,8 @@ public class Pruner {
private final AtomicReference<State> state = new AtomicReference<>(State.IDLE);
private final ExecutorService executorService;

public Pruner(
@VisibleForTesting
Pruner(
final MarkSweepPruner pruningStrategy,
final Blockchain blockchain,
final PrunerConfiguration prunerConfiguration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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.

Expand Down

0 comments on commit 8f389bd

Please sign in to comment.