Merge branch 'refs/heads/7311-add-cli-feature-toggle-for-peertask-system' into 7311-add-GetReceiptsFromPeerTask

pull/7638/head
Matilda Clerke 2 months ago
commit 06553be973
  1. 9
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  2. 59
      besu/src/main/java/org/hyperledger/besu/cli/custom/PeerTaskFeatureToggle.java
  3. 1
      besu/src/test/resources/everything_config.toml

@ -40,6 +40,7 @@ import org.hyperledger.besu.cli.converter.MetricCategoryConverter;
import org.hyperledger.besu.cli.converter.PercentageConverter;
import org.hyperledger.besu.cli.converter.SubnetInfoConverter;
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty;
import org.hyperledger.besu.cli.custom.PeerTaskFeatureToggle;
import org.hyperledger.besu.cli.error.BesuExecutionExceptionHandler;
import org.hyperledger.besu.cli.error.BesuParameterExceptionHandler;
import org.hyperledger.besu.cli.options.MiningOptions;
@ -842,6 +843,12 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
description = "Specifies the number of last blocks to cache (default: ${DEFAULT-VALUE})")
private final Integer numberOfblocksToCache = 0;
@Option(
names = {"--peertask-system-enabled"},
description =
"Temporary feature toggle to enable using the new peertask system (default: ${DEFAULT-VALUE})")
private final Boolean isPeerTaskSystemEnabled = false;
@Mixin private P2PTLSConfigOptions p2pTLSConfigOptions;
// Plugins Configuration Option Group
@ -1784,6 +1791,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
instantiateSignatureAlgorithmFactory();
PeerTaskFeatureToggle.initialize(isPeerTaskSystemEnabled);
logger.info(generateConfigurationOverview());
logger.info("Security Module: {}", securityModuleName);
}

@ -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.cli.custom;
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 {
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() {}
}

@ -226,6 +226,7 @@ Xsecp256k1-native-enabled=false
Xaltbn128-native-enabled=false
Xsnapsync-server-enabled=true
Xbonsai-full-flat-db-enabled=true
peertask-system-enabled=false
# compatibility flags
compatibility-eth64-forkid-enabled=false

Loading…
Cancel
Save