|
|
@ -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.DEPENDENCY_WARNING_MSG; |
|
|
|
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPRECATED_AND_USELESS_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.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.controller.BesuController.DATABASE_PATH; |
|
|
|
import static org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration.DEFAULT_GRAPHQL_HTTP_PORT; |
|
|
|
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; |
|
|
|
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.EvmOptions; |
|
|
|
import org.hyperledger.besu.cli.options.unstable.IpcOptions; |
|
|
|
import org.hyperledger.besu.cli.options.unstable.IpcOptions; |
|
|
|
import org.hyperledger.besu.cli.options.unstable.LauncherOptions; |
|
|
|
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.MetricsCLIOptions; |
|
|
|
import org.hyperledger.besu.cli.options.unstable.MiningOptions; |
|
|
|
import org.hyperledger.besu.cli.options.unstable.MiningOptions; |
|
|
|
import org.hyperledger.besu.cli.options.unstable.NatOptions; |
|
|
|
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.GenesisConfigFile; |
|
|
|
import org.hyperledger.besu.config.GenesisConfigOptions; |
|
|
|
import org.hyperledger.besu.config.GenesisConfigOptions; |
|
|
|
import org.hyperledger.besu.config.GoQuorumOptions; |
|
|
|
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.PkiBlockCreationConfiguration; |
|
|
|
import org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfigurationProvider; |
|
|
|
import org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfigurationProvider; |
|
|
|
import org.hyperledger.besu.controller.BesuController; |
|
|
|
import org.hyperledger.besu.controller.BesuController; |
|
|
@ -282,7 +281,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
private final NatOptions unstableNatOptions = NatOptions.create(); |
|
|
|
private final NatOptions unstableNatOptions = NatOptions.create(); |
|
|
|
private final NativeLibraryOptions unstableNativeLibraryOptions = NativeLibraryOptions.create(); |
|
|
|
private final NativeLibraryOptions unstableNativeLibraryOptions = NativeLibraryOptions.create(); |
|
|
|
private final RPCOptions unstableRPCOptions = RPCOptions.create(); |
|
|
|
private final RPCOptions unstableRPCOptions = RPCOptions.create(); |
|
|
|
private final MergeOptions mergeOptions = MergeOptions.create(); |
|
|
|
|
|
|
|
final LauncherOptions unstableLauncherOptions = LauncherOptions.create(); |
|
|
|
final LauncherOptions unstableLauncherOptions = LauncherOptions.create(); |
|
|
|
private final PrivacyPluginOptions unstablePrivacyPluginOptions = PrivacyPluginOptions.create(); |
|
|
|
private final PrivacyPluginOptions unstablePrivacyPluginOptions = PrivacyPluginOptions.create(); |
|
|
|
private final EvmOptions unstableEvmOptions = EvmOptions.create(); |
|
|
|
private final EvmOptions unstableEvmOptions = EvmOptions.create(); |
|
|
@ -569,8 +567,9 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
static class EngineRPCOptionGroup { |
|
|
|
static class EngineRPCOptionGroup { |
|
|
|
@Option( |
|
|
|
@Option( |
|
|
|
names = {"--engine-rpc-enabled"}, |
|
|
|
names = {"--engine-rpc-enabled"}, |
|
|
|
description = "Set to start the Engine JSON-RPC service (default: ${DEFAULT-VALUE})") |
|
|
|
description = "deprectaed parameter, do not use.", |
|
|
|
private final Boolean isEngineRpcEnabled = false; |
|
|
|
hidden = true) |
|
|
|
|
|
|
|
private final Boolean deprecatedIsEngineRpcEnabled = false; |
|
|
|
|
|
|
|
|
|
|
|
@Option( |
|
|
|
@Option( |
|
|
|
names = {"--engine-rpc-port"}, |
|
|
|
names = {"--engine-rpc-port"}, |
|
|
@ -1389,15 +1388,18 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
configureLogging(true); |
|
|
|
configureLogging(true); |
|
|
|
|
|
|
|
|
|
|
|
// Set the goquorum compatibility mode based on the genesis file
|
|
|
|
// Set the goquorum compatibility mode based on the genesis file
|
|
|
|
if (genesisFile != null) { |
|
|
|
if (genesisFile != null) { |
|
|
|
genesisConfigOptions = readGenesisConfigOptions(); |
|
|
|
genesisConfigOptions = readGenesisConfigOptions(); |
|
|
|
|
|
|
|
|
|
|
|
if (genesisConfigOptions.isQuorum()) { |
|
|
|
if (genesisConfigOptions.isQuorum()) { |
|
|
|
enableGoQuorumCompatibilityMode(); |
|
|
|
enableGoQuorumCompatibilityMode(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// set merge config on the basis of genesis config
|
|
|
|
|
|
|
|
setMergeConfigOptions(); |
|
|
|
|
|
|
|
|
|
|
|
instantiateSignatureAlgorithmFactory(); |
|
|
|
instantiateSignatureAlgorithmFactory(); |
|
|
|
configureNativeLibs(); |
|
|
|
configureNativeLibs(); |
|
|
|
logger.info("Starting Besu version: {}", BesuInfo.nodeName(identityString)); |
|
|
|
logger.info("Starting Besu version: {}", BesuInfo.nodeName(identityString)); |
|
|
@ -1501,7 +1503,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
.put("Mining", unstableMiningOptions) |
|
|
|
.put("Mining", unstableMiningOptions) |
|
|
|
.put("Native Library", unstableNativeLibraryOptions) |
|
|
|
.put("Native Library", unstableNativeLibraryOptions) |
|
|
|
.put("Launcher", unstableLauncherOptions) |
|
|
|
.put("Launcher", unstableLauncherOptions) |
|
|
|
.put("Merge", mergeOptions) |
|
|
|
|
|
|
|
.put("EVM Options", unstableEvmOptions) |
|
|
|
.put("EVM Options", unstableEvmOptions) |
|
|
|
.put("IPC Options", unstableIpcOptions) |
|
|
|
.put("IPC Options", unstableIpcOptions) |
|
|
|
.build(); |
|
|
|
.build(); |
|
|
@ -1812,7 +1813,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private GenesisConfigOptions readGenesisConfigOptions() { |
|
|
|
private GenesisConfigOptions readGenesisConfigOptions() { |
|
|
|
final GenesisConfigOptions genesisConfigOptions; |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
final GenesisConfigFile genesisConfigFile = GenesisConfigFile.fromConfig(genesisConfig()); |
|
|
|
final GenesisConfigFile genesisConfigFile = GenesisConfigFile.fromConfig(genesisConfig()); |
|
|
|
genesisConfigOptions = genesisConfigFile.getConfigOptions(genesisConfigOverrides); |
|
|
|
genesisConfigOptions = genesisConfigFile.getConfigOptions(genesisConfigOverrides); |
|
|
@ -2108,7 +2109,12 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
final Integer listenPort, final List<String> allowCallsFrom) { |
|
|
|
final Integer listenPort, final List<String> allowCallsFrom) { |
|
|
|
JsonRpcConfiguration engineConfig = |
|
|
|
JsonRpcConfiguration engineConfig = |
|
|
|
jsonRpcConfiguration(listenPort, Arrays.asList("ENGINE", "ETH"), allowCallsFrom); |
|
|
|
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) { |
|
|
|
if (engineRPCOptionGroup.isEngineAuthEnabled) { |
|
|
|
engineConfig.setAuthenticationEnabled(true); |
|
|
|
engineConfig.setAuthenticationEnabled(true); |
|
|
|
engineConfig.setAuthenticationAlgorithm(JwtAlgorithm.HS256); |
|
|
|
engineConfig.setAuthenticationAlgorithm(JwtAlgorithm.HS256); |
|
|
@ -2933,7 +2939,16 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
return Resources.toString(genesisFile.toURI().toURL(), UTF_8); |
|
|
|
return Resources.toString(genesisFile.toURI().toURL(), UTF_8); |
|
|
|
} catch (final IOException e) { |
|
|
|
} catch (final IOException e) { |
|
|
|
throw new ParameterException( |
|
|
|
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, |
|
|
|
effectivePorts, |
|
|
|
jsonRPCWebsocketOptionGroup.rpcWsPort, |
|
|
|
jsonRPCWebsocketOptionGroup.rpcWsPort, |
|
|
|
jsonRPCWebsocketOptionGroup.isRpcWsEnabled); |
|
|
|
jsonRPCWebsocketOptionGroup.isRpcWsEnabled); |
|
|
|
addPortIfEnabled( |
|
|
|
addPortIfEnabled(effectivePorts, engineRPCOptionGroup.engineRpcPort, isMergeEnabled()); |
|
|
|
effectivePorts, |
|
|
|
|
|
|
|
engineRPCOptionGroup.engineRpcPort, |
|
|
|
|
|
|
|
engineRPCOptionGroup.isEngineRpcEnabled); |
|
|
|
|
|
|
|
addPortIfEnabled( |
|
|
|
addPortIfEnabled( |
|
|
|
effectivePorts, metricsOptionGroup.metricsPort, metricsOptionGroup.isMetricsEnabled); |
|
|
|
effectivePorts, metricsOptionGroup.metricsPort, metricsOptionGroup.isMetricsEnabled); |
|
|
|
addPortIfEnabled( |
|
|
|
addPortIfEnabled( |
|
|
@ -3174,6 +3186,22 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
isGoQuorumCompatibilityMode = true; |
|
|
|
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() { |
|
|
|
public static List<String> getJDKEnabledCypherSuites() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
SSLContext context = SSLContext.getInstance("TLS"); |
|
|
|
SSLContext context = SSLContext.getInstance("TLS"); |
|
|
|