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

Deprecate Xsnapsync-bft-enabled option , to be removed in future release #7930

Merged
merged 28 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0e64e9e
Move snapsync-bft-enabled to stable options
Nov 26, 2024
2bdf27d
Merge branch 'main' into 7924-bft-snapsync
pullurib Nov 26, 2024
84f0aab
Add deprecation comments:
Nov 28, 2024
42e7176
Changelog entry for deprecation
Nov 28, 2024
76a852f
spotlessApply
Nov 28, 2024
07141f1
Update CHANGELOG.md
pullurib Dec 2, 2024
d2aa597
Merge branch 'main' into 7924-bft-snapsync
pullurib Dec 2, 2024
a9d084f
Removed option value checking to enable snapsync for bft networks. It…
Dec 6, 2024
2c195fe
Merge branch '7924-bft-snapsync' of github.com:pullurib/besu into 792…
Dec 6, 2024
2b59bf4
Merge branch 'main' into 7924-bft-snapsync
pullurib Dec 6, 2024
e33debd
Merge branch 'main' into 7924-bft-snapsync
Jan 23, 2025
dc52953
Add acceptance tests for QBFT sync
Feb 25, 2025
1bc206a
merge main
Feb 25, 2025
649e81f
Update test
Feb 26, 2025
cbe39fe
update CHANGELOG
Feb 26, 2025
f80a18c
Merge branch 'main' into 7924-bft-snapsync
pullurib Feb 26, 2025
a4a31fd
Update besu/src/main/java/org/hyperledger/besu/cli/options/Synchroniz…
pullurib Feb 27, 2025
54c0241
Merge branch 'main' into 7924-bft-snapsync
pullurib Feb 27, 2025
eac3f3c
Merge branch 'main' into 7924-bft-snapsync
macfarla Mar 3, 2025
89d87cd
add delay to let the new validator sync
Mar 4, 2025
a93d5a1
Merge branch '7924-bft-snapsync' of github.com:pullurib/besu into 792…
Mar 4, 2025
019d94b
Merge branch 'main' into 7924-bft-snapsync
pullurib Mar 4, 2025
3836217
Merge branch 'main' into 7924-bft-snapsync
pullurib Mar 5, 2025
2de2a3a
update BFT sync AT to use conditions and timeouts
Mar 5, 2025
1285d2f
Merge branch '7924-bft-snapsync' of github.com:pullurib/besu into 792…
Mar 5, 2025
dd52a69
Merge branch 'main' into 7924-bft-snapsync
pullurib Mar 5, 2025
456dae1
Merge branch 'main' into 7924-bft-snapsync
pullurib Mar 5, 2025
2444750
Merge branch 'main' into 7924-bft-snapsync
pullurib Mar 7, 2025
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: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- `--Xbonsai-limit-trie-logs-enabled` is deprecated, use `--bonsai-limit-trie-logs-enabled` instead.
- `--Xbonsai-trie-log-pruning-enabled` is deprecated, use `--bonsai-limit-trie-logs-enabled` instead.
- `--Xbonsai-trie-logs-pruning-window-size` is deprecated, use `--bonsai-trie-logs-pruning-window-size` instead.
- `--Xsnapsync-bft-enabled` is deprecated and will be removed in a future release. SNAP sync is supported for BFT networks.
- `--tx-pool-disable-locals` has been deprecated, use `--tx-pool-no-local-priority`, instead.
- Sunsetting features - for more context on the reasoning behind the deprecation of these features, including alternative options, read [this blog post](https://www.lfdecentralizedtrust.org/blog/sunsetting-tessera-and-simplifying-hyperledger-besu)
- Tessera privacy
Expand Down Expand Up @@ -168,7 +169,6 @@ This is a hotfix to address publishing besu maven artifacts. There are no issue
- Smart-contract-based (onchain) permissioning
- Proof of Work consensus
- Fast Sync

### Additions and Improvements
- Fine tune already seen txs tracker when a tx is removed from the pool [#7755](https://github.com/hyperledger/besu/pull/7755)
- Support for enabling and configuring TLS/mTLS in WebSocket service. [#7854](https://github.com/hyperledger/besu/pull/7854)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public Condition minimumHeight(final long blockNumber) {
return new ExpectBlockNumberAbove(eth, BigInteger.valueOf(blockNumber));
}

public Condition minimumHeight(final long blockNumber, final int timeout) {
return new ExpectBlockNumberAbove(eth, BigInteger.valueOf(blockNumber), timeout);
}

public Condition reachesHeight(final BesuNode node, final int blocksAheadOfLatest) {
return new ExpectBlockNumberAbove(eth, futureHeight(node, blocksAheadOfLatest));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.hyperledger.besu.ethereum.core.MiningConfiguration;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
Expand Down Expand Up @@ -134,6 +135,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable
private Optional<Integer> exitCode = Optional.empty();
private final boolean isStrictTxReplayProtectionEnabled;
private final Map<String, String> environment;
private SynchronizerConfiguration synchronizerConfiguration;
private final Optional<KeyValueStorageFactory> storageFactory;

public BesuNode(
Expand Down Expand Up @@ -234,6 +236,7 @@ public BesuNode(
this.isDnsEnabled = isDnsEnabled;
privacyParameters.ifPresent(this::setPrivacyParameters);
this.environment = environment;
this.synchronizerConfiguration = SynchronizerConfiguration.builder().build(); // Default config
LOG.info("Created BesuNode {}", this);
}

Expand Down Expand Up @@ -855,6 +858,15 @@ public ApiConfiguration getApiConfiguration() {
return apiConfiguration;
}

public SynchronizerConfiguration getSynchronizerConfiguration() {
return synchronizerConfiguration;
}

public BesuNode setSynchronizerConfiguration(final SynchronizerConfiguration config) {
this.synchronizerConfiguration = config;
return this;
}

public Optional<KeyValueStorageFactory> getStorageFactory() {
return storageFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,20 @@ private List<String> commandlineArgs(final BesuNode node, final Path dataDir) {
params.add(node.getNetwork().name());
}

params.add("--sync-mode");
params.add("FULL");
if (node.getSynchronizerConfiguration() != null) {

if (node.getSynchronizerConfiguration().getSyncMode() != null) {
params.add("--sync-mode");
params.add(node.getSynchronizerConfiguration().getSyncMode().toString());
}
params.add("--sync-min-peers");
params.add(Integer.toString(node.getSynchronizerConfiguration().getSyncMinimumPeerCount()));
} else {
params.add("--sync-mode");
params.add("FULL");
}

params.add("--Xsnapsync-server-enabled");

params.add("--discovery-enabled");
params.add(Boolean.toString(node.isDiscoveryEnabled()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration;
import org.hyperledger.besu.ethereum.core.MiningConfiguration;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
Expand Down Expand Up @@ -73,6 +74,7 @@ public class BesuNodeConfiguration {
private final Optional<KeyPair> keyPair;
private final boolean strictTxReplayProtectionEnabled;
private final Map<String, String> environment;
private final SynchronizerConfiguration synchronizerConfiguration;
private final Optional<KeyValueStorageFactory> storageFactory;

BesuNodeConfiguration(
Expand Down Expand Up @@ -111,6 +113,7 @@ public class BesuNodeConfiguration {
final Optional<KeyPair> keyPair,
final boolean strictTxReplayProtectionEnabled,
final Map<String, String> environment,
final SynchronizerConfiguration synchronizerConfiguration,
final Optional<KeyValueStorageFactory> storageFactory) {
this.name = name;
this.miningConfiguration = miningConfiguration;
Expand Down Expand Up @@ -147,6 +150,7 @@ public class BesuNodeConfiguration {
this.keyPair = keyPair;
this.strictTxReplayProtectionEnabled = strictTxReplayProtectionEnabled;
this.environment = environment;
this.synchronizerConfiguration = synchronizerConfiguration;
this.storageFactory = storageFactory;
}

Expand Down Expand Up @@ -290,6 +294,10 @@ public Map<String, String> getEnvironment() {
return environment;
}

public SynchronizerConfiguration getSynchronizerConfiguration() {
return synchronizerConfiguration;
}

public Optional<KeyValueStorageFactory> storageImplementation() {
return storageFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues;
import org.hyperledger.besu.ethereum.core.MiningConfiguration;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
Expand Down Expand Up @@ -96,6 +97,7 @@ public class BesuNodeConfigurationBuilder {
private Optional<KeyPair> keyPair = Optional.empty();
private Boolean strictTxReplayProtectionEnabled = false;
private Map<String, String> environment = new HashMap<>();
private SynchronizerConfiguration synchronizerConfiguration;
private Optional<KeyValueStorageFactory> storageImplementation = Optional.empty();

public BesuNodeConfigurationBuilder() {
Expand Down Expand Up @@ -467,7 +469,17 @@ public BesuNodeConfigurationBuilder storageImplementation(
return this;
}

public BesuNodeConfigurationBuilder synchronizerConfiguration(
final SynchronizerConfiguration config) {
this.synchronizerConfiguration = config;
return this;
}

public BesuNodeConfiguration build() {
if (name == null) {
throw new IllegalStateException("Name is required");
}

return new BesuNodeConfiguration(
name,
dataPath,
Expand Down Expand Up @@ -504,6 +516,7 @@ public BesuNodeConfiguration build() {
keyPair,
strictTxReplayProtectionEnabled,
environment,
synchronizerConfiguration,
storageImplementation);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright contributors to Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.tests.acceptance.bft;

import org.hyperledger.besu.ethereum.eth.sync.SyncMode;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;

import java.util.stream.Stream;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

public class BftSyncAcceptanceTest extends ParameterizedBftTestBase {

private static final int TARGET_BLOCK_HEIGHT = 70;

static Stream<Arguments> syncModeTestParameters() {
return Stream.of(SyncMode.FULL, SyncMode.SNAP, SyncMode.CHECKPOINT)
.flatMap(
syncMode ->
factoryFunctions()
.map(args -> Arguments.of(args.get()[0], args.get()[1], syncMode)));
}

@ParameterizedTest(name = "{index}: {0} with {2} sync")
@MethodSource("syncModeTestParameters")
public void shouldSyncValidatorNode(
final String testName,
final BftAcceptanceTestParameterization nodeFactory,
final SyncMode syncMode)
throws Exception {
setUp(testName, nodeFactory);

// Create validator network with 4 validators
final BesuNode validator1 = nodeFactory.createBonsaiNodeFixedPort(besu, "validator1");
final BesuNode validator2 = nodeFactory.createBonsaiNodeFixedPort(besu, "validator2");
final BesuNode validator3 = nodeFactory.createBonsaiNodeFixedPort(besu, "validator3");
final BesuNode validator4 = nodeFactory.createBonsaiNodeFixedPort(besu, "validator4");

// Configure validators with specified sync mode
final SynchronizerConfiguration syncConfig =
SynchronizerConfiguration.builder().syncMode(syncMode).syncMinimumPeerCount(1).build();

validator4.setSynchronizerConfiguration(syncConfig);

// Start first three validators
cluster.start(validator1, validator2, validator3);

validator1.verify(blockchain.minimumHeight(TARGET_BLOCK_HEIGHT, TARGET_BLOCK_HEIGHT));
// Add validator4 to cluster and start
cluster.addNode(validator4);

validator4.verify(blockchain.minimumHeight(TARGET_BLOCK_HEIGHT, 60));
}
}
19 changes: 0 additions & 19 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1443,27 +1443,9 @@ private void validateOptions() {
validateTransactionPoolOptions();
validateDataStorageOptions();
validateGraphQlOptions();
validateConsensusSyncCompatibilityOptions();
validatePluginOptions();
}

private void validateConsensusSyncCompatibilityOptions() {
// snap and checkpoint are experimental for BFT
if ((genesisConfigOptionsSupplier.get().isIbftLegacy()
|| genesisConfigOptionsSupplier.get().isIbft2()
|| genesisConfigOptionsSupplier.get().isQbft())
&& !unstableSynchronizerOptions.isSnapSyncBftEnabled()) {
final String errorSuffix = "can't be used with BFT networks";
if (SyncMode.CHECKPOINT.equals(syncMode)) {
throw new ParameterException(
commandLine, String.format("%s %s", "Checkpoint sync", errorSuffix));
}
if (syncMode == SyncMode.SNAP) {
throw new ParameterException(commandLine, String.format("%s %s", "Snap sync", errorSuffix));
}
}
}

private void validatePluginOptions() {
pluginsConfigurationOptions.validate(commandLine);
}
Expand Down Expand Up @@ -2753,7 +2735,6 @@ private String generateConfigurationOverview() {
}

builder.setSnapServerEnabled(this.unstableSynchronizerOptions.isSnapsyncServerEnabled());
builder.setSnapSyncBftEnabled(this.unstableSynchronizerOptions.isSnapSyncBftEnabled());

builder.setTxPoolImplementation(buildTransactionPoolConfiguration().getTxPoolImplementation());
builder.setWorldStateUpdateMode(unstableEvmOptions.toDomainObject().worldUpdaterMode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public class ConfigurationOverviewBuilder {
private long trieLogRetentionLimit = 0;
private Integer trieLogsPruningWindowSize = null;
private boolean isSnapServerEnabled = false;
private boolean isSnapSyncBftEnabled = false;
private TransactionPoolConfiguration.Implementation txPoolImplementation;
private EvmConfiguration.WorldUpdaterMode worldStateUpdateMode;
private Map<String, String> environment;
Expand Down Expand Up @@ -246,17 +245,6 @@ public ConfigurationOverviewBuilder setSnapServerEnabled(final boolean snapServe
return this;
}

/**
* Sets snap sync BFT enabled/disabled
*
* @param snapSyncBftEnabled bool to indicate if snap sync for BFT is enabled
* @return the builder
*/
public ConfigurationOverviewBuilder setSnapSyncBftEnabled(final boolean snapSyncBftEnabled) {
isSnapSyncBftEnabled = snapSyncBftEnabled;
return this;
}

/**
* Sets trie logs pruning window size
*
Expand Down Expand Up @@ -386,10 +374,6 @@ public String build() {
lines.add("Experimental Snap Sync server enabled");
}

if (isSnapSyncBftEnabled) {
lines.add("Experimental Snap Sync for BFT enabled");
}

if (isLimitTrieLogsEnabled) {
final StringBuilder trieLogPruningString = new StringBuilder();
trieLogPruningString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,15 @@ public void parseBlockPropagationRange(final String arg) {
private Boolean checkpointPostMergeSyncEnabled =
SynchronizerConfiguration.DEFAULT_CHECKPOINT_POST_MERGE_ENABLED;

// TODO --Xsnapsync-bft-enabled is deprecated,
// remove in a future release
@CommandLine.Option(
names = SNAP_SYNC_BFT_ENABLED_FLAG,
names = SNAP_SYNC_BFT_ENABLED_FLAG, // deprecated
hidden = true,
paramLabel = "<Boolean>",
arity = "0..1",
description = "Snap sync enabled for BFT chains (default: ${DEFAULT-VALUE})")
description =
"This option is now deprecated and ignored, and will be removed in future release. Snap sync for BFT is supported by default.")
private Boolean snapsyncBftEnabled = SnapSyncConfiguration.DEFAULT_SNAP_SYNC_BFT_ENABLED;

@CommandLine.Option(
Expand Down Expand Up @@ -409,7 +412,6 @@ public static SynchronizerOptions fromConfig(final SynchronizerConfiguration con
config.getSnapSyncConfiguration().getLocalFlatStorageCountToHealPerRequest();
options.checkpointPostMergeSyncEnabled = config.isCheckpointPostMergeEnabled();
options.snapsyncServerEnabled = config.getSnapSyncConfiguration().isSnapServerEnabled();
options.snapsyncBftEnabled = config.getSnapSyncConfiguration().isSnapSyncBftEnabled();
options.snapTransactionIndexingEnabled =
config.getSnapSyncConfiguration().isSnapSyncTransactionIndexingEnabled();
return options;
Expand Down Expand Up @@ -444,7 +446,6 @@ public SynchronizerConfiguration.Builder toDomainObject() {
.localFlatAccountCountToHealPerRequest(snapsyncFlatAccountHealedCountPerRequest)
.localFlatStorageCountToHealPerRequest(snapsyncFlatStorageHealedCountPerRequest)
.isSnapServerEnabled(snapsyncServerEnabled)
.isSnapSyncBftEnabled(snapsyncBftEnabled)
.isSnapSyncTransactionIndexingEnabled(snapTransactionIndexingEnabled)
.build());
builder.checkpointPostMergeEnabled(checkpointPostMergeSyncEnabled);
Expand Down Expand Up @@ -504,8 +505,6 @@ public List<String> getCLIOptions() {
OptionParser.format(snapsyncFlatStorageHealedCountPerRequest),
SNAP_SERVER_ENABLED_FLAG,
OptionParser.format(snapsyncServerEnabled),
SNAP_SYNC_BFT_ENABLED_FLAG,
OptionParser.format(snapsyncBftEnabled),
SNAP_TRANSACTION_INDEXING_ENABLED_FLAG,
OptionParser.format(snapTransactionIndexingEnabled));
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ public Boolean isSnapServerEnabled() {
return DEFAULT_SNAP_SERVER_ENABLED;
}

@Value.Default
public Boolean isSnapSyncBftEnabled() {
return DEFAULT_SNAP_SYNC_BFT_ENABLED;
}

@Value.Default
public Boolean isSnapSyncTransactionIndexingEnabled() {
return DEFAULT_SNAP_SYNC_TRANSACTION_INDEXING_ENABLED;
Expand Down