diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java index 157421531b..4e48be0401 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java @@ -128,6 +128,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable private boolean useWsForJsonRpc = false; private String token = null; private final List plugins = new ArrayList<>(); + private final List requestedPlugins; private final List extraCLIOptions; private final List staticNodes; private boolean isDnsEnabled = false; @@ -163,6 +164,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable final boolean secp256k1Native, final boolean altbn128Native, final List plugins, + final List requestedPlugins, final List extraCLIOptions, final List staticNodes, final boolean isDnsEnabled, @@ -224,6 +226,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable LOG.error("Could not find plugin \"{}\" in resources", pluginName); } }); + this.requestedPlugins = requestedPlugins; engineRpcConfiguration.ifPresent( config -> MergeConfigOptions.setMergeEnabled(config.isEnabled())); this.extraCLIOptions = extraCLIOptions; @@ -738,6 +741,10 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable return plugins; } + public List getRequestedPlugins() { + return requestedPlugins; + } + @Override public List getExtraCLIOptions() { return extraCLIOptions; diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java index 6e00701ef2..62951a442d 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java @@ -451,6 +451,11 @@ public class ProcessBesuNodeRunner implements BesuNodeRunner { params.add("--logging=" + level); } + if (!node.getRequestedPlugins().isEmpty()) { + params.add( + "--plugins=" + node.getRequestedPlugins().stream().collect(Collectors.joining(","))); + } + params.addAll(node.getRunCommand()); return params; } diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index 90de0b0e95..d4334fd93c 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -39,6 +39,7 @@ import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; import org.hyperledger.besu.ethereum.core.MiningParameters; import org.hyperledger.besu.ethereum.core.plugins.PluginConfiguration; +import org.hyperledger.besu.ethereum.core.plugins.PluginInfo; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.eth.transactions.BlobCacheModule; @@ -302,6 +303,12 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { return toProvide.getExtraCLIOptions(); } + @Provides + @Named("RequestedPlugins") + public List provideRequestedPlugins() { + return toProvide.getRequestedPlugins(); + } + @Provides Path provideDataDir() { return toProvide.homeDirectory(); @@ -469,7 +476,8 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { final RpcEndpointServiceImpl rpcEndpointServiceImpl, final BesuConfiguration commonPluginConfiguration, final PermissioningServiceImpl permissioningService, - final @Named("ExtraCLIOptions") List extraCLIOptions) { + final @Named("ExtraCLIOptions") List extraCLIOptions, + final @Named("RequestedPlugins") List requestedPlugins) { final CommandLine commandLine = new CommandLine(CommandSpec.create()); final BesuPluginContextImpl besuPluginContext = new BesuPluginContextImpl(); besuPluginContext.addService(StorageService.class, storageService); @@ -504,7 +512,10 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { besuPluginContext.addService(PrivacyPluginService.class, new PrivacyPluginServiceImpl()); besuPluginContext.initialize( - new PluginConfiguration.Builder().pluginsDir(pluginsPath).build()); + new PluginConfiguration.Builder() + .pluginsDir(pluginsPath) + .requestedPlugins(requestedPlugins.stream().map(PluginInfo::new).toList()) + .build()); besuPluginContext.registerPlugins(); commandLine.parseArgs(extraCLIOptions.toArray(new String[0])); diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java index c77a6c8ac7..ba69e4ddd7 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java @@ -64,6 +64,7 @@ public class BesuNodeConfiguration { private final boolean secp256k1Native; private final boolean altbn128Native; private final List plugins; + private final List requestedPlugins; private final List extraCLIOptions; private final List staticNodes; private final boolean isDnsEnabled; @@ -102,6 +103,7 @@ public class BesuNodeConfiguration { final boolean secp256k1Native, final boolean altbn128Native, final List plugins, + final List requestedPlugins, final List extraCLIOptions, final List staticNodes, final boolean isDnsEnabled, @@ -137,6 +139,7 @@ public class BesuNodeConfiguration { this.secp256k1Native = secp256k1Native; this.altbn128Native = altbn128Native; this.plugins = plugins; + this.requestedPlugins = requestedPlugins; this.extraCLIOptions = extraCLIOptions; this.staticNodes = staticNodes; this.isDnsEnabled = isDnsEnabled; @@ -239,6 +242,10 @@ public class BesuNodeConfiguration { return plugins; } + public List getRequestedPlugins() { + return requestedPlugins; + } + public List getExtraCLIOptions() { return extraCLIOptions; } diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java index d8b5e0f904..ead01ce97d 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java @@ -93,6 +93,7 @@ public class BesuNodeConfigurationBuilder { private boolean secp256K1Native = true; private boolean altbn128Native = true; private final List plugins = new ArrayList<>(); + private final List requestedPlugins = new ArrayList<>(); private final List extraCLIOptions = new ArrayList<>(); private List staticNodes = new ArrayList<>(); private boolean isDnsEnabled = false; @@ -448,6 +449,12 @@ public class BesuNodeConfigurationBuilder { return this; } + public BesuNodeConfigurationBuilder requestedPlugins(final List requestedPlugins) { + this.requestedPlugins.clear(); + this.requestedPlugins.addAll(requestedPlugins); + return this; + } + public BesuNodeConfigurationBuilder extraCLIOptions(final List extraCLIOptions) { this.extraCLIOptions.clear(); this.extraCLIOptions.addAll(extraCLIOptions); @@ -545,6 +552,7 @@ public class BesuNodeConfigurationBuilder { secp256K1Native, altbn128Native, plugins, + requestedPlugins, extraCLIOptions, staticNodes, isDnsEnabled, diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java index 0451d2a721..b39274c3d9 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java @@ -77,6 +77,7 @@ public class BesuNodeFactory { config.isSecp256k1Native(), config.isAltbn128Native(), config.getPlugins(), + config.getRequestedPlugins(), config.getExtraCLIOptions(), config.getStaticNodes(), config.isDnsEnabled(),