Updating confusing --bonsai-maximum-back-layers-to-load option to --bonsai-historical-block-limit + remove deprecated snapshots config (#5337)

* Changing bonsai-max-back-layers-to-load to --bonsai-historical-block-limit

Signed-off-by: Matt Nelson <monels11@gmail.com>

* remove a couple other places where snapshot option was configured

Signed-off-by: garyschulte <garyschulte@gmail.com>

* Update besu/src/main/java/org/hyperledger/besu/cli/options/stable/DataStorageOptions.java

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Matt Nelson <85905982+non-fungible-nelson@users.noreply.github.com>

---------

Signed-off-by: Matt Nelson <monels11@gmail.com>
Signed-off-by: Matt Nelson <85905982+non-fungible-nelson@users.noreply.github.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/4427/head
Matt Nelson 2 years ago committed by GitHub
parent 5e77b7857d
commit 560c5489bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 23
      besu/src/main/java/org/hyperledger/besu/cli/options/stable/DataStorageOptions.java
  3. 14
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  4. 2
      besu/src/test/java/org/hyperledger/besu/controller/BesuControllerBuilderTest.java
  5. 3
      besu/src/test/resources/everything_config.toml
  6. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DataStorageConfiguration.java

@ -13,6 +13,7 @@
- Offload LogBloom cache generation to computation executor, to avoid interfere with other scheduled tasks [#4530](https://github.com/hyperledger/besu/pull/4530)
- Reference tests are upgraded to use v12.1 of the ethereum tests [#5343](https://github.com/hyperledger/besu/pull/5343)
- Add new sepolia bootnodes, which should improve peering in the testnet. [#5352](https://github.com/hyperledger/besu/pull/5352)
- Renamed --bonsai-maximum-back-layers-to-load option to --bonsai-historical-block-limit for clarity. Removed --Xbonsai-use-snapshots option as it is no longer functional [#5337](https://github.com/hyperledger/besu/pull/5337)
### Bug Fixes

@ -17,7 +17,6 @@
package org.hyperledger.besu.cli.options.stable;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.DEFAULT_BONSAI_USE_SNAPSHOTS;
import org.hyperledger.besu.cli.options.CLIOptions;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
@ -35,9 +34,7 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
private static final String DATA_STORAGE_FORMAT = "--data-storage-format";
private static final String BONSAI_STORAGE_FORMAT_MAX_LAYERS_TO_LOAD =
"--bonsai-maximum-back-layers-to-load";
private static final String BONSAI_STORAGE_FORMAT_USE_SNAPSHOTS = "--Xbonsai-use-snapshots";
"--bonsai-historical-block-limit";
// Use Bonsai DB
@Option(
@ -48,22 +45,13 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
private final DataStorageFormat dataStorageFormat = DataStorageFormat.FOREST;
@Option(
names = {BONSAI_STORAGE_FORMAT_MAX_LAYERS_TO_LOAD},
names = {BONSAI_STORAGE_FORMAT_MAX_LAYERS_TO_LOAD, "--bonsai-maximum-back-layers-to-load"},
paramLabel = "<LONG>",
description =
"Limit of back layers that can be loaded with BONSAI (default: ${DEFAULT-VALUE}).",
"Limit of historical layers that can be loaded with BONSAI (default: ${DEFAULT-VALUE}).",
arity = "1")
private final Long bonsaiMaxLayersToLoad = DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD;
@Option(
names = {BONSAI_STORAGE_FORMAT_USE_SNAPSHOTS},
paramLabel = "<BOOLEAN>",
hidden = true,
description =
"Use database snapshots for mutable worldstates with BONSAI (default: ${DEFAULT-VALUE}).",
arity = "1")
private final Boolean bonsaiUseSnapshots = DEFAULT_BONSAI_USE_SNAPSHOTS;
/**
* Create data storage options.
*
@ -78,7 +66,6 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
return ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(dataStorageFormat)
.bonsaiMaxLayersToLoad(bonsaiMaxLayersToLoad)
.useBonsaiSnapshots(bonsaiUseSnapshots)
.build();
}
@ -88,9 +75,7 @@ public class DataStorageOptions implements CLIOptions<DataStorageConfiguration>
DATA_STORAGE_FORMAT,
dataStorageFormat.toString(),
BONSAI_STORAGE_FORMAT_MAX_LAYERS_TO_LOAD,
bonsaiMaxLayersToLoad.toString(),
BONSAI_STORAGE_FORMAT_USE_SNAPSHOTS,
bonsaiUseSnapshots.toString());
bonsaiMaxLayersToLoad.toString());
}
/**

@ -1869,7 +1869,7 @@ public class BesuCommandTest extends CommandTestAbstract {
@Test
public void parsesValidBonsaiTrieLimitBackLayersOption() {
parseCommand("--data-storage-format", "BONSAI", "--bonsai-maximum-back-layers-to-load", "11");
parseCommand("--data-storage-format", "BONSAI", "--bonsai-historical-block-limit", "11");
verify(mockControllerBuilder)
.dataStorageConfiguration(dataStorageConfigurationArgumentCaptor.capture());
@ -1881,18 +1881,6 @@ public class BesuCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void parsesInvalidBonsaiTrieLimitBackLayersOption() {
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 '--bonsai-maximum-back-layers-to-load': 'ten' is not a long");
}
@Test
public void launcherDefaultOptionValue() {
final TestBesuCommand besuCommand = parseCommand();

@ -180,7 +180,6 @@ public class BesuControllerBuilderTest {
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.BONSAI)
.bonsaiMaxLayersToLoad(DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.useBonsaiSnapshots(DataStorageConfiguration.DEFAULT_BONSAI_USE_SNAPSHOTS)
.build());
besuControllerBuilder.build();
@ -197,7 +196,6 @@ public class BesuControllerBuilderTest {
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.FOREST)
.bonsaiMaxLayersToLoad(DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.useBonsaiSnapshots(DataStorageConfiguration.DEFAULT_BONSAI_USE_SNAPSHOTS)
.build());
besuControllerBuilder.build();

@ -195,8 +195,7 @@ ethstats-cacert-file="./root.cert"
# Data storage
data-storage-format="BONSAI"
bonsai-maximum-back-layers-to-load=512
Xbonsai-use-snapshots=true
bonsai-historical-block-limit=512
# feature flags
Xsecp256k1-native-enabled=false

@ -22,18 +22,14 @@ import org.immutables.value.Value;
public interface DataStorageConfiguration {
long DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD = 512;
boolean DEFAULT_BONSAI_USE_SNAPSHOTS = false;
DataStorageConfiguration DEFAULT_CONFIG =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.FOREST)
.bonsaiMaxLayersToLoad(DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.useBonsaiSnapshots(DEFAULT_BONSAI_USE_SNAPSHOTS)
.build();
DataStorageFormat getDataStorageFormat();
Long getBonsaiMaxLayersToLoad();
Boolean useBonsaiSnapshots();
}

Loading…
Cancel
Save