Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

PAN-2076 Update PantheonCommand to accept minTransactionGasPriceWei as an integer #1668

Merged
merged 7 commits into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Reference/Pantheon-CLI-Syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ PANTHEON_MIN_GAS_PRICE=1337
```

```bash tab="Configuration File"
min-gas-price="1337"
min-gas-price=1337
```

The minimum price that a transaction offers for it to be included in a mined block.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
package tech.pegasys.pantheon.cli.util;

import tech.pegasys.pantheon.ethereum.core.Wei;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
Expand Down Expand Up @@ -56,6 +58,8 @@ private String getConfigurationValue(final OptionSpec optionSpec) {
defaultValue = getListEntryAsString(optionSpec);
} else if (optionSpec.type().equals(Integer.class)) {
defaultValue = getIntegerEntryAsString(optionSpec);
} else if (optionSpec.type().equals(Wei.class)) {
defaultValue = getIntegerEntryAsString(optionSpec);
} else { // else will be treated as String
defaultValue = getEntryAsString(optionSpec);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ public void tomlThatConfiguresEverythingExceptPermissioningToml() throws IOExcep
tomlResult.getArray(tomlKey);
} else if (Number.class.isAssignableFrom(optionSpec.type())) {
tomlResult.getLong(tomlKey);
} else if (Wei.class.isAssignableFrom(optionSpec.type())) {
tomlResult.getLong(tomlKey);
} else {
tomlResult.getString(tomlKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import tech.pegasys.pantheon.cli.util.TomlConfigFileDefaultProvider;
import tech.pegasys.pantheon.ethereum.core.Wei;

import java.io.BufferedWriter;
import java.io.File;
Expand Down Expand Up @@ -93,6 +94,8 @@ public void defaultValueForOptionMustMatchType() throws IOException {
fileWriter.newLine();
fileWriter.write("an-int-value-option=123");
fileWriter.newLine();
fileWriter.write("a-wei-value-option=1");
fileWriter.newLine();
fileWriter.write("a-string-value-option='my value'");
fileWriter.flush();

Expand All @@ -119,6 +122,11 @@ public void defaultValueForOptionMustMatchType() throws IOException {
OptionSpec.builder("an-int-value-option").type(Integer.class).build()))
.isEqualTo("123");

assertThat(
providerUnderTest.defaultValue(
OptionSpec.builder("a-wei-value-option").type(Wei.class).build()))
.isEqualTo("1");

assertThat(
providerUnderTest.defaultValue(
OptionSpec.builder("a-string-value-option").type(String.class).build()))
Expand Down
2 changes: 1 addition & 1 deletion pantheon/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ metrics-push-prometheus-job="pantheon-everything"
miner-enabled=false
miner-coinbase="0x0000000000000000000000000000000000000002"
miner-extra-data="0x444F4E27542050414E4943202120484F444C2C20484F444C2C20484F444C2021"
min-gas-price="1"
min-gas-price=1

# Permissioning
permissions-nodes-config-file-enabled=false
Expand Down