Skip to content
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

Plugin API - deprecate methods returning optional RPC host/port #8127

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
- Smart-contract-based (onchain) permissioning
- Proof of Work consensus
- Fast Sync
- Plugins
- `BesuConfiguration` methods `getRpcHttpHost` and `getRpcHttpPort` (which return Optionals) have been deprecated in favour of `getConfiguredRpcHttpHost` and `getConfiguredRpcHttpPort` which return the actual values, which will always be populated since these options have defaults. [#8127](https://github.com/hyperledger/besu/pull/8127)

### Additions and Improvements
- Add RPC HTTP options to specify custom truststore and its password [#7978](https://github.com/hyperledger/besu/pull/7978)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public class BesuConfigurationImpl implements BesuConfiguration {

// defaults
private MiningConfiguration miningConfiguration;
private Optional<String> rpcHttpHost = Optional.of("http://localhost");
private Optional<Integer> rpcHttpPort = Optional.of(8545);
private String rpcHttpHost = "http://localhost";
private Integer rpcHttpPort = 8545;

/** Default Constructor. */
public BesuConfigurationImpl() {}
Expand Down Expand Up @@ -74,18 +74,30 @@ public BesuConfigurationImpl withMiningParameters(final MiningConfiguration mini
* @return BesuConfigurationImpl instance
*/
public BesuConfigurationImpl withJsonRpcHttpOptions(final JsonRpcHttpOptions rpcHttpOptions) {
this.rpcHttpHost = Optional.ofNullable(rpcHttpOptions.getRpcHttpHost());
this.rpcHttpPort = Optional.ofNullable(rpcHttpOptions.getRpcHttpPort());
this.rpcHttpHost = rpcHttpOptions.getRpcHttpHost();
this.rpcHttpPort = rpcHttpOptions.getRpcHttpPort();
return this;
}

@Deprecated
@Override
public Optional<String> getRpcHttpHost() {
return rpcHttpHost;
return Optional.of(rpcHttpHost);
}

@Deprecated
@Override
public Optional<Integer> getRpcHttpPort() {
return Optional.of(rpcHttpPort);
}

@Override
public String getConfiguredRpcHttpHost() {
return rpcHttpHost;
}

@Override
public Integer getConfiguredRpcHttpPort() {
return rpcHttpPort;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ public Optional<Integer> getRpcHttpPort() {
return Optional.empty();
}

@Override
public String getConfiguredRpcHttpHost() {
return "";
}

@Override
public Integer getConfiguredRpcHttpPort() {
return 0;
}

@Override
public Path getStoragePath() {
return tempData.resolve("database");
Expand Down
2 changes: 1 addition & 1 deletion plugin-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'E2b/W+IKnNxo6L7cHuijBMBUewHHRrkQ8dEVlcql5KE='
knownHash = 'V1dUr46JD2WQNMgrl2KqCeCro0y1MI03xT7/go9toj0='
}
check.dependsOn('checkAPIChanges')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,31 @@ public interface BesuConfiguration extends BesuService {
*
* @return the configured RPC http host.
*/
@Deprecated(since = "25.1.0")
Optional<String> getRpcHttpHost();

/**
* Get the configured RPC http port.
*
* @return the configured RPC http port.
*/
@Deprecated(since = "25.1.0")
Optional<Integer> getRpcHttpPort();

/**
* Get the configured RPC http host.
*
* @return the configured RPC http host.
*/
String getConfiguredRpcHttpHost();

/**
* Get the configured RPC http port.
*
* @return the configured RPC http port.
*/
Integer getConfiguredRpcHttpPort();

/**
* Location of the working directory of the storage in the file system running the client.
*
Expand Down
Loading