Remove quorum-mainnet-launcher (#5355)

* remove launcher from besucommand

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

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/4427/head
Sally MacFarlane 2 years ago committed by GitHub
parent 40da7a9aed
commit 78f8efff7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGELOG.md
  2. 1
      besu/build.gradle
  3. 41
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  4. 70
      besu/src/main/java/org/hyperledger/besu/cli/options/unstable/LauncherOptions.java
  5. 19
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  6. 5
      besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java
  7. 64
      besu/src/test/java/org/hyperledger/besu/cli/launcher/LauncherTest.java
  8. 4
      build.gradle
  9. 8
      gradle/verification-metadata.xml
  10. 2
      gradle/versions.gradle

@ -3,8 +3,9 @@
## 23.4-RC
### Breaking Changes
- Remove IBFT 1.0 feature (deprecated in 23.1.0-beta) [#5302](https://github.com/hyperledger/besu/pull/5302)
- Remove GoQuorum-compatible privacy feature (deprecated in 23.1.0-beta) [#5303](https://github.com/hyperledger/besu/pull/5303)
- Remove IBFT 1.0 feature [#5302](https://github.com/hyperledger/besu/pull/5302)
- Remove GoQuorum-compatible privacy feature [#5303](https://github.com/hyperledger/besu/pull/5303)
- Remove launcher command line utility [#5355](https://github.com/hyperledger/besu/pull/5355)
- Remove deprecated `tx-pool-future-max-by-account` option, see instead: `tx-pool-limit-by-account-percentage` [#5361](https://github.com/hyperledger/besu/pull/5361)
### Additions and Improvements

@ -75,7 +75,6 @@ dependencies {
implementation 'org.apache.tuweni:tuweni-units'
implementation 'org.springframework.security:spring-security-crypto'
implementation 'org.xerial.snappy:snappy-java'
implementation 'net.consensys.services:quorum-mainnet-launcher'
implementation 'tech.pegasys:jc-kzg-4844'
runtimeOnly 'org.apache.logging.log4j:log4j-jul'

@ -63,7 +63,6 @@ import org.hyperledger.besu.cli.options.unstable.DnsOptions;
import org.hyperledger.besu.cli.options.unstable.EthProtocolOptions;
import org.hyperledger.besu.cli.options.unstable.EvmOptions;
import org.hyperledger.besu.cli.options.unstable.IpcOptions;
import org.hyperledger.besu.cli.options.unstable.LauncherOptions;
import org.hyperledger.besu.cli.options.unstable.MetricsCLIOptions;
import org.hyperledger.besu.cli.options.unstable.MiningOptions;
import org.hyperledger.besu.cli.options.unstable.NatOptions;
@ -232,10 +231,6 @@ import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.json.DecodeException;
import io.vertx.core.metrics.MetricsOptions;
import net.consensys.quorum.mainnet.launcher.LauncherManager;
import net.consensys.quorum.mainnet.launcher.config.ImmutableLauncherConfig;
import net.consensys.quorum.mainnet.launcher.exception.LauncherException;
import net.consensys.quorum.mainnet.launcher.util.ParseArgsHelper;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt256;
import org.slf4j.Logger;
@ -285,7 +280,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
private final NatOptions unstableNatOptions = NatOptions.create();
private final NativeLibraryOptions unstableNativeLibraryOptions = NativeLibraryOptions.create();
private final RPCOptions unstableRPCOptions = RPCOptions.create();
final LauncherOptions unstableLauncherOptions = LauncherOptions.create();
private final PrivacyPluginOptions unstablePrivacyPluginOptions = PrivacyPluginOptions.create();
private final EvmOptions unstableEvmOptions = EvmOptions.create();
private final IpcOptions unstableIpcOptions = IpcOptions.create();
@ -1584,7 +1578,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
.put("TransactionPool", unstableTransactionPoolOptions)
.put("Mining", unstableMiningOptions)
.put("Native Library", unstableNativeLibraryOptions)
.put("Launcher", unstableLauncherOptions)
.put("EVM Options", unstableEvmOptions)
.put("IPC Options", unstableIpcOptions)
.put("Chain Data Pruning Options", unstableChainPruningOptions)
@ -1647,35 +1640,11 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
new ConfigOptionSearchAndRunHandler(
resultHandler, besuParameterExceptionHandler, environment);
ParseArgsHelper.getLauncherOptions(unstableLauncherOptions, args);
if (unstableLauncherOptions.isLauncherMode()
|| unstableLauncherOptions.isLauncherModeForced()) {
try {
final ImmutableLauncherConfig launcherConfig =
ImmutableLauncherConfig.builder()
.launcherScript(BesuCommand.class.getResourceAsStream("launcher.json"))
.addCommandClasses(this, unstableNatOptions, ethstatsOptions, unstableMiningOptions)
.isLauncherForced(unstableLauncherOptions.isLauncherModeForced())
.build();
final File file = new LauncherManager(launcherConfig).run();
logger.info("Config file location : {}", file.getAbsolutePath());
return commandLine
.setExecutionStrategy(configParsingHandler)
.setParameterExceptionHandler(besuParameterExceptionHandler)
.setExecutionExceptionHandler(besuExecutionExceptionHandler)
.execute(String.format("%s=%s", CONFIG_FILE_OPTION_NAME, file.getAbsolutePath()));
} catch (final LauncherException e) {
logger.warn("Unable to run the launcher {}", e.getMessage());
return -1;
}
} else {
return commandLine
.setExecutionStrategy(configParsingHandler)
.setParameterExceptionHandler(besuParameterExceptionHandler)
.setExecutionExceptionHandler(besuExecutionExceptionHandler)
.execute(args);
}
return commandLine
.setExecutionStrategy(configParsingHandler)
.setParameterExceptionHandler(besuParameterExceptionHandler)
.setExecutionExceptionHandler(besuExecutionExceptionHandler)
.execute(args);
}
private void preSynchronization() {

@ -1,70 +0,0 @@
/*
* 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.cli.options.unstable;
import net.consensys.quorum.mainnet.launcher.options.Options;
import picocli.CommandLine;
/** The Launcher CLI options. */
public class LauncherOptions implements Options {
private static final String LAUNCHER_OPTION_NAME = "--Xlauncher";
private static final String LAUNCHER_OPTION_NAME_FORCE = "--Xlauncher-force";
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"})
@CommandLine.Option(
hidden = true,
names = {LAUNCHER_OPTION_NAME},
description =
"Activate the launcher if no configuration file is present. (default: ${DEFAULT-VALUE})",
arity = "0..1")
private Boolean isLauncherMode = Boolean.FALSE;
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"})
@CommandLine.Option(
hidden = true,
names = {LAUNCHER_OPTION_NAME_FORCE},
description =
"Force to activate the launcher even if a configuration file is present. (default: ${DEFAULT-VALUE})",
arity = "0..1")
private Boolean isLauncherModeForced = Boolean.FALSE;
/**
* Create launcher options.
*
* @return the launcher options
*/
public static LauncherOptions create() {
return new LauncherOptions();
}
/**
* Is launcher mode enabled.
*
* @return true if enabled, false otherwise.
*/
public boolean isLauncherMode() {
return isLauncherMode;
}
/**
* Is launcher mode forced enabled.
*
* @return true if enabled, false otherwise.
*/
public boolean isLauncherModeForced() {
return isLauncherModeForced;
}
}

@ -1882,20 +1882,15 @@ public class BesuCommandTest extends CommandTestAbstract {
}
@Test
public void launcherDefaultOptionValue() {
final TestBesuCommand besuCommand = parseCommand();
public void parsesInvalidBonsaiTrieLimitBackLayersOption() {
assertThat(besuCommand.getLauncherOptions().isLauncherMode()).isFalse();
assertThat(besuCommand.getEnodeDnsConfiguration().updateEnabled()).isFalse();
}
@Test
public void launcherOptionIsParsedCorrectly() {
final TestBesuCommand besuCommand =
parseCommand("--Xlauncher", "true", "--Xlauncher-force", "true");
parseCommand("--data-storage-format", "BONSAI", "--bonsai-maximum-back-layers-to-load", "ten");
assertThat(besuCommand.getLauncherOptions().isLauncherMode()).isTrue();
assertThat(besuCommand.getEnodeDnsConfiguration().updateEnabled()).isFalse();
Mockito.verifyNoInteractions(mockRunnerBuilder);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8))
.contains(
"Invalid value for option '--bonsai-maximum-back-layers-to-load': 'ten' is not a long");
}
@Test

@ -33,7 +33,6 @@ import org.hyperledger.besu.chainimport.RlpBlockImporter;
import org.hyperledger.besu.cli.config.EthNetworkConfig;
import org.hyperledger.besu.cli.options.stable.EthstatsOptions;
import org.hyperledger.besu.cli.options.unstable.EthProtocolOptions;
import org.hyperledger.besu.cli.options.unstable.LauncherOptions;
import org.hyperledger.besu.cli.options.unstable.MetricsCLIOptions;
import org.hyperledger.besu.cli.options.unstable.NetworkingOptions;
import org.hyperledger.besu.cli.options.unstable.SynchronizerOptions;
@ -517,10 +516,6 @@ public abstract class CommandTestAbstract {
return unstableMetricsCLIOptions;
}
public LauncherOptions getLauncherOptions() {
return unstableLauncherOptions;
}
public void close() {
if (vertx != null) {
final AtomicBoolean closed = new AtomicBoolean(false);

@ -1,64 +0,0 @@
/*
* Copyright Hyperledger Besu Contributors.
*
* 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.cli.launcher;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.cli.BesuCommand;
import java.io.IOException;
import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Splitter;
import net.consensys.quorum.mainnet.launcher.model.LauncherScript;
import net.consensys.quorum.mainnet.launcher.model.Step;
import org.junit.Test;
public class LauncherTest {
private static final ObjectMapper MAPPER = new ObjectMapper();
@Test
public void launcherDefaultValuesAreAvailable() throws IOException {
final LauncherScript script =
MAPPER.readValue(
(BesuCommand.class.getResourceAsStream("launcher.json")), LauncherScript.class);
assertThat(isStepValid(List.of(script.getSteps()))).isTrue();
}
@SuppressWarnings("ReturnValueIgnored")
private boolean isStepValid(final List<Step> steps) {
for (Step step : steps) {
if (step.getAvailableOptions() != null) {
try {
List<String> split = Splitter.on('$').splitToList(step.getAvailableOptions());
if (split.size() > 1) {
Class.forName(split.get(0)).getField(split.get(1));
} else {
Class.forName(step.getAvailableOptions()).getEnumConstants();
}
} catch (Exception exception) {
exception.printStackTrace();
return false;
}
}
if (!isStepValid(step.getSubQuestions())) {
return false;
}
}
return true;
}
}

@ -124,10 +124,6 @@ allprojects {
url 'https://artifacts.consensys.net/public/maven/maven/'
content { includeGroupByRegex('tech\\.pegasys(\\..*)?') }
}
maven {
url 'https://dl.cloudsmith.io/public/consensys/quorum-mainnet-launcher/maven/'
content { includeGroupByRegex('net\\.consensys\\..*') }
}
maven {
url 'https://splunk.jfrog.io/splunk/ext-releases-local'
content { includeGroupByRegex('com\\.splunk\\..*') }

@ -2811,14 +2811,6 @@
<sha256 value="ff66d886607137e2095f20c90ee093f3c80329164eff091a0688bdce37e3e6b2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="net.consensys.services" name="quorum-mainnet-launcher" version="1.0.1">
<artifact name="quorum-mainnet-launcher-1.0.1.jar">
<sha256 value="1d205a5517b7f193cda11cb3469e9184d142080e698d2f068dcddd9c3036121f" origin="Generated by Gradle"/>
</artifact>
<artifact name="quorum-mainnet-launcher-1.0.1.pom">
<sha256 value="533a3ce5165d8bca7f1e6d738cbc07f0877a99dfa40bdc05f05373c34bf62f43" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="net.java" name="jvnet-parent" version="3">
<artifact name="jvnet-parent-3.pom">
<sha256 value="30f5789efa39ddbf96095aada3fc1260c4561faf2f714686717cb2dc5049475a" origin="Generated by Gradle"/>

@ -120,8 +120,6 @@ dependencyManagement {
dependency 'junit:junit:4.13.2'
dependency 'net.consensys.services:quorum-mainnet-launcher:1.0.1'
dependency 'net.java.dev.jna:jna:5.13.0'
dependency 'org.apache.commons:commons-compress:1.23.0'

Loading…
Cancel
Save