Ensure that Bonsai tests with Key Value storage are using Bonsai data configuration (#6441)

Signed-off-by: Jason Frame <jason.frame@consensys.net>
pull/6539/head
Jason Frame 9 months ago committed by GitHub
parent 290cb42bab
commit c45a863280
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
  2. 4
      besu/src/test/java/org/hyperledger/besu/cli/subcommands/storage/TrieLogHelperTest.java
  3. 11
      besu/src/test/java/org/hyperledger/besu/controller/BesuControllerBuilderTest.java
  4. 24
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/GenesisState.java
  5. 9
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/common/GenesisWorldStateProvider.java
  6. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DataStorageConfiguration.java
  7. 13
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/InMemoryKeyValueStorageProvider.java
  8. 2
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/BlockImportExceptionHandlingTest.java
  9. 49
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/chain/GenesisStateTest.java
  10. 9
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/AbstractIsolationTests.java
  11. 26
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/BonsaiWorldStateArchiveTest.java
  12. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/CachedMerkleTrieLoaderTest.java
  13. 18
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/LogRollingTests.java
  14. 2
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/RollingImport.java
  15. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/bonsai/storage/BonsaiWorldStateKeyValueStorageTest.java
  16. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/worldstate/FastWorldDownloadStateTest.java
  17. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/AccountHealingTrackingTest.java
  18. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/SnapWorldDownloadStateTest.java
  19. 8
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/AccountFlatDatabaseHealingRangeRequestTest.java
  20. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageFlatDatabaseHealingRangeRequestTest.java
  21. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/request/heal/StorageTrieNodeHealingRequestTest.java
  22. 2
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BonsaiReferenceTestWorldState.java

@ -580,8 +580,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
final ProtocolSchedule protocolSchedule = createProtocolSchedule();
final GenesisState genesisState =
GenesisState.fromConfig(
dataStorageConfiguration.getDataStorageFormat(), genesisConfig, protocolSchedule);
GenesisState.fromConfig(dataStorageConfiguration, genesisConfig, protocolSchedule);
final VariablesStorage variablesStorage = storageProvider.createVariablesStorage();

@ -87,7 +87,9 @@ class TrieLogHelperTest {
inMemoryWorldState =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
createTrieLog(blockHeader1);

@ -166,11 +166,6 @@ public class BesuControllerBuilderTest {
@Test
public void shouldDisablePruningIfBonsaiIsEnabled() {
DataStorageConfiguration dataStorageConfiguration =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.BONSAI)
.bonsaiMaxLayersToLoad(DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.build();
BonsaiWorldState mockWorldState = mock(BonsaiWorldState.class, Answers.RETURNS_DEEP_STUBS);
doReturn(worldStateArchive)
.when(besuControllerBuilder)
@ -178,9 +173,11 @@ public class BesuControllerBuilderTest {
any(WorldStateStorage.class), any(Blockchain.class), any(CachedMerkleTrieLoader.class));
doReturn(mockWorldState).when(worldStateArchive).getMutable();
when(storageProvider.createWorldStateStorage(dataStorageConfiguration))
when(storageProvider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG))
.thenReturn(bonsaiWorldStateStorage);
besuControllerBuilder.isPruningEnabled(true).dataStorageConfiguration(dataStorageConfiguration);
besuControllerBuilder
.isPruningEnabled(true)
.dataStorageConfiguration(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
besuControllerBuilder.build();
verify(storageProvider, never())

@ -33,7 +33,7 @@ import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.log.LogsBloomFilter;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
@ -77,16 +77,18 @@ public final class GenesisState {
/**
* Construct a {@link GenesisState} from a JSON string.
*
* @param dataStorageFormat A {@link DataStorageFormat} describing the storage format to use
* @param dataStorageConfiguration A {@link DataStorageConfiguration} describing the storage
* configuration
* @param json A JSON string describing the genesis block
* @param protocolSchedule A protocol Schedule associated with
* @return A new {@link GenesisState}.
*/
public static GenesisState fromJson(
final DataStorageFormat dataStorageFormat,
final DataStorageConfiguration dataStorageConfiguration,
final String json,
final ProtocolSchedule protocolSchedule) {
return fromConfig(dataStorageFormat, GenesisConfigFile.fromConfig(json), protocolSchedule);
return fromConfig(
dataStorageConfiguration, GenesisConfigFile.fromConfig(json), protocolSchedule);
}
/**
@ -98,19 +100,20 @@ public final class GenesisState {
*/
public static GenesisState fromConfig(
final GenesisConfigFile config, final ProtocolSchedule protocolSchedule) {
return fromConfig(DataStorageFormat.FOREST, config, protocolSchedule);
return fromConfig(DataStorageConfiguration.DEFAULT_CONFIG, config, protocolSchedule);
}
/**
* Construct a {@link GenesisState} from a JSON object.
*
* @param dataStorageFormat A {@link DataStorageFormat} describing the storage format to use
* @param dataStorageConfiguration A {@link DataStorageConfiguration} describing the storage
* configuration
* @param config A {@link GenesisConfigFile} describing the genesis block.
* @param protocolSchedule A protocol Schedule associated with
* @return A new {@link GenesisState}.
*/
public static GenesisState fromConfig(
final DataStorageFormat dataStorageFormat,
final DataStorageConfiguration dataStorageConfiguration,
final GenesisConfigFile config,
final ProtocolSchedule protocolSchedule) {
final List<GenesisAccount> genesisAccounts = parseAllocations(config).toList();
@ -118,7 +121,7 @@ public final class GenesisState {
new Block(
buildHeader(
config,
calculateGenesisStateHash(dataStorageFormat, genesisAccounts),
calculateGenesisStateHash(dataStorageConfiguration, genesisAccounts),
protocolSchedule),
buildBody(config));
return new GenesisState(block, genesisAccounts);
@ -164,8 +167,9 @@ public final class GenesisState {
}
private static Hash calculateGenesisStateHash(
final DataStorageFormat dataStorageFormat, final List<GenesisAccount> genesisAccounts) {
try (var worldState = createGenesisWorldState(dataStorageFormat)) {
final DataStorageConfiguration dataStorageConfiguration,
final List<GenesisAccount> genesisAccounts) {
try (var worldState = createGenesisWorldState(dataStorageConfiguration)) {
writeAccountsTo(worldState, genesisAccounts, null);
return worldState.rootHash();
} catch (Exception e) {

@ -40,12 +40,13 @@ public class GenesisWorldStateProvider {
/**
* Creates a Genesis world state based on the provided data storage format.
*
* @param dataStorageFormat the data storage format to use
* @param dataStorageConfiguration the data storage configuration to use
* @return a mutable world state for the Genesis block
*/
public static MutableWorldState createGenesisWorldState(
final DataStorageFormat dataStorageFormat) {
if (Objects.requireNonNull(dataStorageFormat) == DataStorageFormat.BONSAI) {
final DataStorageConfiguration dataStorageConfiguration) {
if (Objects.requireNonNull(dataStorageConfiguration).getDataStorageFormat()
== DataStorageFormat.BONSAI) {
return createGenesisBonsaiWorldState();
} else {
return createGenesisForestWorldState();
@ -67,7 +68,7 @@ public class GenesisWorldStateProvider {
new InMemoryKeyValueStorage(),
new NoOpMetricsSystem()),
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_CONFIG);
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
return new BonsaiWorldState(
bonsaiWorldStateKeyValueStorage,
cachedMerkleTrieLoader,

@ -31,6 +31,12 @@ public interface DataStorageConfiguration {
.unstable(Unstable.DEFAULT)
.build();
DataStorageConfiguration DEFAULT_BONSAI_CONFIG =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.BONSAI)
.bonsaiMaxLayersToLoad(DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.build();
DataStorageFormat getDataStorageFormat();
Long getBonsaiMaxLayersToLoad();

@ -14,8 +14,6 @@
*/
package org.hyperledger.besu.ethereum.core;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.chain.DefaultBlockchain;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
@ -34,8 +32,6 @@ import org.hyperledger.besu.ethereum.trie.forest.ForestWorldStateArchive;
import org.hyperledger.besu.ethereum.trie.forest.storage.ForestWorldStateKeyValueStorage;
import org.hyperledger.besu.ethereum.trie.forest.worldview.ForestMutableWorldState;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.services.kvstore.InMemoryKeyValueStorage;
@ -99,15 +95,10 @@ public class InMemoryKeyValueStorageProvider extends KeyValueStorageProvider {
new InMemoryKeyValueStorageProvider();
final CachedMerkleTrieLoader cachedMerkleTrieLoader =
new CachedMerkleTrieLoader(new NoOpMetricsSystem());
final DataStorageConfiguration bonsaiDataStorageConfig =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.BONSAI)
.bonsaiMaxLayersToLoad(DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.unstable(DataStorageConfiguration.Unstable.DEFAULT)
.build();
return new BonsaiWorldStateProvider(
(BonsaiWorldStateKeyValueStorage)
inMemoryKeyValueStorageProvider.createWorldStateStorage(bonsaiDataStorageConfig),
inMemoryKeyValueStorageProvider.createWorldStateStorage(
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
blockchain,
Optional.empty(),
cachedMerkleTrieLoader,

@ -82,7 +82,7 @@ class BlockImportExceptionHandlingTest {
private final WorldStateStorage worldStateStorage =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
private final WorldStateArchive worldStateArchive =
// contains a BonsaiWorldState which we need to spy on.

@ -24,7 +24,7 @@ import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.evm.account.Account;
import java.util.stream.Stream;
@ -57,16 +57,18 @@ final class GenesisStateTest {
@Override
public Stream<? extends Arguments> provideArguments(final ExtensionContext context) {
return Stream.of(
Arguments.of(DataStorageFormat.BONSAI), Arguments.of(DataStorageFormat.FOREST));
Arguments.of(DataStorageConfiguration.DEFAULT_CONFIG),
Arguments.of(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG));
}
}
@ParameterizedTest
@ArgumentsSource(GenesisStateTestArguments.class)
void createFromJsonWithAllocs(final DataStorageFormat dataStorageFormat) throws Exception {
public void createFromJsonWithAllocs(final DataStorageConfiguration dataStorageConfiguration)
throws Exception {
final GenesisState genesisState =
GenesisState.fromJson(
dataStorageFormat,
dataStorageConfiguration,
Resources.toString(GenesisStateTest.class.getResource("genesis1.json"), Charsets.UTF_8),
ProtocolScheduleFixture.MAINNET);
final BlockHeader header = genesisState.getBlock().getHeader();
@ -93,10 +95,11 @@ final class GenesisStateTest {
@ParameterizedTest
@ArgumentsSource(GenesisStateTestArguments.class)
void createFromJsonNoAllocs(final DataStorageFormat dataStorageFormat) throws Exception {
void createFromJsonNoAllocs(final DataStorageConfiguration dataStorageConfiguration)
throws Exception {
final GenesisState genesisState =
GenesisState.fromJson(
dataStorageFormat,
dataStorageConfiguration,
Resources.toString(GenesisStateTest.class.getResource("genesis2.json"), Charsets.UTF_8),
ProtocolScheduleFixture.MAINNET);
final BlockHeader header = genesisState.getBlock().getHeader();
@ -109,11 +112,13 @@ final class GenesisStateTest {
}
private void assertContractInvariants(
final DataStorageFormat dataStorageFormat, final String sourceFile, final String blockHash)
final DataStorageConfiguration dataStorageConfiguration,
final String sourceFile,
final String blockHash)
throws Exception {
final GenesisState genesisState =
GenesisState.fromJson(
dataStorageFormat,
dataStorageConfiguration,
Resources.toString(GenesisStateTest.class.getResource(sourceFile), Charsets.UTF_8),
ProtocolScheduleFixture.MAINNET);
final BlockHeader header = genesisState.getBlock().getHeader();
@ -136,19 +141,21 @@ final class GenesisStateTest {
@ParameterizedTest
@ArgumentsSource(GenesisStateTestArguments.class)
void createFromJsonWithContract(final DataStorageFormat dataStorageFormat) throws Exception {
void createFromJsonWithContract(final DataStorageConfiguration dataStorageConfiguration)
throws Exception {
assertContractInvariants(
dataStorageFormat,
dataStorageConfiguration,
"genesis3.json",
"0xe7fd8db206dcaf066b7c97b8a42a0abc18653613560748557ab44868652a78b6");
}
@ParameterizedTest
@ArgumentsSource(GenesisStateTestArguments.class)
void createFromJsonWithNonce(final DataStorageFormat dataStorageFormat) throws Exception {
void createFromJsonWithNonce(final DataStorageConfiguration dataStorageConfiguration)
throws Exception {
final GenesisState genesisState =
GenesisState.fromJson(
dataStorageFormat,
dataStorageConfiguration,
Resources.toString(
GenesisStateTest.class.getResource("genesisNonce.json"), Charsets.UTF_8),
ProtocolScheduleFixture.MAINNET);
@ -161,10 +168,11 @@ final class GenesisStateTest {
@ParameterizedTest
@ArgumentsSource(GenesisStateTestArguments.class)
void encodeOlympicBlock(final DataStorageFormat dataStorageFormat) throws Exception {
void encodeOlympicBlock(final DataStorageConfiguration dataStorageConfiguration)
throws Exception {
final GenesisState genesisState =
GenesisState.fromJson(
dataStorageFormat,
dataStorageConfiguration,
Resources.toString(
GenesisStateTest.class.getResource("genesis-olympic.json"), Charsets.UTF_8),
ProtocolScheduleFixture.MAINNET);
@ -182,10 +190,11 @@ final class GenesisStateTest {
@ParameterizedTest
@ArgumentsSource(GenesisStateTestArguments.class)
void genesisFromShanghai(final DataStorageFormat dataStorageFormat) throws Exception {
void genesisFromShanghai(final DataStorageConfiguration dataStorageConfiguration)
throws Exception {
final GenesisState genesisState =
GenesisState.fromJson(
dataStorageFormat,
dataStorageConfiguration,
Resources.toString(
GenesisStateTest.class.getResource("genesis_shanghai.json"), Charsets.UTF_8),
ProtocolScheduleFixture.MAINNET);
@ -232,10 +241,10 @@ final class GenesisStateTest {
@ParameterizedTest
@ArgumentsSource(GenesisStateTestArguments.class)
void genesisFromCancun(final DataStorageFormat dataStorageFormat) throws Exception {
void genesisFromCancun(final DataStorageConfiguration dataStorageConfiguration) throws Exception {
final GenesisState genesisState =
GenesisState.fromJson(
dataStorageFormat,
dataStorageConfiguration,
Resources.toString(
GenesisStateTest.class.getResource("genesis_cancun.json"), Charsets.UTF_8),
ProtocolScheduleFixture.MAINNET);
@ -282,10 +291,10 @@ final class GenesisStateTest {
@ParameterizedTest
@ArgumentsSource(GenesisStateTestArguments.class)
void genesisFromPrague(final DataStorageFormat dataStorageFormat) throws Exception {
void genesisFromPrague(final DataStorageConfiguration dataStorageConfiguration) throws Exception {
final GenesisState genesisState =
GenesisState.fromJson(
dataStorageFormat,
dataStorageConfiguration,
Resources.toString(
GenesisStateTest.class.getResource("genesis_prague.json"), Charsets.UTF_8),
ProtocolScheduleFixture.MAINNET);

@ -68,8 +68,6 @@ import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBui
import org.hyperledger.besu.ethereum.trie.bonsai.cache.CachedMerkleTrieLoader;
import org.hyperledger.besu.ethereum.trie.bonsai.storage.BonsaiWorldStateKeyValueStorage;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.BesuConfiguration;
@ -149,12 +147,7 @@ public abstract class AbstractIsolationTests {
bonsaiWorldStateStorage =
(BonsaiWorldStateKeyValueStorage)
createKeyValueStorageProvider()
.createWorldStateStorage(
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.BONSAI)
.bonsaiMaxLayersToLoad(
DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.build());
.createWorldStateStorage(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
archive =
new BonsaiWorldStateProvider(
bonsaiWorldStateStorage,

@ -107,7 +107,9 @@ class BonsaiWorldStateArchiveTest {
cachedWorldStorageManager,
trieLogManager,
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
blockchain,
new CachedMerkleTrieLoader(new NoOpMetricsSystem()),
EvmConfiguration.DEFAULT);
@ -121,7 +123,9 @@ class BonsaiWorldStateArchiveTest {
bonsaiWorldStateArchive =
new BonsaiWorldStateProvider(
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
blockchain,
Optional.of(512L),
new CachedMerkleTrieLoader(new NoOpMetricsSystem()),
@ -142,7 +146,9 @@ class BonsaiWorldStateArchiveTest {
cachedWorldStorageManager,
trieLogManager,
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
blockchain,
new CachedMerkleTrieLoader(new NoOpMetricsSystem()),
EvmConfiguration.DEFAULT);
@ -169,7 +175,9 @@ class BonsaiWorldStateArchiveTest {
var worldStateStorage =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
bonsaiWorldStateArchive =
spy(
new BonsaiWorldStateProvider(
@ -196,7 +204,9 @@ class BonsaiWorldStateArchiveTest {
var worldStateStorage =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
bonsaiWorldStateArchive =
spy(
new BonsaiWorldStateProvider(
@ -233,7 +243,9 @@ class BonsaiWorldStateArchiveTest {
var worldStateStorage =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
bonsaiWorldStateArchive =
spy(
@ -283,7 +295,7 @@ class BonsaiWorldStateArchiveTest {
new BonsaiWorldStateKeyValueStorage(
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_CONFIG),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
blockchain,
new CachedMerkleTrieLoader(new NoOpMetricsSystem()),
EvmConfiguration.DEFAULT));

@ -51,7 +51,9 @@ class CachedMerkleTrieLoaderTest {
private final BonsaiWorldStateKeyValueStorage inMemoryWorldState =
Mockito.spy(
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG));
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG));
final List<Address> accounts =
List.of(Address.fromHexString("0xdeadbeef"), Address.fromHexString("0xdeadbeee"));
@ -76,7 +78,7 @@ class CachedMerkleTrieLoaderTest {
new BonsaiWorldStateKeyValueStorage(
new InMemoryKeyValueStorageProvider(),
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_CONFIG);
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
StoredMerklePatriciaTrie<Bytes, Bytes> cachedTrie =
new StoredMerklePatriciaTrie<>(
(location, hash) ->

@ -163,7 +163,7 @@ class LogRollingTests {
new BonsaiWorldState(
archive,
new BonsaiWorldStateKeyValueStorage(
provider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
provider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
EvmConfiguration.DEFAULT);
final WorldUpdater updater = worldState.updater();
@ -177,7 +177,9 @@ class LogRollingTests {
new BonsaiWorldState(
secondArchive,
new BonsaiWorldStateKeyValueStorage(
secondProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
secondProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
EvmConfiguration.DEFAULT);
final BonsaiWorldStateUpdateAccumulator secondUpdater =
(BonsaiWorldStateUpdateAccumulator) secondWorldState.updater();
@ -209,7 +211,7 @@ class LogRollingTests {
new BonsaiWorldState(
archive,
new BonsaiWorldStateKeyValueStorage(
provider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
provider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
EvmConfiguration.DEFAULT);
final WorldUpdater updater = worldState.updater();
@ -231,7 +233,9 @@ class LogRollingTests {
new BonsaiWorldState(
secondArchive,
new BonsaiWorldStateKeyValueStorage(
secondProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
secondProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
EvmConfiguration.DEFAULT);
final BonsaiWorldStateUpdateAccumulator secondUpdater =
(BonsaiWorldStateUpdateAccumulator) secondWorldState.updater();
@ -264,7 +268,7 @@ class LogRollingTests {
new BonsaiWorldState(
archive,
new BonsaiWorldStateKeyValueStorage(
provider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
provider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
EvmConfiguration.DEFAULT);
final WorldUpdater updater = worldState.updater();
@ -293,7 +297,9 @@ class LogRollingTests {
new BonsaiWorldState(
secondArchive,
new BonsaiWorldStateKeyValueStorage(
secondProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
secondProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
EvmConfiguration.DEFAULT);
final WorldUpdater secondUpdater = secondWorldState.updater();

@ -58,7 +58,7 @@ public class RollingImport {
new BonsaiWorldState(
archive,
new BonsaiWorldStateKeyValueStorage(
provider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG),
provider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_BONSAI_CONFIG),
EvmConfiguration.DEFAULT);
final SegmentedInMemoryKeyValueStorage worldStateStorage =
(SegmentedInMemoryKeyValueStorage)

@ -455,7 +455,7 @@ public class BonsaiWorldStateKeyValueStorageTest {
return new BonsaiWorldStateKeyValueStorage(
new InMemoryKeyValueStorageProvider(),
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_CONFIG);
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
}
@Test
@ -491,6 +491,8 @@ public class BonsaiWorldStateKeyValueStorageTest {
when(mockStorageProvider.getStorageBySegmentIdentifiers(any()))
.thenReturn(mock(SegmentedKeyValueStorage.class));
return new BonsaiWorldStateKeyValueStorage(
mockStorageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
mockStorageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
}
}

@ -83,7 +83,7 @@ public class FastWorldDownloadStateTest {
new BonsaiWorldStateKeyValueStorage(
new InMemoryKeyValueStorageProvider(),
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_CONFIG);
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
} else {
worldStateStorage = new ForestWorldStateKeyValueStorage(new InMemoryKeyValueStorage());
}

@ -61,7 +61,7 @@ public class AccountHealingTrackingTest {
new BonsaiWorldStateKeyValueStorage(
new InMemoryKeyValueStorageProvider(),
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_CONFIG);
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
private WorldStateProofProvider worldStateProofProvider;

@ -111,7 +111,7 @@ public class SnapWorldDownloadStateTest {
new BonsaiWorldStateKeyValueStorage(
new InMemoryKeyValueStorageProvider(),
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_CONFIG);
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
} else {
worldStateStorage = new ForestWorldStateKeyValueStorage(new InMemoryKeyValueStorage());
}

@ -181,7 +181,9 @@ public class AccountFlatDatabaseHealingRangeRequestTest {
final WorldStateStorage worldStateStorage =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
final WorldStateProofProvider proofProvider = new WorldStateProofProvider(worldStateStorage);
final MerkleTrie<Bytes, Bytes> accountStateTrie =
TrieGenerator.generateTrie(worldStateStorage, 15);
@ -236,7 +238,9 @@ public class AccountFlatDatabaseHealingRangeRequestTest {
final WorldStateStorage worldStateStorage =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
final WorldStateProofProvider proofProvider = new WorldStateProofProvider(worldStateStorage);
final MerkleTrie<Bytes, Bytes> accountStateTrie =
TrieGenerator.generateTrie(worldStateStorage, 15);

@ -80,7 +80,9 @@ class StorageFlatDatabaseHealingRangeRequestTest {
final StorageProvider storageProvider = new InMemoryKeyValueStorageProvider();
worldStateStorage =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
proofProvider = new WorldStateProofProvider(worldStateStorage);
trie =
TrieGenerator.generateTrie(

@ -76,7 +76,9 @@ class StorageTrieNodeHealingRequestTest {
final StorageProvider storageProvider = new InMemoryKeyValueStorageProvider();
worldStateStorage =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
}
final MerkleTrie<Bytes, Bytes> trie =
TrieGenerator.generateTrie(

@ -217,7 +217,7 @@ public class BonsaiReferenceTestWorldState extends BonsaiWorldState
new BonsaiWorldStateKeyValueStorage(
new InMemoryKeyValueStorageProvider(),
metricsSystem,
DataStorageConfiguration.DEFAULT_CONFIG);
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
final BonsaiReferenceTestWorldStateStorage worldStateStorage =
new BonsaiReferenceTestWorldStateStorage(bonsaiWorldStateKeyValueStorage, preImageProxy);

Loading…
Cancel
Save