Skip to content

Commit

Permalink
Acceptance tests to use bonsai (#6619)
Browse files Browse the repository at this point in the history
* use given config or else default bonsai

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
macfarla authored Feb 28, 2024
1 parent aa38192 commit 647750c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.TLSConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.plugin.services.metrics.MetricCategory;
import org.hyperledger.besu.tests.acceptance.dsl.StaticNodesUtils;
Expand Down Expand Up @@ -114,9 +113,9 @@ public void startNode(final BesuNode node) {

params.addAll(
DataStorageOptions.fromConfig(
ImmutableDataStorageConfiguration.builder()
.from(DataStorageConfiguration.DEFAULT_FOREST_CONFIG)
.build())
node.getDataStorageConfiguration() == null
? DataStorageConfiguration.DEFAULT_BONSAI_CONFIG
: node.getDataStorageConfiguration())
.getCLIOptions());

if (node.getMiningParameters().isMiningEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ public void startNode(final BesuNode node) {

final PluginTransactionValidatorFactory pluginTransactionValidatorFactory =
getPluginTransactionValidatorFactory(besuPluginContext);

final DataStorageConfiguration dataStorageConfiguration =
node.getDataStorageConfiguration() == null
? DataStorageConfiguration.DEFAULT_BONSAI_CONFIG
: node.getDataStorageConfiguration();

builder
.synchronizerConfiguration(new SynchronizerConfiguration.Builder().build())
.dataDirectory(node.homeDirectory())
Expand All @@ -215,7 +221,7 @@ public void startNode(final BesuNode node) {
.nodeKey(new NodeKey(new KeyPairSecurityModule(KeyPairUtil.loadKeyPair(dataDir))))
.metricsSystem(metricsSystem)
.transactionPoolConfiguration(txPoolConfig)
.dataStorageConfiguration(DataStorageConfiguration.DEFAULT_FOREST_CONFIG)
.dataStorageConfiguration(dataStorageConfiguration)
.ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig())
.clock(Clock.systemUTC())
.isRevertReasonEnabled(node.isRevertReasonEnabled())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class BesuNodeConfigurationBuilder {
private Optional<PermissioningConfiguration> permissioningConfiguration = Optional.empty();
private ApiConfiguration apiConfiguration = ImmutableApiConfiguration.builder().build();
private DataStorageConfiguration dataStorageConfiguration =
DataStorageConfiguration.DEFAULT_FOREST_CONFIG;
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG;
private String keyFilePath = null;
private boolean devMode = true;
private GenesisConfigurationProvider genesisConfigProvider = ignore -> Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase;
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeConfigurationBuilder;

Expand Down Expand Up @@ -70,6 +71,8 @@ protected BesuNodeConfigurationBuilder configureNode(
return nodeBuilder
.devMode(false)
.dataPath(hostDataPath)
.dataStorageConfiguration(
DataStorageConfiguration.DEFAULT_FOREST_CONFIG) // existing db is forest
.genesisConfigProvider((nodes) -> Optional.of(genesisData))
.jsonRpcEnabled();
}
Expand Down

0 comments on commit 647750c

Please sign in to comment.