From 486dd39a0c7dbc673739cef2fc7dbf3ff2439c5e Mon Sep 17 00:00:00 2001 From: Preeti <35308865+pr9t@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:16:11 +0530 Subject: [PATCH 1/4] Chore:Removed Deprecated --host-whitelist option Signed-off-by: Preeti <35308865+pr9t@users.noreply.github.com> --- benchmark/docker-compose.yml | 4 +- .../org/hyperledger/besu/cli/BesuCommand.java | 18 +-------- .../besu/cli/HostAllowlistOptionsTest.java | 40 ++----------------- 3 files changed, 7 insertions(+), 55 deletions(-) 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..b473acaea63 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,7 @@ 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..da7537302cc 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java @@ -14,32 +14,15 @@ */ package org.hyperledger.besu.cli; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verify; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - 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() { @@ -89,22 +72,7 @@ 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() { From e90da72ac4989d22a238eb474dd1340add29713a Mon Sep 17 00:00:00 2001 From: Preeti <35308865+pr9t@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:29:58 +0530 Subject: [PATCH 2/4] chore: Update everything_config.toml and Updated upcoming Breaking Change in CHANGELOG.md file Signed-off-by: Preeti <35308865+pr9t@users.noreply.github.com> --- CHANGELOG.md | 2 ++ besu/src/test/resources/everything_config.toml | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 462bb8bd17b..d2fd7903432 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ - Proof of Work consensus - Fast Sync +- `--host-whitelist` has been deprecated since 2020 and its related option will be removed in a future release. + ### Additions and Improvements ### Bug fixes 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 From 28ee432088922766e38fe9f5089276f450b8f1bd Mon Sep 17 00:00:00 2001 From: Preeti <35308865+pr9t@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:29:58 +0530 Subject: [PATCH 3/4] chore: Updated Breaking Change in CHANGELOG.md file Signed-off-by: Preeti <35308865+pr9t@users.noreply.github.com> --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2fd7903432..6046fec88ef 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,7 +16,7 @@ - Proof of Work consensus - Fast Sync -- `--host-whitelist` has been deprecated since 2020 and its related option will be removed in a future release. + ### Additions and Improvements From 037c80148d87e8edb393d72a032295c9f67165f0 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Wed, 11 Dec 2024 20:36:09 +1000 Subject: [PATCH 4/4] formatting Signed-off-by: Sally MacFarlane --- .../main/java/org/hyperledger/besu/cli/BesuCommand.java | 1 - .../hyperledger/besu/cli/HostAllowlistOptionsTest.java | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) 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 b473acaea63..21cb787f52b 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -1693,7 +1693,6 @@ private void configure() throws Exception { unstableIpcOptions.getRpcIpcApis()); inProcessRpcConfiguration = inProcessRpcOptions.toDomainObject(); dataStorageConfiguration = getDataStorageConfiguration(); - 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 da7537302cc..21dd587ce7f 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/HostAllowlistOptionsTest.java @@ -14,15 +14,14 @@ */ package org.hyperledger.besu.cli; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verify; -public class HostAllowlistOptionsTest extends CommandTestAbstract { +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +public class HostAllowlistOptionsTest extends CommandTestAbstract { @Test public void rpcHttpHostAllowlistAcceptsSingleArgument() { @@ -72,8 +71,6 @@ public void rpcHttpHostAllowlistAcceptsDoubleComma() { assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); } - - @Test public void rpcHttpHostAllowlistAcceptsMultipleFlags() { parseCommand("--host-allowlist=a", "--host-allowlist=b");