From e2bd137202ef6f19b3e6e0b69b4c9b817455d9a0 Mon Sep 17 00:00:00 2001 From: Preeti <35308865+pr9t@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:33:52 +0530 Subject: [PATCH] Chore!: Removed Deprecated `--host-whitelist` option (#8012) * 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 --- CHANGELOG.md | 3 ++ benchmark/docker-compose.yml | 4 +-- .../org/hyperledger/besu/cli/BesuCommand.java | 17 --------- .../besu/cli/HostAllowlistOptionsTest.java | 35 ------------------- .../src/test/resources/everything_config.toml | 1 - 5 files changed, 5 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7c2504a4e9..3047e298c83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. @@ -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) diff --git a/benchmark/docker-compose.yml b/benchmark/docker-compose.yml index a62afa7b151..40cc0baeabc 100644 --- a/benchmark/docker-compose.yml +++ b/benchmark/docker-compose.yml @@ -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 @@ -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 diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index b5bfa9182fc..21cb787f52b 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -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 = "[,...]... 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"}, @@ -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(); diff --git a/besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java b/besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java index c1f867f4892..21dd587ce7f 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java @@ -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"); @@ -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"); diff --git a/besu/src/test/resources/everything_config.toml b/besu/src/test/resources/everything_config.toml index 3904fe90d87..402d5962765 100644 --- a/besu/src/test/resources/everything_config.toml +++ b/besu/src/test/resources/everything_config.toml @@ -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