Skip to content

Commit

Permalink
rename --Xbonsai-trie-log-prune-limit to --Xbonsai-trie-log-pruning-l…
Browse files Browse the repository at this point in the history
…imit

Signed-off-by: Simon Dudley <[email protected]>
  • Loading branch information
siladu committed Nov 6, 2023
1 parent bde0bd2 commit 3a779ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
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.Unstable.DEFAULT_BONSAI_TRIE_LOG_PRUNE_LIMIT;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.DEFAULT_BONSAI_TRIE_LOG_PRUNING_ENABLED;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.DEFAULT_BONSAI_TRIE_LOG_PRUNING_LIMIT;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.DEFAULT_BONSAI_TRIE_LOG_RETENTION_THRESHOLD;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.MINIMUM_BONSAI_TRIE_LOG_RETENTION_THRESHOLD;

Expand Down Expand Up @@ -78,10 +78,10 @@ static class Unstable {

@CommandLine.Option(
hidden = true,
names = {"--Xbonsai-trie-log-prune-limit"},
names = {"--Xbonsai-trie-log-pruning-limit"},
description =
"The max number of blocks to load and prune trie logs for at startup. (default: ${DEFAULT-VALUE})")
private int bonsaiTrieLogPruneLimit = DEFAULT_BONSAI_TRIE_LOG_PRUNE_LIMIT;
private int bonsaiTrieLogPruningLimit = DEFAULT_BONSAI_TRIE_LOG_PRUNING_LIMIT;
}
/**
* Create data storage options.
Expand All @@ -107,12 +107,12 @@ public void validate(final CommandLine commandLine) {
"--Xbonsai-trie-log-retention-threshold minimum value is %d",
MINIMUM_BONSAI_TRIE_LOG_RETENTION_THRESHOLD));
}
if (unstableOptions.bonsaiTrieLogPruneLimit <= 0) {
if (unstableOptions.bonsaiTrieLogPruningLimit <= 0) {
throw new CommandLine.ParameterException(
commandLine,
String.format(
"--Xbonsai-trie-log-prune-limit=%d must be greater than 0",
unstableOptions.bonsaiTrieLogPruneLimit));
"--Xbonsai-trie-log-pruning-limit=%d must be greater than 0",
unstableOptions.bonsaiTrieLogPruningLimit));
}
}
}
Expand All @@ -125,7 +125,7 @@ static DataStorageOptions fromConfig(final DataStorageConfiguration domainObject
domainObject.getUnstable().getBonsaiTrieLogPruningEnabled();
dataStorageOptions.unstableOptions.bonsaiTrieLogRetentionThreshold =
domainObject.getUnstable().getBonsaiTrieLogRetentionThreshold();
dataStorageOptions.unstableOptions.bonsaiTrieLogPruneLimit =
dataStorageOptions.unstableOptions.bonsaiTrieLogPruningLimit =
domainObject.getUnstable().getBonsaiTrieLogPruningLimit();

return dataStorageOptions;
Expand All @@ -140,7 +140,7 @@ public DataStorageConfiguration toDomainObject() {
ImmutableDataStorageConfiguration.Unstable.builder()
.bonsaiTrieLogPruningEnabled(unstableOptions.bonsaiTrieLogPruningEnabled)
.bonsaiTrieLogRetentionThreshold(unstableOptions.bonsaiTrieLogRetentionThreshold)
.bonsaiTrieLogPruningLimit(unstableOptions.bonsaiTrieLogPruneLimit)
.bonsaiTrieLogPruningLimit(unstableOptions.bonsaiTrieLogPruningLimit)
.build())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ public class DataStorageOptionsTest
extends AbstractCLIOptionsTest<DataStorageConfiguration, DataStorageOptions> {

@Test
public void bonsaiTrieLogPruneLimitOption() {
public void bonsaiTrieLogPruningLimitOption() {
internalTestSuccess(
dataStorageConfiguration ->
assertThat(dataStorageConfiguration.getUnstable().getBonsaiTrieLogPruningLimit())
.isEqualTo(1),
"--Xbonsai-trie-log-pruning-enabled",
"--Xbonsai-trie-log-prune-limit",
"--Xbonsai-trie-log-pruning-limit",
"1");
}

@Test
public void bonsaiTrieLogPruneLimitShouldBePositive() {
public void bonsaiTrieLogPruningLimitShouldBePositive() {
internalTestFailure(
"--Xbonsai-trie-log-prune-limit=0 must be greater than 0",
"--Xbonsai-trie-log-pruning-limit=0 must be greater than 0",
"--Xbonsai-trie-log-pruning-enabled",
"--Xbonsai-trie-log-prune-limit",
"--Xbonsai-trie-log-pruning-limit",
"0");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface Unstable {
boolean DEFAULT_BONSAI_TRIE_LOG_PRUNING_ENABLED = false;
long DEFAULT_BONSAI_TRIE_LOG_RETENTION_THRESHOLD = TrieLogPruner.DEFAULT_RETENTION_THRESHOLD;
long MINIMUM_BONSAI_TRIE_LOG_RETENTION_THRESHOLD = TrieLogPruner.MINIMUM_RETENTION_THRESHOLD;
int DEFAULT_BONSAI_TRIE_LOG_PRUNE_LIMIT = TrieLogPruner.DEFAULT_PRUNING_LIMIT;
int DEFAULT_BONSAI_TRIE_LOG_PRUNING_LIMIT = TrieLogPruner.DEFAULT_PRUNING_LIMIT;

DataStorageConfiguration.Unstable DEFAULT =
ImmutableDataStorageConfiguration.Unstable.builder().build();
Expand All @@ -65,7 +65,7 @@ default long getBonsaiTrieLogRetentionThreshold() {

@Value.Default
default int getBonsaiTrieLogPruningLimit() {
return DEFAULT_BONSAI_TRIE_LOG_PRUNE_LIMIT;
return DEFAULT_BONSAI_TRIE_LOG_PRUNING_LIMIT;
}
}
}

0 comments on commit 3a779ea

Please sign in to comment.