Enable json rpc tests for bonsai trie (#2090)

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
pull/2099/head
matkt 4 years ago committed by GitHub
parent 52b52ae597
commit c7e72434b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java
  2. 7
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpBySpecTest.java
  3. 24
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java
  4. 45
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/bonsai/DebugJsonRpcHttpBySpecTest.java
  5. 50
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/bonsai/EthByzantiumJsonRpcHttpBySpecTest.java
  6. 43
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/bonsai/EthJsonRpcHttpBySpecTest.java
  7. 59
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/bonsai/TraceJsonRpcHttpBySpecTest.java
  8. 8
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/forest/DebugJsonRpcHttpBySpecTest.java
  9. 12
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/forest/EthByzantiumJsonRpcHttpBySpecTest.java
  10. 8
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/forest/EthJsonRpcHttpBySpecTest.java
  11. 26
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/forest/TraceJsonRpcHttpBySpecTest.java
  12. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/filter/EthJsonRpcHttpServiceTest.java
  13. 5
      ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/vm/EntriesFromIntegrationTest.java
  14. 7
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockDataGenerator.java
  15. 22
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java
  16. 2
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/InMemoryKeyValueStorageProvider.java
  17. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java
  18. 3
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTestUtil.java
  19. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/ethtaskutils/AbstractMessageTaskTest.java
  20. 5
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/BlockPropagationManagerTest.java
  21. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java
  22. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/CheckpointHeaderFetcherTest.java
  23. 3
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/DownloadHeadersStepTest.java
  24. 3
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/DownloadReceiptsStepTest.java
  25. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java
  26. 9
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncChainDownloaderTest.java
  27. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/PivotBlockConfirmerTest.java
  28. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/PivotBlockRetrieverTest.java
  29. 5
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fullsync/FullSyncChainDownloaderTest.java
  30. 3
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fullsync/FullSyncDownloaderTest.java
  31. 7
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fullsync/FullSyncTargetManagerTest.java
  32. 3
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/tasks/PersistBlockTaskTest.java
  33. 5
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BlockchainReferenceTestCaseSpec.java

@ -14,6 +14,8 @@
*/
package org.hyperledger.besu.ethereum.api.graphql;
import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
@ -145,8 +147,7 @@ public abstract class AbstractEthGraphQLHttpServiceTest {
true,
Instant.ofEpochSecond(Integer.MAX_VALUE))));
final WorldStateArchive stateArchive =
InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive();
final WorldStateArchive stateArchive = createInMemoryWorldStateArchive();
GENESIS_CONFIG.writeStateTo(stateArchive.getMutable());
final MutableBlockchain blockchain =

@ -27,6 +27,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
@ -51,7 +52,7 @@ public abstract class AbstractJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpS
private static final ObjectMapper objectMapper = new ObjectMapper();
private final URL specURL;
AbstractJsonRpcHttpBySpecTest(final String specName, final URL specURL) {
protected AbstractJsonRpcHttpBySpecTest(final String specName, final URL specURL) {
this.specURL = specURL;
}
@ -68,7 +69,8 @@ public abstract class AbstractJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpS
* @return Parameters for this test which will contain the name of the test and the url of the
* spec file to run.
*/
static Object[][] findSpecFiles(final String... subDirectoryPaths) {
public static Object[][] findSpecFiles(
final String[] subDirectoryPaths, final String... exceptions) {
final List<Object[]> specFiles = new ArrayList<>();
for (final String path : subDirectoryPaths) {
final URL url = AbstractJsonRpcHttpBySpecTest.class.getResource(path);
@ -83,6 +85,7 @@ public abstract class AbstractJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpS
s.map(Path::toFile)
.filter(f -> f.getPath().endsWith(".json"))
.filter(f -> !f.getPath().contains("genesis"))
.filter(f -> Arrays.stream(exceptions).noneMatch(f.getPath()::contains))
.map(AbstractJsonRpcHttpBySpecTest::fileToParams)
.forEach(specFiles::add);
} catch (final IOException e) {

@ -43,6 +43,7 @@ import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -83,22 +84,28 @@ public abstract class AbstractJsonRpcHttpServiceTest {
protected final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
protected FilterManager filterManager;
private void setupBlockchain() {
blockchainSetupUtil = getBlockchainSetupUtil();
protected void setupBlockchain() {
blockchainSetupUtil = getBlockchainSetupUtil(DataStorageFormat.FOREST);
blockchainSetupUtil.importAllBlocks();
}
protected BlockchainSetupUtil getBlockchainSetupUtil() {
return BlockchainSetupUtil.forTesting();
protected void setupBonsaiBlockchain() {
blockchainSetupUtil = getBlockchainSetupUtil(DataStorageFormat.BONSAI);
blockchainSetupUtil.importAllBlocks();
}
protected BlockchainSetupUtil getBlockchainSetupUtil(final DataStorageFormat storageFormat) {
return BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
}
protected BlockchainSetupUtil createBlockchainSetupUtil(
final String genesisPath, final String blocksPath) {
final String genesisPath, final String blocksPath, final DataStorageFormat storageFormat) {
final URL genesisURL = AbstractJsonRpcHttpServiceTest.class.getResource(genesisPath);
final URL blocksURL = AbstractJsonRpcHttpServiceTest.class.getResource(blocksPath);
checkArgument(genesisURL != null, "Unable to locate genesis file: " + genesisPath);
checkArgument(blocksURL != null, "Unable to locate blocks file: " + blocksPath);
return BlockchainSetupUtil.createForEthashChain(new ChainResources(genesisURL, blocksURL));
return BlockchainSetupUtil.createForEthashChain(
new ChainResources(genesisURL, blocksURL), storageFormat);
}
@Before
@ -106,8 +113,9 @@ public abstract class AbstractJsonRpcHttpServiceTest {
setupBlockchain();
}
protected BlockchainSetupUtil startServiceWithEmptyChain() throws Exception {
final BlockchainSetupUtil emptySetupUtil = getBlockchainSetupUtil();
protected BlockchainSetupUtil startServiceWithEmptyChain(final DataStorageFormat storageFormat)
throws Exception {
final BlockchainSetupUtil emptySetupUtil = getBlockchainSetupUtil(storageFormat);
startService(emptySetupUtil);
return emptySetupUtil;
}

@ -0,0 +1,45 @@
/*
* Copyright ConsenSys AG.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.bonsai;
import org.hyperledger.besu.ethereum.api.jsonrpc.AbstractJsonRpcHttpBySpecTest;
import java.net.URL;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class DebugJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpBySpecTest {
public DebugJsonRpcHttpBySpecTest(final String specName, final URL specURL) {
super(specName, specURL);
}
@Override
public void setup() throws Exception {
setupBonsaiBlockchain();
startService();
}
@Parameters(name = "{index}: {0}")
public static Object[][] specs() {
return findSpecFiles(
new String[] {"debug"},
"storageRange",
"accountRange"); // storageRange and accountRange are not working with bonsai trie
}
}

@ -0,0 +1,50 @@
/*
* Copyright ConsenSys AG.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.bonsai;
import org.hyperledger.besu.ethereum.api.jsonrpc.AbstractJsonRpcHttpBySpecTest;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import java.net.URL;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class EthByzantiumJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpBySpecTest {
public EthByzantiumJsonRpcHttpBySpecTest(final String specName, final URL specURL) {
super(specName, specURL);
}
@Override
public void setup() throws Exception {
setupBonsaiBlockchain();
startService();
}
@Override
protected BlockchainSetupUtil getBlockchainSetupUtil(final DataStorageFormat dataStorageFormat) {
return createBlockchainSetupUtil(
"trace/chain-data/genesis.json", "trace/chain-data/blocks.bin", dataStorageFormat);
}
@Parameters(name = "{index}: {0}")
public static Object[][] specs() {
return AbstractJsonRpcHttpBySpecTest.findSpecFiles(new String[] {"eth_latest"});
}
}

@ -0,0 +1,43 @@
/*
* Copyright ConsenSys AG.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.bonsai;
import org.hyperledger.besu.ethereum.api.jsonrpc.AbstractJsonRpcHttpBySpecTest;
import java.net.URL;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class EthJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpBySpecTest {
public EthJsonRpcHttpBySpecTest(final String specName, final URL specURL) {
super(specName, specURL);
}
@Override
public void setup() throws Exception {
setupBonsaiBlockchain();
startService();
}
@Parameters(name = "{index}: {0}")
public static Object[][] specs() {
return findSpecFiles(
new String[] {"eth"}, "getProof"); // getProof is not working with bonsai trie
}
}

@ -0,0 +1,59 @@
/*
* Copyright ConsenSys AG.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.bonsai;
import org.hyperledger.besu.ethereum.api.jsonrpc.AbstractJsonRpcHttpBySpecTest;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import java.net.URL;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class TraceJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpBySpecTest {
public TraceJsonRpcHttpBySpecTest(final String specName, final URL specURL) {
super(specName, specURL);
}
@Override
public void setup() throws Exception {
setupBonsaiBlockchain();
startService();
}
@Override
protected BlockchainSetupUtil getBlockchainSetupUtil(final DataStorageFormat storageFormat) {
return createBlockchainSetupUtil(
"trace/chain-data/genesis.json", "trace/chain-data/blocks.bin", storageFormat);
}
@Parameters(name = "{index}: {0}")
public static Object[][] specs() {
return AbstractJsonRpcHttpBySpecTest.findSpecFiles(
new String[] {
"trace/specs/trace-block",
"trace/specs/trace-transaction",
"trace/specs/replay-trace-transaction/flat",
"trace/specs/replay-trace-transaction/vm-trace",
"trace/specs/replay-trace-transaction/statediff",
"trace/specs/replay-trace-transaction/all",
"trace/specs/replay-trace-transaction/halt-cases"
});
}
}

@ -12,7 +12,9 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc;
package org.hyperledger.besu.ethereum.api.jsonrpc.forest;
import org.hyperledger.besu.ethereum.api.jsonrpc.AbstractJsonRpcHttpBySpecTest;
import java.net.URL;
@ -29,12 +31,12 @@ public class DebugJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpBySpecTest {
@Override
public void setup() throws Exception {
super.setup();
setupBlockchain();
startService();
}
@Parameters(name = "{index}: {0}")
public static Object[][] specs() {
return findSpecFiles("debug");
return findSpecFiles(new String[] {"debug"});
}
}

@ -12,9 +12,11 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc;
package org.hyperledger.besu.ethereum.api.jsonrpc.forest;
import org.hyperledger.besu.ethereum.api.jsonrpc.AbstractJsonRpcHttpBySpecTest;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import java.net.URL;
@ -31,18 +33,18 @@ public class EthByzantiumJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpBySpec
@Override
public void setup() throws Exception {
super.setup();
setupBlockchain();
startService();
}
@Override
protected BlockchainSetupUtil getBlockchainSetupUtil() {
protected BlockchainSetupUtil getBlockchainSetupUtil(final DataStorageFormat storageFormat) {
return createBlockchainSetupUtil(
"trace/chain-data/genesis.json", "trace/chain-data/blocks.bin");
"trace/chain-data/genesis.json", "trace/chain-data/blocks.bin", storageFormat);
}
@Parameters(name = "{index}: {0}")
public static Object[][] specs() {
return AbstractJsonRpcHttpBySpecTest.findSpecFiles("eth_latest");
return AbstractJsonRpcHttpBySpecTest.findSpecFiles(new String[] {"eth_latest"});
}
}

@ -12,7 +12,9 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc;
package org.hyperledger.besu.ethereum.api.jsonrpc.forest;
import org.hyperledger.besu.ethereum.api.jsonrpc.AbstractJsonRpcHttpBySpecTest;
import java.net.URL;
@ -29,12 +31,12 @@ public class EthJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpBySpecTest {
@Override
public void setup() throws Exception {
super.setup();
setupBlockchain();
startService();
}
@Parameters(name = "{index}: {0}")
public static Object[][] specs() {
return findSpecFiles("eth");
return findSpecFiles(new String[] {"eth"});
}
}

@ -12,9 +12,11 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc;
package org.hyperledger.besu.ethereum.api.jsonrpc.forest;
import org.hyperledger.besu.ethereum.api.jsonrpc.AbstractJsonRpcHttpBySpecTest;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import java.net.URL;
@ -31,25 +33,27 @@ public class TraceJsonRpcHttpBySpecTest extends AbstractJsonRpcHttpBySpecTest {
@Override
public void setup() throws Exception {
super.setup();
setupBlockchain();
startService();
}
@Override
protected BlockchainSetupUtil getBlockchainSetupUtil() {
protected BlockchainSetupUtil getBlockchainSetupUtil(final DataStorageFormat storageFormat) {
return createBlockchainSetupUtil(
"trace/chain-data/genesis.json", "trace/chain-data/blocks.bin");
"trace/chain-data/genesis.json", "trace/chain-data/blocks.bin", storageFormat);
}
@Parameters(name = "{index}: {0}")
public static Object[][] specs() {
return AbstractJsonRpcHttpBySpecTest.findSpecFiles(
"trace/specs/trace-block",
"trace/specs/trace-transaction",
"trace/specs/replay-trace-transaction/flat",
"trace/specs/replay-trace-transaction/vm-trace",
"trace/specs/replay-trace-transaction/statediff",
"trace/specs/replay-trace-transaction/all",
"trace/specs/replay-trace-transaction/halt-cases");
new String[] {
"trace/specs/trace-block",
"trace/specs/trace-transaction",
"trace/specs/replay-trace-transaction/flat",
"trace/specs/replay-trace-transaction/vm-trace",
"trace/specs/replay-trace-transaction/statediff",
"trace/specs/replay-trace-transaction/all",
"trace/specs/replay-trace-transaction/halt-cases"
});
}
}

@ -21,6 +21,7 @@ import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import java.io.IOException;
@ -56,7 +57,7 @@ public class EthJsonRpcHttpServiceTest extends AbstractJsonRpcHttpServiceTest {
@Test
public void getFilterChanges_oneBlock() throws Exception {
BlockchainSetupUtil blockchainSetupUtil = startServiceWithEmptyChain();
BlockchainSetupUtil blockchainSetupUtil = startServiceWithEmptyChain(DataStorageFormat.FOREST);
final String expectedRespBody =
String.format(
"{%n \"jsonrpc\" : \"2.0\",%n \"id\" : 2,%n \"result\" : [ \"0x10aaf14a53caf27552325374429d3558398a36d3682ede6603c2c6511896e9f9\" ]%n}");

@ -15,11 +15,11 @@
package org.hyperledger.besu.ethereum.vm;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive;
import org.hyperledger.besu.ethereum.core.AccountStorageEntry;
import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider;
import org.hyperledger.besu.ethereum.core.MutableAccount;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.WorldUpdater;
@ -37,8 +37,7 @@ public class EntriesFromIntegrationTest {
@Test
@SuppressWarnings("MathAbsoluteRandom")
public void shouldCollectStateEntries() {
final MutableWorldState worldState =
InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive().getMutable();
final MutableWorldState worldState = createInMemoryWorldStateArchive().getMutable();
final WorldUpdater updater = worldState.updater();
MutableAccount account = updater.getOrCreate(Address.fromHexString("0x56")).getMutable();
final Map<Bytes32, AccountStorageEntry> expectedValues = new TreeMap<>();

@ -17,6 +17,7 @@ package org.hyperledger.besu.ethereum.core;
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.stream.Collectors.toUnmodifiableList;
import static java.util.stream.Collectors.toUnmodifiableSet;
import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive;
import org.hyperledger.besu.crypto.KeyPair;
import org.hyperledger.besu.crypto.SecureRandomProvider;
@ -193,14 +194,12 @@ public class BlockDataGenerator {
}
public List<Block> blockSequence(final int count) {
final WorldStateArchive worldState =
InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive();
final WorldStateArchive worldState = createInMemoryWorldStateArchive();
return blockSequence(count, worldState, Collections.emptyList(), Collections.emptyList());
}
public List<Block> blockSequence(final Block previousBlock, final int count) {
final WorldStateArchive worldState =
InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive();
final WorldStateArchive worldState = createInMemoryWorldStateArchive();
final Hash parentHash = previousBlock.getHeader().getHash();
final long blockNumber = previousBlock.getHeader().getNumber() + 1;
return blockSequence(

@ -15,6 +15,7 @@
package org.hyperledger.besu.ethereum.core;
import static org.assertj.core.util.Preconditions.checkArgument;
import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createBonsaiInMemoryWorldStateArchive;
import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryBlockchain;
import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive;
import static org.mockito.Mockito.mock;
@ -32,6 +33,7 @@ import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.util.RawBlockIterator;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.testutil.BlockTestUtil;
@ -104,25 +106,27 @@ public class BlockchainSetupUtil {
return blocks.size();
}
public static BlockchainSetupUtil forTesting() {
return createForEthashChain(BlockTestUtil.getTestChainResources());
public static BlockchainSetupUtil forTesting(final DataStorageFormat storageFormat) {
return createForEthashChain(BlockTestUtil.getTestChainResources(), storageFormat);
}
public static BlockchainSetupUtil forMainnet() {
return createForEthashChain(BlockTestUtil.getMainnetResources());
return createForEthashChain(BlockTestUtil.getMainnetResources(), DataStorageFormat.FOREST);
}
public static BlockchainSetupUtil forOutdatedFork() {
return createForEthashChain(BlockTestUtil.getOutdatedForkResources());
return createForEthashChain(BlockTestUtil.getOutdatedForkResources(), DataStorageFormat.FOREST);
}
public static BlockchainSetupUtil forUpgradedFork() {
return createForEthashChain(BlockTestUtil.getUpgradedForkResources());
return createForEthashChain(BlockTestUtil.getUpgradedForkResources(), DataStorageFormat.FOREST);
}
public static BlockchainSetupUtil createForEthashChain(final ChainResources chainResources) {
public static BlockchainSetupUtil createForEthashChain(
final ChainResources chainResources, final DataStorageFormat storageFormat) {
return create(
chainResources,
storageFormat,
BlockchainSetupUtil::mainnetProtocolScheduleProvider,
BlockchainSetupUtil::mainnetProtocolContextProvider,
new EthScheduler(1, 1, 1, 1, new NoOpMetricsSystem()));
@ -140,6 +144,7 @@ public class BlockchainSetupUtil {
private static BlockchainSetupUtil create(
final ChainResources chainResources,
final DataStorageFormat storageFormat,
final ProtocolScheduleProvider protocolScheduleProvider,
final ProtocolContextProvider protocolContextProvider,
final EthScheduler scheduler) {
@ -153,7 +158,10 @@ public class BlockchainSetupUtil {
final GenesisState genesisState = GenesisState.fromJson(genesisJson, protocolSchedule);
final MutableBlockchain blockchain = createInMemoryBlockchain(genesisState.getBlock());
final WorldStateArchive worldArchive = createInMemoryWorldStateArchive();
final WorldStateArchive worldArchive =
storageFormat == DataStorageFormat.BONSAI
? createBonsaiInMemoryWorldStateArchive(blockchain)
: createInMemoryWorldStateArchive();
final TransactionPool transactionPool = mock(TransactionPool.class);
genesisState.writeStateTo(worldArchive.getMutable());

@ -61,7 +61,7 @@ public class InMemoryKeyValueStorageProvider extends KeyValueStorageProvider {
new WorldStatePreimageKeyValueStorage(new InMemoryKeyValueStorage()));
}
public static BonsaiWorldStateArchive createInMemoryWorldStateArchive(
public static BonsaiWorldStateArchive createBonsaiInMemoryWorldStateArchive(
final Blockchain blockchain) {
return new BonsaiWorldStateArchive(new InMemoryKeyValueStorageProvider(), blockchain);
}

@ -63,6 +63,7 @@ import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.DefaultMessage;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.RawMessage;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
@ -105,7 +106,8 @@ public final class EthProtocolManagerTest {
@BeforeClass
public static void setup() {
gen = new BlockDataGenerator(0);
final BlockchainSetupUtil blockchainSetupUtil = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil blockchainSetupUtil =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
blockchainSetupUtil.importAllBlocks();
blockchain = blockchainSetupUtil.getBlockchain();
transactionPool = blockchainSetupUtil.getTransactionPool();

@ -33,6 +33,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.DefaultMessage;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.testutil.TestClock;
@ -135,7 +136,7 @@ public class EthProtocolManagerTestUtil {
return create(
blockchain,
ethScheduler,
BlockchainSetupUtil.forTesting().getWorldArchive(),
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST).getWorldArchive(),
mock(TransactionPool.class),
EthProtocolConfiguration.defaultConfig(),
peers,

@ -38,6 +38,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolFactory;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
import org.hyperledger.besu.testutil.TestClock;
@ -70,7 +71,8 @@ public abstract class AbstractMessageTaskTest<T, R> {
@BeforeClass
public static void setup() {
final BlockchainSetupUtil blockchainSetupUtil = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil blockchainSetupUtil =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
blockchainSetupUtil.importAllBlocks();
blockchain = blockchainSetupUtil.getBlockchain();
protocolSchedule = blockchainSetupUtil.getProtocolSchedule();

@ -51,6 +51,7 @@ import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
import org.hyperledger.besu.testutil.TestClock;
@ -88,12 +89,12 @@ public class BlockPropagationManagerTest {
@BeforeClass
public static void setupSuite() {
fullBlockchain = BlockchainSetupUtil.forTesting().importAllBlocks();
fullBlockchain = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST).importAllBlocks();
}
@Before
public void setup() {
blockchainUtil = BlockchainSetupUtil.forTesting();
blockchainUtil = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
blockchain = blockchainUtil.getBlockchain();
protocolSchedule = blockchainUtil.getProtocolSchedule();
final ProtocolContext tempProtocolContext = blockchainUtil.getProtocolContext();

@ -28,6 +28,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManagerTestUtil;
import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer.Responder;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.assertj.core.api.Assertions;
@ -35,7 +36,8 @@ import org.junit.Test;
public class ChainHeadTrackerTest {
private final BlockchainSetupUtil blockchainSetupUtil = BlockchainSetupUtil.forTesting();
private final BlockchainSetupUtil blockchainSetupUtil =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
private final MutableBlockchain blockchain = blockchainSetupUtil.getBlockchain();
private final EthProtocolManager ethProtocolManager =
EthProtocolManagerTestUtil.create(blockchain);

@ -31,6 +31,7 @@ import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer.Responder;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
@ -59,7 +60,8 @@ public class CheckpointHeaderFetcherTest {
@BeforeClass
public static void setUpClass() {
final BlockchainSetupUtil blockchainSetupUtil = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil blockchainSetupUtil =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
blockchainSetupUtil.importAllBlocks();
blockchain = blockchainSetupUtil.getBlockchain();
transactionPool = blockchainSetupUtil.getTransactionPool();

@ -28,6 +28,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManagerTestUtil;
import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import java.util.ArrayList;
@ -53,7 +54,7 @@ public class DownloadHeadersStepTest {
@BeforeClass
public static void setUpClass() {
final BlockchainSetupUtil setupUtil = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil setupUtil = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
setupUtil.importFirstBlocks(20);
protocolSchedule = setupUtil.getProtocolSchedule();
protocolContext = setupUtil.getProtocolContext();

@ -30,6 +30,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager;
import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManagerTestUtil;
import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import java.util.List;
@ -49,7 +50,7 @@ public class DownloadReceiptsStepTest {
@BeforeClass
public static void setUpClass() {
final BlockchainSetupUtil setupUtil = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil setupUtil = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
setupUtil.importFirstBlocks(20);
protocolContext = setupUtil.getProtocolContext();
blockchain = setupUtil.getBlockchain();

@ -37,6 +37,7 @@ import org.hyperledger.besu.ethereum.eth.sync.SyncMode;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import java.util.ArrayList;
@ -50,7 +51,8 @@ import org.junit.Test;
public class FastSyncActionsTest {
private final BlockchainSetupUtil blockchainSetupUtil = BlockchainSetupUtil.forTesting();
private final BlockchainSetupUtil blockchainSetupUtil =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
private final SynchronizerConfiguration.Builder syncConfigBuilder =
new SynchronizerConfiguration.Builder().syncMode(SyncMode.FAST).fastSyncPivotDistance(1000);

@ -35,6 +35,7 @@ import org.hyperledger.besu.ethereum.eth.sync.ChainDownloader;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import java.util.concurrent.CompletableFuture;
@ -61,9 +62,10 @@ public class FastSyncChainDownloaderTest {
@Before
public void setup() {
when(validationPolicy.getValidationModeForNextBlock()).thenReturn(LIGHT_SKIP_DETACHED);
final BlockchainSetupUtil localBlockchainSetup = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil localBlockchainSetup =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
localBlockchain = localBlockchainSetup.getBlockchain();
otherBlockchainSetup = BlockchainSetupUtil.forTesting();
otherBlockchainSetup = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
otherBlockchain = otherBlockchainSetup.getBlockchain();
protocolSchedule = localBlockchainSetup.getProtocolSchedule();
@ -143,7 +145,8 @@ public class FastSyncChainDownloaderTest {
@Test
public void recoversFromSyncTargetDisconnect() {
final BlockchainSetupUtil shorterChainUtil = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil shorterChainUtil =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
final MutableBlockchain shorterChain = shorterChainUtil.getBlockchain();
otherBlockchainSetup.importFirstBlocks(30);

@ -32,6 +32,7 @@ import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer.Responder;
import org.hyperledger.besu.ethereum.eth.sync.fastsync.PivotBlockConfirmer.ContestedPivotBlockException;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
@ -59,7 +60,8 @@ public class PivotBlockConfirmerTest {
@Before
public void setUp() {
final BlockchainSetupUtil blockchainSetupUtil = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil blockchainSetupUtil =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
blockchainSetupUtil.importAllBlocks();
blockchain = blockchainSetupUtil.getBlockchain();
transactionPool = blockchainSetupUtil.getTransactionPool();

@ -34,6 +34,7 @@ import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer.Responder;
import org.hyperledger.besu.ethereum.eth.peervalidation.PeerValidator;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
import org.hyperledger.besu.util.ExceptionUtils;
@ -62,7 +63,8 @@ public class PivotBlockRetrieverTest {
@Before
public void setUp() {
final BlockchainSetupUtil blockchainSetupUtil = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil blockchainSetupUtil =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
blockchainSetupUtil.importAllBlocks();
blockchain = blockchainSetupUtil.getBlockchain();
protocolSchedule = blockchainSetupUtil.getProtocolSchedule();

@ -42,6 +42,7 @@ import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.messages.DisconnectMessage.DisconnectReason;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
@ -74,9 +75,9 @@ public class FullSyncChainDownloaderTest {
@Before
public void setupTest() {
gen = new BlockDataGenerator();
localBlockchainSetup = BlockchainSetupUtil.forTesting();
localBlockchainSetup = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
localBlockchain = localBlockchainSetup.getBlockchain();
otherBlockchainSetup = BlockchainSetupUtil.forTesting();
otherBlockchainSetup = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
otherBlockchain = otherBlockchainSetup.getBlockchain();
protocolSchedule = localBlockchainSetup.getProtocolSchedule();

@ -29,6 +29,7 @@ import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.TrailingPeerRequirements;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
@ -50,7 +51,7 @@ public class FullSyncDownloaderTest {
@Before
public void setupTest() {
localBlockchainSetup = BlockchainSetupUtil.forTesting();
localBlockchainSetup = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
localBlockchain = localBlockchainSetup.getBlockchain();
protocolSchedule = localBlockchainSetup.getProtocolSchedule();

@ -34,6 +34,7 @@ import org.hyperledger.besu.ethereum.eth.manager.RespondingEthPeer;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncTarget;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
@ -55,11 +56,13 @@ public class FullSyncTargetManagerTest {
@Before
public void setup() {
final BlockchainSetupUtil otherBlockchainSetup = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil otherBlockchainSetup =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
final Blockchain otherBlockchain = otherBlockchainSetup.getBlockchain();
responder = RespondingEthPeer.blockchainResponder(otherBlockchain);
final BlockchainSetupUtil localBlockchainSetup = BlockchainSetupUtil.forTesting();
final BlockchainSetupUtil localBlockchainSetup =
BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
localBlockchain = localBlockchainSetup.getBlockchain();
final ProtocolSchedule protocolSchedule = ProtocolScheduleFixture.MAINNET;

@ -29,6 +29,7 @@ import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManagerTestUtil;
import org.hyperledger.besu.ethereum.eth.sync.tasks.exceptions.InvalidBlockException;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.MetricsSystem;
@ -53,7 +54,7 @@ public class PersistBlockTaskTest {
@Before
public void setup() {
blockchainUtil = BlockchainSetupUtil.forTesting();
blockchainUtil = BlockchainSetupUtil.forTesting(DataStorageFormat.FOREST);
protocolSchedule = blockchainUtil.getProtocolSchedule();
protocolContext = blockchainUtil.getProtocolContext();
blockchain = blockchainUtil.getBlockchain();

@ -15,6 +15,8 @@
*/
package org.hyperledger.besu.ethereum.referencetests;
import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.Address;
@ -62,8 +64,7 @@ public class BlockchainReferenceTestCaseSpec {
private static WorldStateArchive buildWorldStateArchive(
final Map<String, ReferenceTestWorldState.AccountMock> accounts) {
final WorldStateArchive worldStateArchive =
InMemoryKeyValueStorageProvider.createInMemoryWorldStateArchive();
final WorldStateArchive worldStateArchive = createInMemoryWorldStateArchive();
final MutableWorldState worldState = worldStateArchive.getMutable();
final WorldUpdater updater = worldState.updater();

Loading…
Cancel
Save