Remove -x flag for bonsai CLI options (#3578)

* remove -x flag for bonsai CLI options
* move class into stable package

Signed-off-by: Frank Li <b439988l@gmail.com>
pull/3578/merge
Frank Li 3 years ago committed by GitHub
parent 4f4da5a8cb
commit a13d6dc00b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 13
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  3. 6
      besu/src/main/java/org/hyperledger/besu/cli/options/stable/DataStorageOptions.java
  4. 7
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java

@ -2,6 +2,9 @@
## 22.1.2
### Breaking Changes
- Remove the experimental flag for bonsai tries CLI options '--data-storage-format' and '--bonsai-maximum-back-layers-to-load' [#3578](https://github.com/hyperledger/besu/pull/3578)
### Additions and Improvements
- Execution layer (The Merge):
- Execution specific RPC endpoint [#3378](https://github.com/hyperledger/besu/issues/3378)

@ -51,11 +51,11 @@ import org.hyperledger.besu.cli.custom.CorsAllowedOriginsProperty;
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty;
import org.hyperledger.besu.cli.custom.RpcAuthFileValidator;
import org.hyperledger.besu.cli.error.BesuExceptionHandler;
import org.hyperledger.besu.cli.options.stable.DataStorageOptions;
import org.hyperledger.besu.cli.options.stable.EthstatsOptions;
import org.hyperledger.besu.cli.options.stable.LoggingLevelOption;
import org.hyperledger.besu.cli.options.stable.NodePrivateKeyFileOption;
import org.hyperledger.besu.cli.options.stable.P2PTLSConfigOptions;
import org.hyperledger.besu.cli.options.unstable.DataStorageOptions;
import org.hyperledger.besu.cli.options.unstable.DnsOptions;
import org.hyperledger.besu.cli.options.unstable.EthProtocolOptions;
import org.hyperledger.besu.cli.options.unstable.EvmOptions;
@ -274,7 +274,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
final EthProtocolOptions unstableEthProtocolOptions = EthProtocolOptions.create();
final MetricsCLIOptions unstableMetricsCLIOptions = MetricsCLIOptions.create();
final TransactionPoolOptions unstableTransactionPoolOptions = TransactionPoolOptions.create();
private final DataStorageOptions unstableDataStorageOptions = DataStorageOptions.create();
private final DnsOptions unstableDnsOptions = DnsOptions.create();
private final MiningOptions unstableMiningOptions = MiningOptions.create();
private final NatOptions unstableNatOptions = NatOptions.create();
@ -286,6 +285,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
private final EvmOptions unstableEvmOptions = EvmOptions.create();
// stable CLI options
private final DataStorageOptions dataStorageOptions = DataStorageOptions.create();
private final EthstatsOptions ethstatsOptions = EthstatsOptions.create();
private final NodePrivateKeyFileOption nodePrivateKeyFileOption =
NodePrivateKeyFileOption.create();
@ -1441,7 +1441,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
.put("TransactionPool", unstableTransactionPoolOptions)
.put("Mining", unstableMiningOptions)
.put("Native Library", unstableNativeLibraryOptions)
.put("Data Storage Options", unstableDataStorageOptions)
.put("Data Storage Options", dataStorageOptions)
.put("Launcher", unstableLauncherOptions)
.put("Merge", mergeOptions)
.put("EVM Options", unstableEvmOptions)
@ -1996,7 +1996,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
.requiredBlocks(requiredBlocks)
.reorgLoggingThreshold(reorgLoggingThreshold)
.evmConfiguration(unstableEvmOptions.toDomainObject())
.dataStorageConfiguration(unstableDataStorageOptions.toDomainObject())
.dataStorageConfiguration(dataStorageOptions.toDomainObject())
.maxPeers(maxPeers);
}
@ -3050,10 +3050,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
@Override
public int getDatabaseVersion() {
return unstableDataStorageOptions
.toDomainObject()
.getDataStorageFormat()
.getDatabaseVersion();
return dataStorageOptions.toDomainObject().getDataStorageFormat().getDatabaseVersion();
}
}

@ -14,7 +14,7 @@
*
*/
package org.hyperledger.besu.cli.options.unstable;
package org.hyperledger.besu.cli.options.stable;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD;
@ -29,10 +29,10 @@ import picocli.CommandLine.Option;
public class DataStorageOptions implements CLIOptions<DataStorageConfiguration> {
private static final String DATA_STORAGE_FORMAT = "--Xdata-storage-format";
private static final String DATA_STORAGE_FORMAT = "--data-storage-format";
private static final String BONSAI_STORAGE_FORMAT_MAX_LAYERS_TO_LOAD =
"--Xbonsai-maximum-back-layers-to-load";
"--bonsai-maximum-back-layers-to-load";
// Use Bonsai DB
@Option(

@ -1687,7 +1687,7 @@ public class BesuCommandTest extends CommandTestAbstract {
@Test
public void parsesValidBonsaiTrieLimitBackLayersOption() {
parseCommand("--Xdata-storage-format", "BONSAI", "--Xbonsai-maximum-back-layers-to-load", "11");
parseCommand("--data-storage-format", "BONSAI", "--bonsai-maximum-back-layers-to-load", "11");
verify(mockControllerBuilder)
.dataStorageConfiguration(dataStorageConfigurationArgumentCaptor.capture());
@ -1702,14 +1702,13 @@ public class BesuCommandTest extends CommandTestAbstract {
@Test
public void parsesInvalidBonsaiTrieLimitBackLayersOption() {
parseCommand(
"--Xdata-storage-format", "BONSAI", "--Xbonsai-maximum-back-layers-to-load", "ten");
parseCommand("--data-storage-format", "BONSAI", "--bonsai-maximum-back-layers-to-load", "ten");
Mockito.verifyNoInteractions(mockRunnerBuilder);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8))
.contains(
"Invalid value for option '--Xbonsai-maximum-back-layers-to-load': 'ten' is not a long");
"Invalid value for option '--bonsai-maximum-back-layers-to-load': 'ten' is not a long");
}
@Test

Loading…
Cancel
Save