Skip to content

Commit

Permalink
Chore!: Removed Deprecated --host-whitelist option (#8012)
Browse files Browse the repository at this point in the history
* Chore:Removed Deprecated --host-whitelist option
* chore: Update everything_config.toml and Updated upcoming Breaking Change in  CHANGELOG.md file

Signed-off-by: Preeti <35308865+pr9t@users.noreply.github.com>

---------

Signed-off-by: Preeti <35308865+pr9t@users.noreply.github.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
pr9t and macfarla authored Dec 11, 2024
1 parent 7e58f58 commit e2bd137
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 55 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

### Breaking Changes
- `--host-whitelist` has been deprecated since 2020 and its related option will be removed in a future release.

### Upcoming Breaking Changes
- Plugin API will be deprecating the BesuContext interface to be replaced with the ServiceManager interface.
Expand All @@ -15,6 +16,8 @@
- Proof of Work consensus
- Fast Sync



### Additions and Improvements
- Retrieve all transaction receipts for a block in one request [#6646](https://github.com/hyperledger/besu/pull/6646)

Expand Down
4 changes: 2 additions & 2 deletions benchmark/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ services:
- --rpc-ws-enabled
- --rpc-ws-apis=admin,eth,miner,web3,net,priv,eea
- --rpc-ws-host=0.0.0.0
- --host-whitelist=*
- --host-allowlist=*
- --graphql-http-enabled
- --discovery-enabled=false
- --privacy-enabled=true
Expand All @@ -84,7 +84,7 @@ services:
- --rpc-ws-enabled
- --rpc-ws-apis=admin,eth,miner,web3,net,priv,eea
- --rpc-ws-host=0.0.0.0
- --host-whitelist=*
- --host-allowlist=*
- --graphql-http-enabled
- --discovery-enabled=false
- --privacy-enabled=true
Expand Down
17 changes: 0 additions & 17 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -610,14 +610,6 @@ static class PrivacyOptionGroup {
defaultValue = "localhost,127.0.0.1")
private final JsonRPCAllowlistHostsProperty hostsAllowlist = new JsonRPCAllowlistHostsProperty();

@Option(
names = {"--host-whitelist"},
hidden = true,
paramLabel = "<hostname>[,<hostname>...]... or * or all",
description =
"Deprecated in favor of --host-allowlist. Comma separated list of hostnames to allow for RPC access, or * to accept any host (default: ${DEFAULT-VALUE})")
private final JsonRPCAllowlistHostsProperty hostsWhitelist = new JsonRPCAllowlistHostsProperty();

@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"})
@Option(
names = {"--color-enabled"},
Expand Down Expand Up @@ -1701,15 +1693,6 @@ private void configure() throws Exception {
unstableIpcOptions.getRpcIpcApis());
inProcessRpcConfiguration = inProcessRpcOptions.toDomainObject();
dataStorageConfiguration = getDataStorageConfiguration();
// hostsWhitelist is a hidden option. If it is specified, add the list to hostAllowlist
if (!hostsWhitelist.isEmpty()) {
// if allowlist == default values, remove the default values
if (hostsAllowlist.size() == 2
&& hostsAllowlist.containsAll(List.of("localhost", "127.0.0.1"))) {
hostsAllowlist.removeAll(List.of("localhost", "127.0.0.1"));
}
hostsAllowlist.addAll(hostsWhitelist);
}

permissioningConfiguration = permissioningConfiguration();
staticNodes = loadStaticNodes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,6 @@

public class HostAllowlistOptionsTest extends CommandTestAbstract {

/** test deprecated CLI option * */
@Deprecated
@Test
public void rpcHttpHostWhitelistAcceptsSingleArgument() {
parseCommand("--host-whitelist", "a");

verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();

assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist().size()).isEqualTo(1);
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist()).contains("a");
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist())
.doesNotContain("localhost");

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void rpcHttpHostAllowlistAcceptsSingleArgument() {
parseCommand("--host-allowlist", "a");
Expand Down Expand Up @@ -89,23 +71,6 @@ public void rpcHttpHostAllowlistAcceptsDoubleComma() {
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Deprecated
@Test
public void rpcHttpHostWhitelistAllowlistAcceptsMultipleFlags() {
parseCommand("--host-whitelist=a", "--host-allowlist=b");

verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();

assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist().size()).isEqualTo(2);
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist()).contains("a", "b");
assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsAllowlist())
.doesNotContain("*", "localhost");

assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}

@Test
public void rpcHttpHostAllowlistAcceptsMultipleFlags() {
parseCommand("--host-allowlist=a", "--host-allowlist=b");
Expand Down
1 change: 0 additions & 1 deletion besu/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ max-peers=42
remote-connections-limit-enabled=true
remote-connections-max-percentage=60
random-peer-priority-enabled=false
host-whitelist=["all"]
host-allowlist=["all"]
engine-host-allowlist=["all"]
engine-rpc-enabled=true
Expand Down

0 comments on commit e2bd137

Please sign in to comment.