-
Notifications
You must be signed in to change notification settings - Fork 896
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix experimental options not correctly displayed (#1366)
Signed-off-by: Karim TAAM <[email protected]>
- Loading branch information
Showing
23 changed files
with
420 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
187 changes: 59 additions & 128 deletions
187
besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Large diffs are not rendered by default.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
besu/src/main/java/org/hyperledger/besu/cli/options/unstable/DnsOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.unstable; | ||
|
||
import org.hyperledger.besu.cli.options.CLIOptions; | ||
import org.hyperledger.besu.ethereum.p2p.peers.EnodeDnsConfiguration; | ||
import org.hyperledger.besu.ethereum.p2p.peers.ImmutableEnodeDnsConfiguration; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import picocli.CommandLine; | ||
|
||
public class DnsOptions implements CLIOptions<EnodeDnsConfiguration> { | ||
|
||
private final String DNS_ENABLED = "--Xdns-enabled"; | ||
private final String DNS_UPDATE_ENABLED = "--Xdns-update-enabled"; | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xdns-enabled"}, | ||
description = "Enabled DNS support", | ||
arity = "1") | ||
private Boolean dnsEnabled = Boolean.FALSE; | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xdns-update-enabled"}, | ||
description = "Allow to detect an IP update automatically", | ||
arity = "1") | ||
private Boolean dnsUpdateEnabled = Boolean.FALSE; | ||
|
||
public static DnsOptions create() { | ||
return new DnsOptions(); | ||
} | ||
|
||
public static DnsOptions fromConfig(final EnodeDnsConfiguration enodeDnsConfiguration) { | ||
final DnsOptions cliOptions = new DnsOptions(); | ||
cliOptions.dnsEnabled = enodeDnsConfiguration.dnsEnabled(); | ||
cliOptions.dnsUpdateEnabled = enodeDnsConfiguration.updateEnabled(); | ||
return cliOptions; | ||
} | ||
|
||
public Boolean getDnsEnabled() { | ||
return dnsEnabled; | ||
} | ||
|
||
public Boolean getDnsUpdateEnabled() { | ||
return dnsUpdateEnabled; | ||
} | ||
|
||
@Override | ||
public EnodeDnsConfiguration toDomainObject() { | ||
return ImmutableEnodeDnsConfiguration.builder() | ||
.updateEnabled(dnsUpdateEnabled) | ||
.dnsEnabled(dnsEnabled) | ||
.build(); | ||
} | ||
|
||
@Override | ||
public List<String> getCLIOptions() { | ||
return Arrays.asList( | ||
DNS_ENABLED, dnsEnabled.toString(), DNS_UPDATE_ENABLED, dnsUpdateEnabled.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
besu/src/main/java/org/hyperledger/besu/cli/options/unstable/MiningOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.unstable; | ||
|
||
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_REMOTE_SEALERS_LIMIT; | ||
import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_REMOTE_SEALERS_TTL; | ||
|
||
import picocli.CommandLine; | ||
|
||
public class MiningOptions { | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xminer-remote-sealers-limit"}, | ||
description = | ||
"Limits the number of remote sealers that can submit their hashrates (default: ${DEFAULT-VALUE})") | ||
private final Integer remoteSealersLimit = DEFAULT_REMOTE_SEALERS_LIMIT; | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xminer-remote-sealers-hashrate-ttl"}, | ||
description = | ||
"Specifies the lifetime of each entry in the cache. An entry will be automatically deleted if no update has been received before the deadline (default: ${DEFAULT-VALUE} minutes)") | ||
private final Long remoteSealersTimeToLive = DEFAULT_REMOTE_SEALERS_TTL; | ||
|
||
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) // PicoCLI requires non-final Strings. | ||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xminer-stratum-extranonce"}, | ||
description = "Extranonce for Stratum network miners (default: ${DEFAULT-VALUE})") | ||
private String stratumExtranonce = "080c"; | ||
|
||
public static MiningOptions create() { | ||
return new MiningOptions(); | ||
} | ||
|
||
public Integer getRemoteSealersLimit() { | ||
return remoteSealersLimit; | ||
} | ||
|
||
public Long getRemoteSealersTimeToLive() { | ||
return remoteSealersTimeToLive; | ||
} | ||
|
||
public String getStratumExtranonce() { | ||
return stratumExtranonce; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
besu/src/main/java/org/hyperledger/besu/cli/options/unstable/NatOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.unstable; | ||
|
||
import static org.hyperledger.besu.nat.kubernetes.KubernetesNatManager.DEFAULT_BESU_SERVICE_NAME_FILTER; | ||
|
||
import picocli.CommandLine; | ||
|
||
public class NatOptions { | ||
|
||
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) // PicoCLI requires non-final Strings. | ||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xnat-kube-service-name"}, | ||
description = | ||
"Specify the name of the service that will be used by the nat manager in Kubernetes. (default: ${DEFAULT-VALUE})") | ||
private String natManagerServiceName = DEFAULT_BESU_SERVICE_NAME_FILTER; | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xnat-method-fallback-enabled"}, | ||
description = | ||
"Enable fallback to NONE for the nat manager in case of failure. If False BESU will exit on failure. (default: ${DEFAULT-VALUE})", | ||
arity = "1") | ||
private final Boolean natMethodFallbackEnabled = true; | ||
|
||
public static NatOptions create() { | ||
return new NatOptions(); | ||
} | ||
|
||
public String getNatManagerServiceName() { | ||
return natManagerServiceName; | ||
} | ||
|
||
public Boolean getNatMethodFallbackEnabled() { | ||
return natMethodFallbackEnabled; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
besu/src/main/java/org/hyperledger/besu/cli/options/unstable/NativeLibraryOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.unstable; | ||
|
||
import picocli.CommandLine; | ||
|
||
public class NativeLibraryOptions { | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xsecp256k1-native-enabled"}, | ||
description = "Path to PID file (optional)", | ||
arity = "1") | ||
private final Boolean nativeSecp256k1 = Boolean.TRUE; | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xaltbn128-native-enabled"}, | ||
description = "Path to PID file (optional)", | ||
arity = "1") | ||
private final Boolean nativeAltbn128 = Boolean.TRUE; | ||
|
||
public static NativeLibraryOptions create() { | ||
return new NativeLibraryOptions(); | ||
} | ||
|
||
public Boolean getNativeSecp256k1() { | ||
return nativeSecp256k1; | ||
} | ||
|
||
public Boolean getNativeAltbn128() { | ||
return nativeAltbn128; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
besu/src/main/java/org/hyperledger/besu/cli/options/unstable/RPCOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.unstable; | ||
|
||
import org.hyperledger.besu.ethereum.api.handlers.TimeoutOptions; | ||
|
||
import picocli.CommandLine; | ||
|
||
public class RPCOptions { | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xhttp-timeout-seconds"}, | ||
description = "HTTP timeout in seconds (default: ${DEFAULT-VALUE})", | ||
arity = "1") | ||
private final Long httpTimeoutSec = TimeoutOptions.defaultOptions().getTimeoutSeconds(); | ||
|
||
@CommandLine.Option( | ||
hidden = true, | ||
names = {"--Xws-timeout-seconds"}, | ||
description = "Web socket timeout in seconds (default: ${DEFAULT-VALUE})", | ||
arity = "1") | ||
private final Long wsTimeoutSec = TimeoutOptions.defaultOptions().getTimeoutSeconds(); | ||
|
||
public static RPCOptions create() { | ||
return new RPCOptions(); | ||
} | ||
|
||
public Long getHttpTimeoutSec() { | ||
return httpTimeoutSec; | ||
} | ||
|
||
public Long getWsTimeoutSec() { | ||
return wsTimeoutSec; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.