|
|
|
@ -23,7 +23,6 @@ import static org.hyperledger.besu.cli.config.NetworkName.MAINNET; |
|
|
|
|
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPENDENCY_WARNING_MSG; |
|
|
|
|
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPRECATED_AND_USELESS_WARNING_MSG; |
|
|
|
|
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPRECATION_WARNING_MSG; |
|
|
|
|
import static org.hyperledger.besu.config.experimental.MergeConfigOptions.isMergeEnabled; |
|
|
|
|
import static org.hyperledger.besu.controller.BesuController.DATABASE_PATH; |
|
|
|
|
import static org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration.DEFAULT_GRAPHQL_HTTP_PORT; |
|
|
|
|
import static org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration.DEFAULT_ENGINE_JSON_RPC_PORT; |
|
|
|
@ -61,7 +60,6 @@ import org.hyperledger.besu.cli.options.unstable.EthProtocolOptions; |
|
|
|
|
import org.hyperledger.besu.cli.options.unstable.EvmOptions; |
|
|
|
|
import org.hyperledger.besu.cli.options.unstable.IpcOptions; |
|
|
|
|
import org.hyperledger.besu.cli.options.unstable.LauncherOptions; |
|
|
|
|
import org.hyperledger.besu.cli.options.unstable.MergeOptions; |
|
|
|
|
import org.hyperledger.besu.cli.options.unstable.MetricsCLIOptions; |
|
|
|
|
import org.hyperledger.besu.cli.options.unstable.MiningOptions; |
|
|
|
|
import org.hyperledger.besu.cli.options.unstable.NatOptions; |
|
|
|
@ -88,6 +86,7 @@ import org.hyperledger.besu.cli.util.VersionProvider; |
|
|
|
|
import org.hyperledger.besu.config.GenesisConfigFile; |
|
|
|
|
import org.hyperledger.besu.config.GenesisConfigOptions; |
|
|
|
|
import org.hyperledger.besu.config.GoQuorumOptions; |
|
|
|
|
import org.hyperledger.besu.config.MergeConfigOptions; |
|
|
|
|
import org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfiguration; |
|
|
|
|
import org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfigurationProvider; |
|
|
|
|
import org.hyperledger.besu.controller.BesuController; |
|
|
|
@ -282,7 +281,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
private final NatOptions unstableNatOptions = NatOptions.create(); |
|
|
|
|
private final NativeLibraryOptions unstableNativeLibraryOptions = NativeLibraryOptions.create(); |
|
|
|
|
private final RPCOptions unstableRPCOptions = RPCOptions.create(); |
|
|
|
|
private final MergeOptions mergeOptions = MergeOptions.create(); |
|
|
|
|
final LauncherOptions unstableLauncherOptions = LauncherOptions.create(); |
|
|
|
|
private final PrivacyPluginOptions unstablePrivacyPluginOptions = PrivacyPluginOptions.create(); |
|
|
|
|
private final EvmOptions unstableEvmOptions = EvmOptions.create(); |
|
|
|
@ -569,8 +567,9 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
static class EngineRPCOptionGroup { |
|
|
|
|
@Option( |
|
|
|
|
names = {"--engine-rpc-enabled"}, |
|
|
|
|
description = "Set to start the Engine JSON-RPC service (default: ${DEFAULT-VALUE})") |
|
|
|
|
private final Boolean isEngineRpcEnabled = false; |
|
|
|
|
description = "deprectaed parameter, do not use.", |
|
|
|
|
hidden = true) |
|
|
|
|
private final Boolean deprecatedIsEngineRpcEnabled = false; |
|
|
|
|
|
|
|
|
|
@Option( |
|
|
|
|
names = {"--engine-rpc-port"}, |
|
|
|
@ -1389,15 +1388,18 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
configureLogging(true); |
|
|
|
|
|
|
|
|
|
// Set the goquorum compatibility mode based on the genesis file
|
|
|
|
|
if (genesisFile != null) { |
|
|
|
|
genesisConfigOptions = readGenesisConfigOptions(); |
|
|
|
|
|
|
|
|
|
if (genesisConfigOptions.isQuorum()) { |
|
|
|
|
enableGoQuorumCompatibilityMode(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// set merge config on the basis of genesis config
|
|
|
|
|
setMergeConfigOptions(); |
|
|
|
|
|
|
|
|
|
instantiateSignatureAlgorithmFactory(); |
|
|
|
|
configureNativeLibs(); |
|
|
|
|
logger.info("Starting Besu version: {}", BesuInfo.nodeName(identityString)); |
|
|
|
@ -1501,7 +1503,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
.put("Mining", unstableMiningOptions) |
|
|
|
|
.put("Native Library", unstableNativeLibraryOptions) |
|
|
|
|
.put("Launcher", unstableLauncherOptions) |
|
|
|
|
.put("Merge", mergeOptions) |
|
|
|
|
.put("EVM Options", unstableEvmOptions) |
|
|
|
|
.put("IPC Options", unstableIpcOptions) |
|
|
|
|
.build(); |
|
|
|
@ -1812,7 +1813,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private GenesisConfigOptions readGenesisConfigOptions() { |
|
|
|
|
final GenesisConfigOptions genesisConfigOptions; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
final GenesisConfigFile genesisConfigFile = GenesisConfigFile.fromConfig(genesisConfig()); |
|
|
|
|
genesisConfigOptions = genesisConfigFile.getConfigOptions(genesisConfigOverrides); |
|
|
|
@ -2108,7 +2109,12 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
final Integer listenPort, final List<String> allowCallsFrom) { |
|
|
|
|
JsonRpcConfiguration engineConfig = |
|
|
|
|
jsonRpcConfiguration(listenPort, Arrays.asList("ENGINE", "ETH"), allowCallsFrom); |
|
|
|
|
engineConfig.setEnabled(engineRPCOptionGroup.isEngineRpcEnabled); |
|
|
|
|
if (engineRPCOptionGroup.deprecatedIsEngineRpcEnabled) { |
|
|
|
|
logger.warn( |
|
|
|
|
"--engine-api-enabled parameter has been deprecated and will be removed in a future release. " |
|
|
|
|
+ "Merge support is implicitly enabled by the presence of terminalTotalDifficulty in the genesis config."); |
|
|
|
|
} |
|
|
|
|
engineConfig.setEnabled(isMergeEnabled()); |
|
|
|
|
if (engineRPCOptionGroup.isEngineAuthEnabled) { |
|
|
|
|
engineConfig.setAuthenticationEnabled(true); |
|
|
|
|
engineConfig.setAuthenticationAlgorithm(JwtAlgorithm.HS256); |
|
|
|
@ -2933,7 +2939,16 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
return Resources.toString(genesisFile.toURI().toURL(), UTF_8); |
|
|
|
|
} catch (final IOException e) { |
|
|
|
|
throw new ParameterException( |
|
|
|
|
this.commandLine, String.format("Unable to load genesis file %s.", genesisFile), e); |
|
|
|
|
this.commandLine, String.format("Unable to load genesis URL %s.", genesisFile), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String genesisConfig(final NetworkName networkName) { |
|
|
|
|
try (final InputStream genesisFileInputStream = |
|
|
|
|
EthNetworkConfig.class.getResourceAsStream(networkName.getGenesisFile())) { |
|
|
|
|
return new String(genesisFileInputStream.readAllBytes(), UTF_8); |
|
|
|
|
} catch (IOException | NullPointerException e) { |
|
|
|
|
throw new IllegalStateException(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3063,10 +3078,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
effectivePorts, |
|
|
|
|
jsonRPCWebsocketOptionGroup.rpcWsPort, |
|
|
|
|
jsonRPCWebsocketOptionGroup.isRpcWsEnabled); |
|
|
|
|
addPortIfEnabled( |
|
|
|
|
effectivePorts, |
|
|
|
|
engineRPCOptionGroup.engineRpcPort, |
|
|
|
|
engineRPCOptionGroup.isEngineRpcEnabled); |
|
|
|
|
addPortIfEnabled(effectivePorts, engineRPCOptionGroup.engineRpcPort, isMergeEnabled()); |
|
|
|
|
addPortIfEnabled( |
|
|
|
|
effectivePorts, metricsOptionGroup.metricsPort, metricsOptionGroup.isMetricsEnabled); |
|
|
|
|
addPortIfEnabled( |
|
|
|
@ -3174,6 +3186,22 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
isGoQuorumCompatibilityMode = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setMergeConfigOptions() { |
|
|
|
|
MergeConfigOptions.setMergeEnabled( |
|
|
|
|
Optional.ofNullable(genesisConfigOptions) |
|
|
|
|
.orElseGet( |
|
|
|
|
() -> |
|
|
|
|
GenesisConfigFile.fromConfig( |
|
|
|
|
genesisConfig(Optional.ofNullable(network).orElse(MAINNET))) |
|
|
|
|
.getConfigOptions(genesisConfigOverrides)) |
|
|
|
|
.getTerminalTotalDifficulty() |
|
|
|
|
.isPresent()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isMergeEnabled() { |
|
|
|
|
return MergeConfigOptions.isMergeEnabled(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static List<String> getJDKEnabledCypherSuites() { |
|
|
|
|
try { |
|
|
|
|
SSLContext context = SSLContext.getInstance("TLS"); |
|
|
|
|