-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplifying BesuCommand step 1 #7682
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
84a76d5
reference tests pass
jflo 7898eb4
Merge branch 'main' into cliOptionGroups
jflo 656b8d5
Merge branch 'main' into cliOptionGroups
jflo eb6f892
Merge branch 'main' into cliOptionGroups
jflo d5f0401
Merge branch 'main' into cliOptionGroups
jflo 598f9f5
Merge branch 'main' into cliOptionGroups
jflo 351b0f6
cleanup
jflo 49565a9
Merge branch 'main' into cliOptionGroups
jflo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
305 changes: 54 additions & 251 deletions
305
besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
36 changes: 36 additions & 0 deletions
36
besu/src/main/java/org/hyperledger/besu/cli/options/stable/EngineRPCConfiguration.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,36 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu. | ||
* | ||
* 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.stable; | ||
|
||
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty; | ||
|
||
import java.nio.file.Path; | ||
|
||
/** | ||
* Command line options for configuring Engine RPC on the node. | ||
* | ||
* @param overrideEngineRpcEnabled enable the engine api, even in the absence of merge-specific | ||
* configurations. | ||
* @param engineRpcPort Port to provide consensus client APIS on | ||
* @param engineJwtKeyFile Path to file containing shared secret key for JWT signature verification | ||
* @param isEngineAuthDisabled Disable authentication for Engine APIs | ||
* @param engineHostsAllowlist List of hosts to allowlist for Engine APIs | ||
*/ | ||
public record EngineRPCConfiguration( | ||
Boolean overrideEngineRpcEnabled, | ||
Integer engineRpcPort, | ||
Path engineJwtKeyFile, | ||
Boolean isEngineAuthDisabled, | ||
JsonRPCAllowlistHostsProperty engineHostsAllowlist) {} |
81 changes: 81 additions & 0 deletions
81
besu/src/main/java/org/hyperledger/besu/cli/options/stable/EngineRPCOptions.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,81 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu. | ||
* | ||
* 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.stable; | ||
|
||
import static org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration.DEFAULT_ENGINE_JSON_RPC_PORT; | ||
|
||
import org.hyperledger.besu.cli.DefaultCommandValues; | ||
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty; | ||
import org.hyperledger.besu.cli.options.CLIOptions; | ||
import org.hyperledger.besu.cli.util.CommandLineUtils; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
import picocli.CommandLine; | ||
|
||
/** Command line options for configuring Engine RPC on the node. */ | ||
public class EngineRPCOptions implements CLIOptions<EngineRPCConfiguration> { | ||
|
||
/** Default constructor */ | ||
public EngineRPCOptions() {} | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-rpc-enabled"}, | ||
description = "enable the engine api, even in the absence of merge-specific configurations.") | ||
private final Boolean overrideEngineRpcEnabled = false; | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-rpc-port", "--engine-rpc-http-port"}, | ||
paramLabel = DefaultCommandValues.MANDATORY_PORT_FORMAT_HELP, | ||
description = "Port to provide consensus client APIS on (default: ${DEFAULT-VALUE})", | ||
arity = "1") | ||
private final Integer engineRpcPort = DEFAULT_ENGINE_JSON_RPC_PORT; | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-jwt-secret"}, | ||
paramLabel = DefaultCommandValues.MANDATORY_FILE_FORMAT_HELP, | ||
description = "Path to file containing shared secret key for JWT signature verification") | ||
private final Path engineJwtKeyFile = null; | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-jwt-disabled"}, | ||
description = "Disable authentication for Engine APIs (default: ${DEFAULT-VALUE})") | ||
private final Boolean isEngineAuthDisabled = false; | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-host-allowlist"}, | ||
paramLabel = "<hostname>[,<hostname>...]... or * or all", | ||
description = | ||
"Comma separated list of hostnames to allow for ENGINE API access (applies to both HTTP and websockets), or * to accept any host (default: ${DEFAULT-VALUE})", | ||
defaultValue = "localhost,127.0.0.1") | ||
private final JsonRPCAllowlistHostsProperty engineHostsAllowlist = | ||
new JsonRPCAllowlistHostsProperty(); | ||
|
||
@Override | ||
public EngineRPCConfiguration toDomainObject() { | ||
return new EngineRPCConfiguration( | ||
overrideEngineRpcEnabled, | ||
engineRpcPort, | ||
engineJwtKeyFile, | ||
isEngineAuthDisabled, | ||
engineHostsAllowlist); | ||
} | ||
|
||
@Override | ||
public List<String> getCLIOptions() { | ||
return CommandLineUtils.getCLIOptions(this, new EngineRPCOptions()); | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since a lot of code has been moved out of
BesuCommand
, should also be possible to move some code out ofBesuCommandTest