Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4c64dbe
7311: Add feature toggle for enabling use of the peertask system wher…
Matilda-Clerke Sep 17, 2024
7a94fe2
7311: Remove log used for testing, apply spotless
Matilda-Clerke Sep 17, 2024
ace5dd1
7311: Add private constructor to PeerTaskFeatureToggle to prevent ins…
Matilda-Clerke Sep 17, 2024
52d440a
7311: Switch to logging a warning instead of throwing an exception wh…
Matilda-Clerke Sep 17, 2024
f392a0f
7311: Update javadoc to match previous commit
Matilda-Clerke Sep 17, 2024
2fb2690
7311: spotless
Matilda-Clerke Sep 17, 2024
f14aaeb
7311: Fix broken BesuCommandTest
Matilda-Clerke Sep 18, 2024
f2500dd
7311: Move PeerTaskFeatureToggle to more appropriate location
Matilda-Clerke Sep 18, 2024
33b810b
7311: add X prefix to peertask-system-enabled
Matilda-Clerke Sep 18, 2024
15b6bdf
7311: Move --Xpeertask-system-enabled out of BesuCommand and make hidden
Matilda-Clerke Sep 18, 2024
e3fbc6c
7311: spotless
Matilda-Clerke Sep 18, 2024
5e8b750
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
macfarla Sep 18, 2024
bc11e0c
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke Sep 18, 2024
513b74f
7311: Move isPeerTaskSystemEnabled to SynchronizerOptions
Matilda-Clerke Sep 19, 2024
6b86919
Merge remote-tracking branch 'origin/7311-add-cli-feature-toggle-for-…
Matilda-Clerke Sep 19, 2024
2364ed5
7311: Fix javadoc issue
Matilda-Clerke Sep 19, 2024
98aefcd
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke Sep 20, 2024
6e734f9
7311: Remove PeerTaskFeatureToggle in favor of including isPeerTaskSy…
Matilda-Clerke Sep 20, 2024
42ca85b
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke Sep 20, 2024
8dedc79
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke Sep 20, 2024
fee09c3
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke Sep 23, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.hyperledger.besu.cli.util.CommandLineUtils;
import org.hyperledger.besu.ethereum.api.tls.FileBasedPasswordProvider;
import org.hyperledger.besu.ethereum.eth.manager.peertask.PeerTaskFeatureToggle;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.TLSConfiguration;

import java.nio.file.Path;
Expand Down Expand Up @@ -103,6 +104,13 @@ public class P2PTLSConfigOptions {
"Whether to send a SNI header in the TLS ClientHello message (default: ${DEFAULT-VALUE})")
private final Boolean p2pTlsClientHelloSniHeaderEnabled = false;

@Option(
Comment thread
Matilda-Clerke marked this conversation as resolved.
Outdated
names = {"--Xpeertask-system-enabled"},
hidden = true,
description =
"Temporary feature toggle to enable using the new peertask system (default: ${DEFAULT-VALUE})")
private final Boolean isPeerTaskSystemEnabled = false;

/** Default constructor. */
P2PTLSConfigOptions() {}

Expand All @@ -128,6 +136,8 @@ public Optional<TLSConfiguration> p2pTLSConfiguration(final CommandLine commandL
"File containing password to unlock keystore is required when p2p TLS is enabled");
}

PeerTaskFeatureToggle.initialize(isPeerTaskSystemEnabled);

return Optional.of(
TLSConfiguration.Builder.tlsConfiguration()
.withKeyStoreType(p2pTLSKeyStoreType)
Expand Down
1 change: 1 addition & 0 deletions besu/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ Xsecp256k1-native-enabled=false
Xaltbn128-native-enabled=false
Xsnapsync-server-enabled=true
Xbonsai-full-flat-db-enabled=true
Xpeertask-system-enabled=false

# compatibility flags
compatibility-eth64-forkid-enabled=false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright contributors to Hyperledger 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.ethereum.eth.manager.peertask;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Temporary class to allow easy access to the PeerTask feature toggle. This class can be removed
* once we've properly tested the PeerTask system and want to enable it permanently
*/
public class PeerTaskFeatureToggle {
Comment thread
Matilda-Clerke marked this conversation as resolved.
Outdated
private static final Logger LOGGER = LoggerFactory.getLogger(PeerTaskFeatureToggle.class);
private static Boolean USE_PEER_TASK_SYSTEM = null;

/**
* Initialize the PeerTaskFeatureToggle with the supplied usePeerTaskSystem Boolean.
* PeerTaskFeatureToggle may only be initialized once!
*
* @param usePeerTaskSystem Boolean indicating whether or not the PeerTask system should be used
*/
public static void initialize(final Boolean usePeerTaskSystem) {
if (USE_PEER_TASK_SYSTEM != null) {
LOGGER.warn(
"PeerTaskFeatureToggle has already been initialized, and cannot be initialized again");
} else {
USE_PEER_TASK_SYSTEM = usePeerTaskSystem;
}
}

/**
* Indicates whether or not to use the PeerTask system. PeerTaskFeatureToggle must have been
* initialized before this method can be called!
*
* @return whether or not to use the PeerTask system
* @throws IllegalStateException if the PeerTaskFeatureToggle has not been initialized
*/
public static Boolean usePeerTaskSystem() {
if (USE_PEER_TASK_SYSTEM == null) {
throw new IllegalStateException(
"PeerTaskFeatureToggle has not been initialized, but getUsePeerTaskSystem() has been called");
}
return USE_PEER_TASK_SYSTEM;
}

private PeerTaskFeatureToggle() {}
}