From 3c96ebaf09679c098722b9c260ce86f6a69f4288 Mon Sep 17 00:00:00 2001 From: Matilda Clerke Date: Mon, 14 Oct 2024 09:13:20 +1100 Subject: [PATCH 01/12] 7311: Update changelog Signed-off-by: Matilda Clerke --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c26ef6e77..91a23d61fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ### Breaking Changes +- Added isLabelsObserved to LabelledGauge in plugin-api. Implementing classes will need to also implement this method ### Upcoming Breaking Changes From 1029c512cb9182e6d2ce61b8ca28299ffa537946 Mon Sep 17 00:00:00 2001 From: Justin Florentine Date: Sun, 13 Oct 2024 20:55:32 -0400 Subject: [PATCH 02/12] communicate out option removal (#7762) Signed-off-by: Justin Florentine --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c26ef6e77..c4e31932cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ ### Upcoming Breaking Changes - k8s (KUBERNETES) Nat method is now deprecated and will be removed in a future release +- `--host-whitelist` has been deprecated in favor of `--host-allowlist` since 2020 and will be removed in a future release ### Additions and Improvements - Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569) From fd50a3e0afd4e20ee718fcbfd176dda074b5874d Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Mon, 14 Oct 2024 11:19:35 +1000 Subject: [PATCH 03/12] [TEST] extra testing for host and port default values (#7741) * extra test for host and port leak Signed-off-by: Sally MacFarlane --------- Signed-off-by: Sally MacFarlane --- .../hyperledger/besu/cli/BesuCommandTest.java | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java index de209f65e4..e5848ee5f3 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java @@ -1014,7 +1014,7 @@ public class BesuCommandTest extends CommandTestAbstract { } @Test - public void p2pHostAndPortOptionsAreRespected() { + public void p2pHostAndPortOptionsAreRespectedAndNotLeaked() { final String host = "1.2.3.4"; final int port = 1234; @@ -1022,6 +1022,8 @@ public class BesuCommandTest extends CommandTestAbstract { verify(mockRunnerBuilder).p2pAdvertisedHost(stringArgumentCaptor.capture()); verify(mockRunnerBuilder).p2pListenPort(intArgumentCaptor.capture()); + verify(mockRunnerBuilder).metricsConfiguration(metricsConfigArgumentCaptor.capture()); + verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture()); verify(mockRunnerBuilder).build(); assertThat(stringArgumentCaptor.getValue()).isEqualTo(host); @@ -1030,11 +1032,47 @@ public class BesuCommandTest extends CommandTestAbstract { assertThat(commandOutput.toString(UTF_8)).isEmpty(); assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); - // rpc host should remain default ie 127.0.0.1 + // all other port values remain default + assertThat(metricsConfigArgumentCaptor.getValue().getPort()).isEqualTo(9545); + assertThat(metricsConfigArgumentCaptor.getValue().getPushPort()).isEqualTo(9001); + assertThat(jsonRpcConfigArgumentCaptor.getValue().getPort()).isEqualTo(8545); + + // all other host values remain default + final String defaultHost = "127.0.0.1"; + assertThat(metricsConfigArgumentCaptor.getValue().getHost()).isEqualTo(defaultHost); + assertThat(metricsConfigArgumentCaptor.getValue().getPushHost()).isEqualTo(defaultHost); + assertThat(jsonRpcConfigArgumentCaptor.getValue().getHost()).isEqualTo(defaultHost); + } + + @Test + public void p2pHostAndPortOptionsAreRespectedAndNotLeakedWithMetricsEnabled() { + + final String host = "1.2.3.4"; + final int port = 1234; + parseCommand("--p2p-host", host, "--p2p-port", String.valueOf(port), "--metrics-enabled"); + + verify(mockRunnerBuilder).p2pAdvertisedHost(stringArgumentCaptor.capture()); + verify(mockRunnerBuilder).p2pListenPort(intArgumentCaptor.capture()); + verify(mockRunnerBuilder).metricsConfiguration(metricsConfigArgumentCaptor.capture()); verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture()); verify(mockRunnerBuilder).build(); - assertThat(jsonRpcConfigArgumentCaptor.getValue().getHost()).isEqualTo("127.0.0.1"); + assertThat(stringArgumentCaptor.getValue()).isEqualTo(host); + assertThat(intArgumentCaptor.getValue()).isEqualTo(port); + + assertThat(commandOutput.toString(UTF_8)).isEmpty(); + assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); + + // all other port values remain default + assertThat(metricsConfigArgumentCaptor.getValue().getPort()).isEqualTo(9545); + assertThat(metricsConfigArgumentCaptor.getValue().getPushPort()).isEqualTo(9001); + assertThat(jsonRpcConfigArgumentCaptor.getValue().getPort()).isEqualTo(8545); + + // all other host values remain default + final String defaultHost = "127.0.0.1"; + assertThat(metricsConfigArgumentCaptor.getValue().getHost()).isEqualTo(defaultHost); + assertThat(metricsConfigArgumentCaptor.getValue().getPushHost()).isEqualTo(defaultHost); + assertThat(jsonRpcConfigArgumentCaptor.getValue().getHost()).isEqualTo(defaultHost); } @Test @@ -2285,7 +2323,7 @@ public class BesuCommandTest extends CommandTestAbstract { } @Test - public void staticNodesFileOptionValidParamenter() throws IOException { + public void staticNodesFileOptionValidParameter() throws IOException { final Path staticNodeTempFile = createTempFile( "static-nodes-goodformat.json", From 5330e5ae6d47cf426dad191b6eb8e56ce1a6bde9 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 15 Oct 2024 06:17:09 +1000 Subject: [PATCH 04/12] Disable --Xsnapsync-to-head-enabled by default (#7764) Signed-off-by: Simon Dudley --- CHANGELOG.md | 2 +- .../besu/ethereum/eth/sync/snapsync/SnapSyncConfiguration.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4e31932cc..dafa6c3f49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ - Interrupt pending transaction processing on block creation timeout [#7673](https://github.com/hyperledger/besu/pull/7673) - Align gas cap calculation for transaction simulation to Geth approach [#7703](https://github.com/hyperledger/besu/pull/7703) - Expose chainId in the `BlockchainService` [7702](https://github.com/hyperledger/besu/pull/7702) -- Use head block instead of safe block for snap sync [7536](https://github.com/hyperledger/besu/issues/7536) +- Add `--Xsnapsync-to-head-enabled` feature to use head block instead of safe block for snap sync [7536](https://github.com/hyperledger/besu/issues/7536) - Add support for `chainId` in `CallParameters` [#7720](https://github.com/hyperledger/besu/pull/7720) - Add `--ephemery` network support for Ephemery Testnet [#7563](https://github.com/hyperledger/besu/pull/7563) thanks to [@gconnect](https://github.com/gconnect) - Add configuration of Consolidation Request Contract Address via genesis configuration [#7647](https://github.com/hyperledger/besu/pull/7647) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/SnapSyncConfiguration.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/SnapSyncConfiguration.java index 79f3d5cba5..f49005c3fe 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/SnapSyncConfiguration.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/snapsync/SnapSyncConfiguration.java @@ -40,7 +40,7 @@ public class SnapSyncConfiguration { public static final Boolean DEFAULT_SNAP_SYNC_BFT_ENABLED = Boolean.FALSE; - public static final Boolean DEFAULT_SNAP_SYNC_TO_HEAD_ENABLED_FLAG = Boolean.TRUE; + public static final Boolean DEFAULT_SNAP_SYNC_TO_HEAD_ENABLED_FLAG = Boolean.FALSE; public static SnapSyncConfiguration getDefault() { return ImmutableSnapSyncConfiguration.builder().build(); From b6a09cd1363f33ab1077f3e59b47f6f32d364af6 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 15 Oct 2024 10:35:45 +1000 Subject: [PATCH 05/12] revert "7536 use head for snap sync (#7718)" (#7767) This reverts commit a7e1f6ace0167bbaff89f00f7a0e94747160a06b. Signed-off-by: Simon Dudley --- CHANGELOG.md | 1 - .../org/hyperledger/besu/cli/BesuCommand.java | 1 - .../cli/ConfigurationOverviewBuilder.java | 17 -- .../options/unstable/SynchronizerOptions.java | 26 +-- .../controller/BesuControllerBuilder.java | 30 +--- .../MergeBesuControllerBuilderTest.java | 39 +--- .../sync/fastsync/PivotSelectorFromBlock.java | 167 ------------------ .../fastsync/PivotSelectorFromHeadBlock.java | 58 ------ .../fastsync/PivotSelectorFromSafeBlock.java | 138 +++++++++++++-- .../sync/snapsync/SnapSyncConfiguration.java | 7 - .../sync/snapsync/SnapSyncMetricsManager.java | 4 +- .../sync/fastsync/FastSyncActionsTest.java | 52 +----- 12 files changed, 133 insertions(+), 407 deletions(-) delete mode 100644 ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/PivotSelectorFromBlock.java delete mode 100644 ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/PivotSelectorFromHeadBlock.java diff --git a/CHANGELOG.md b/CHANGELOG.md index dafa6c3f49..e8be9d25b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,6 @@ - Interrupt pending transaction processing on block creation timeout [#7673](https://github.com/hyperledger/besu/pull/7673) - Align gas cap calculation for transaction simulation to Geth approach [#7703](https://github.com/hyperledger/besu/pull/7703) - Expose chainId in the `BlockchainService` [7702](https://github.com/hyperledger/besu/pull/7702) -- Add `--Xsnapsync-to-head-enabled` feature to use head block instead of safe block for snap sync [7536](https://github.com/hyperledger/besu/issues/7536) - Add support for `chainId` in `CallParameters` [#7720](https://github.com/hyperledger/besu/pull/7720) - Add `--ephemery` network support for Ephemery Testnet [#7563](https://github.com/hyperledger/besu/pull/7563) thanks to [@gconnect](https://github.com/gconnect) - Add configuration of Consolidation Request Contract Address via genesis configuration [#7647](https://github.com/hyperledger/besu/pull/7647) 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 678b489baf..b21305c87a 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -2739,7 +2739,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable { builder.setSnapServerEnabled(this.unstableSynchronizerOptions.isSnapsyncServerEnabled()); builder.setSnapSyncBftEnabled(this.unstableSynchronizerOptions.isSnapSyncBftEnabled()); - builder.setSnapSyncToHeadEnabled(this.unstableSynchronizerOptions.isSnapSyncToHeadEnabled()); builder.setTxPoolImplementation(buildTransactionPoolConfiguration().getTxPoolImplementation()); builder.setWorldStateUpdateMode(unstableEvmOptions.toDomainObject().worldUpdaterMode()); diff --git a/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java b/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java index fc11ed84f8..abaa127270 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/ConfigurationOverviewBuilder.java @@ -58,7 +58,6 @@ public class ConfigurationOverviewBuilder { private Integer trieLogsPruningWindowSize = null; private boolean isSnapServerEnabled = false; private boolean isSnapSyncBftEnabled = false; - private boolean isSnapSyncToHeadEnabled = true; private TransactionPoolConfiguration.Implementation txPoolImplementation; private EvmConfiguration.WorldUpdaterMode worldStateUpdateMode; private Map environment; @@ -258,18 +257,6 @@ public class ConfigurationOverviewBuilder { return this; } - /** - * Sets snap sync to head enabled/disabled - * - * @param snapSyncToHeadEnabled bool to indicate if snap sync to head is enabled - * @return the builder - */ - public ConfigurationOverviewBuilder setSnapSyncToHeadEnabled( - final boolean snapSyncToHeadEnabled) { - isSnapSyncToHeadEnabled = snapSyncToHeadEnabled; - return this; - } - /** * Sets trie logs pruning window size * @@ -402,10 +389,6 @@ public class ConfigurationOverviewBuilder { lines.add("Experimental Snap Sync for BFT enabled"); } - if (isSnapSyncToHeadEnabled) { - lines.add("Snap Sync to Head enabled"); - } - if (isBonsaiLimitTrieLogsEnabled) { final StringBuilder trieLogPruningString = new StringBuilder(); trieLogPruningString diff --git a/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java b/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java index e8a330c2ef..816d9df00a 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java @@ -87,8 +87,6 @@ public class SynchronizerOptions implements CLIOptions