diff --git a/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/DataStorageOptions.java b/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/DataStorageOptions.java index bc0c08bc0b..0eb0569239 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/DataStorageOptions.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/DataStorageOptions.java @@ -46,6 +46,7 @@ public class DataStorageOptions implements CLIOptions @Option( names = {BONSAI_STORAGE_FORMAT_MAX_LAYERS_TO_LOAD}, hidden = true, + paramLabel = "", description = "Limit of back layers that can be loaded with BONSAI (default: ${DEFAULT-VALUE}).", arity = "1") diff --git a/besu/src/main/java/org/hyperledger/besu/cli/util/TomlConfigFileDefaultProvider.java b/besu/src/main/java/org/hyperledger/besu/cli/util/TomlConfigFileDefaultProvider.java index 6b709dea77..e6e9b9b35b 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/util/TomlConfigFileDefaultProvider.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/util/TomlConfigFileDefaultProvider.java @@ -70,6 +70,8 @@ public class TomlConfigFileDefaultProvider implements IDefaultValueProvider { defaultValue = getListEntryAsString(optionSpec); } else if (optionSpec.type().equals(Integer.class) || optionSpec.type().equals(int.class)) { defaultValue = getIntegerEntryAsString(optionSpec); + } else if (optionSpec.type().equals(Long.class) || optionSpec.type().equals(long.class)) { + defaultValue = getIntegerEntryAsString(optionSpec); } else if (optionSpec.type().equals(Wei.class)) { defaultValue = getIntegerEntryAsString(optionSpec); } else if (optionSpec.type().equals(BigInteger.class)) { diff --git a/besu/src/test/java/org/hyperledger/besu/cli/TomlConfigFileDefaultProviderTest.java b/besu/src/test/java/org/hyperledger/besu/cli/TomlConfigFileDefaultProviderTest.java index 95dc73ef49..d48488a4b8 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/TomlConfigFileDefaultProviderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/TomlConfigFileDefaultProviderTest.java @@ -56,6 +56,7 @@ public class TomlConfigFileDefaultProviderTest { when(mockCommandLine.getCommandSpec()).thenReturn(mockCommandSpec); Map validOptionsMap = new HashMap<>(); validOptionsMap.put("--a-short-option", null); + validOptionsMap.put("--an-actual-long-option", null); validOptionsMap.put("--a-longer-option", null); when(mockCommandSpec.optionsMap()).thenReturn(validOptionsMap); @@ -65,6 +66,8 @@ public class TomlConfigFileDefaultProviderTest { fileWriter.write("a-short-option='123'"); fileWriter.newLine(); + fileWriter.write("an-actual-long-option=" + Long.MAX_VALUE); + fileWriter.newLine(); fileWriter.write("a-longer-option='1234'"); fileWriter.flush(); @@ -86,6 +89,15 @@ public class TomlConfigFileDefaultProviderTest { .build())) .isEqualTo("123"); + // this option must be found in config as one of its names is present in the file. + // also this is a long. + assertThat( + providerUnderTest.defaultValue( + OptionSpec.builder("an-actual-long-option", "another-name-for-the-option") + .type(Long.class) + .build())) + .isEqualTo(String.valueOf(Long.MAX_VALUE)); + // this option must be found in config as one of its names is present in the file. // also this is the longest one. assertThat(