|
|
@ -84,7 +84,6 @@ import org.hyperledger.besu.cli.util.BesuCommandCustomFactory; |
|
|
|
import org.hyperledger.besu.cli.util.CommandLineUtils; |
|
|
|
import org.hyperledger.besu.cli.util.CommandLineUtils; |
|
|
|
import org.hyperledger.besu.cli.util.ConfigDefaultValueProviderStrategy; |
|
|
|
import org.hyperledger.besu.cli.util.ConfigDefaultValueProviderStrategy; |
|
|
|
import org.hyperledger.besu.cli.util.VersionProvider; |
|
|
|
import org.hyperledger.besu.cli.util.VersionProvider; |
|
|
|
import org.hyperledger.besu.components.BesuComponent; |
|
|
|
|
|
|
|
import org.hyperledger.besu.config.CheckpointConfigOptions; |
|
|
|
import org.hyperledger.besu.config.CheckpointConfigOptions; |
|
|
|
import org.hyperledger.besu.config.GenesisConfigFile; |
|
|
|
import org.hyperledger.besu.config.GenesisConfigFile; |
|
|
|
import org.hyperledger.besu.config.GenesisConfigOptions; |
|
|
|
import org.hyperledger.besu.config.GenesisConfigOptions; |
|
|
@ -865,13 +864,9 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
private BesuController besuController; |
|
|
|
private BesuController besuController; |
|
|
|
private BesuConfigurationImpl pluginCommonConfiguration; |
|
|
|
private BesuConfigurationImpl pluginCommonConfiguration; |
|
|
|
|
|
|
|
|
|
|
|
private BesuComponent besuComponent; |
|
|
|
|
|
|
|
private final Supplier<ObservableMetricsSystem> metricsSystem = |
|
|
|
private final Supplier<ObservableMetricsSystem> metricsSystem = |
|
|
|
Suppliers.memoize( |
|
|
|
Suppliers.memoize(() -> MetricsSystemFactory.create(metricsConfiguration())); |
|
|
|
() -> |
|
|
|
|
|
|
|
besuComponent == null || besuComponent.getObservableMetricsSystem() == null |
|
|
|
|
|
|
|
? MetricsSystemFactory.create(metricsConfiguration()) |
|
|
|
|
|
|
|
: besuComponent.getObservableMetricsSystem()); |
|
|
|
|
|
|
|
private Vertx vertx; |
|
|
|
private Vertx vertx; |
|
|
|
private EnodeDnsConfiguration enodeDnsConfiguration; |
|
|
|
private EnodeDnsConfiguration enodeDnsConfiguration; |
|
|
|
private KeyValueStorageProvider keyValueStorageProvider; |
|
|
|
private KeyValueStorageProvider keyValueStorageProvider; |
|
|
@ -879,7 +874,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Besu command constructor. |
|
|
|
* Besu command constructor. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param besuComponent BesuComponent which acts as our application context |
|
|
|
|
|
|
|
* @param rlpBlockImporter RlpBlockImporter supplier |
|
|
|
* @param rlpBlockImporter RlpBlockImporter supplier |
|
|
|
* @param jsonBlockImporterFactory instance of {@code Function<BesuController, JsonBlockImporter>} |
|
|
|
* @param jsonBlockImporterFactory instance of {@code Function<BesuController, JsonBlockImporter>} |
|
|
|
* @param rlpBlockExporterFactory instance of {@code Function<Blockchain, RlpBlockExporter>} |
|
|
|
* @param rlpBlockExporterFactory instance of {@code Function<Blockchain, RlpBlockExporter>} |
|
|
@ -887,18 +881,18 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
* @param controllerBuilder instance of BesuController.Builder |
|
|
|
* @param controllerBuilder instance of BesuController.Builder |
|
|
|
* @param besuPluginContext instance of BesuPluginContextImpl |
|
|
|
* @param besuPluginContext instance of BesuPluginContextImpl |
|
|
|
* @param environment Environment variables map |
|
|
|
* @param environment Environment variables map |
|
|
|
|
|
|
|
* @param commandLogger instance of Logger for outputting to the CLI |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public BesuCommand( |
|
|
|
public BesuCommand( |
|
|
|
final BesuComponent besuComponent, |
|
|
|
|
|
|
|
final Supplier<RlpBlockImporter> rlpBlockImporter, |
|
|
|
final Supplier<RlpBlockImporter> rlpBlockImporter, |
|
|
|
final Function<BesuController, JsonBlockImporter> jsonBlockImporterFactory, |
|
|
|
final Function<BesuController, JsonBlockImporter> jsonBlockImporterFactory, |
|
|
|
final Function<Blockchain, RlpBlockExporter> rlpBlockExporterFactory, |
|
|
|
final Function<Blockchain, RlpBlockExporter> rlpBlockExporterFactory, |
|
|
|
final RunnerBuilder runnerBuilder, |
|
|
|
final RunnerBuilder runnerBuilder, |
|
|
|
final BesuController.Builder controllerBuilder, |
|
|
|
final BesuController.Builder controllerBuilder, |
|
|
|
final BesuPluginContextImpl besuPluginContext, |
|
|
|
final BesuPluginContextImpl besuPluginContext, |
|
|
|
final Map<String, String> environment) { |
|
|
|
final Map<String, String> environment, |
|
|
|
|
|
|
|
final Logger commandLogger) { |
|
|
|
this( |
|
|
|
this( |
|
|
|
besuComponent, |
|
|
|
|
|
|
|
rlpBlockImporter, |
|
|
|
rlpBlockImporter, |
|
|
|
jsonBlockImporterFactory, |
|
|
|
jsonBlockImporterFactory, |
|
|
|
rlpBlockExporterFactory, |
|
|
|
rlpBlockExporterFactory, |
|
|
@ -914,13 +908,13 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
new TransactionSelectionServiceImpl(), |
|
|
|
new TransactionSelectionServiceImpl(), |
|
|
|
new TransactionPoolValidatorServiceImpl(), |
|
|
|
new TransactionPoolValidatorServiceImpl(), |
|
|
|
new TransactionSimulationServiceImpl(), |
|
|
|
new TransactionSimulationServiceImpl(), |
|
|
|
new BlockchainServiceImpl()); |
|
|
|
new BlockchainServiceImpl(), |
|
|
|
|
|
|
|
commandLogger); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Overloaded Besu command constructor visible for testing. |
|
|
|
* Overloaded Besu command constructor visible for testing. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param besuComponent BesuComponent which acts as our application context |
|
|
|
|
|
|
|
* @param rlpBlockImporter RlpBlockImporter supplier |
|
|
|
* @param rlpBlockImporter RlpBlockImporter supplier |
|
|
|
* @param jsonBlockImporterFactory instance of {@code Function<BesuController, JsonBlockImporter>} |
|
|
|
* @param jsonBlockImporterFactory instance of {@code Function<BesuController, JsonBlockImporter>} |
|
|
|
* @param rlpBlockExporterFactory instance of {@code Function<Blockchain, RlpBlockExporter>} |
|
|
|
* @param rlpBlockExporterFactory instance of {@code Function<Blockchain, RlpBlockExporter>} |
|
|
@ -937,10 +931,10 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
* @param transactionValidatorServiceImpl instance of TransactionValidatorServiceImpl |
|
|
|
* @param transactionValidatorServiceImpl instance of TransactionValidatorServiceImpl |
|
|
|
* @param transactionSimulationServiceImpl instance of TransactionSimulationServiceImpl |
|
|
|
* @param transactionSimulationServiceImpl instance of TransactionSimulationServiceImpl |
|
|
|
* @param blockchainServiceImpl instance of BlockchainServiceImpl |
|
|
|
* @param blockchainServiceImpl instance of BlockchainServiceImpl |
|
|
|
|
|
|
|
* @param commandLogger instance of Logger for outputting to the CLI |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@VisibleForTesting |
|
|
|
@VisibleForTesting |
|
|
|
protected BesuCommand( |
|
|
|
protected BesuCommand( |
|
|
|
final BesuComponent besuComponent, |
|
|
|
|
|
|
|
final Supplier<RlpBlockImporter> rlpBlockImporter, |
|
|
|
final Supplier<RlpBlockImporter> rlpBlockImporter, |
|
|
|
final Function<BesuController, JsonBlockImporter> jsonBlockImporterFactory, |
|
|
|
final Function<BesuController, JsonBlockImporter> jsonBlockImporterFactory, |
|
|
|
final Function<Blockchain, RlpBlockExporter> rlpBlockExporterFactory, |
|
|
|
final Function<Blockchain, RlpBlockExporter> rlpBlockExporterFactory, |
|
|
@ -956,9 +950,10 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
final TransactionSelectionServiceImpl transactionSelectionServiceImpl, |
|
|
|
final TransactionSelectionServiceImpl transactionSelectionServiceImpl, |
|
|
|
final TransactionPoolValidatorServiceImpl transactionValidatorServiceImpl, |
|
|
|
final TransactionPoolValidatorServiceImpl transactionValidatorServiceImpl, |
|
|
|
final TransactionSimulationServiceImpl transactionSimulationServiceImpl, |
|
|
|
final TransactionSimulationServiceImpl transactionSimulationServiceImpl, |
|
|
|
final BlockchainServiceImpl blockchainServiceImpl) { |
|
|
|
final BlockchainServiceImpl blockchainServiceImpl, |
|
|
|
this.besuComponent = besuComponent; |
|
|
|
final Logger commandLogger) { |
|
|
|
this.logger = besuComponent.getBesuCommandLogger(); |
|
|
|
|
|
|
|
|
|
|
|
this.logger = commandLogger; |
|
|
|
this.rlpBlockImporter = rlpBlockImporter; |
|
|
|
this.rlpBlockImporter = rlpBlockImporter; |
|
|
|
this.rlpBlockExporterFactory = rlpBlockExporterFactory; |
|
|
|
this.rlpBlockExporterFactory = rlpBlockExporterFactory; |
|
|
|
this.jsonBlockImporterFactory = jsonBlockImporterFactory; |
|
|
|
this.jsonBlockImporterFactory = jsonBlockImporterFactory; |
|
|
@ -970,8 +965,13 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
this.securityModuleService = securityModuleService; |
|
|
|
this.securityModuleService = securityModuleService; |
|
|
|
this.permissioningService = permissioningService; |
|
|
|
this.permissioningService = permissioningService; |
|
|
|
this.privacyPluginService = privacyPluginService; |
|
|
|
this.privacyPluginService = privacyPluginService; |
|
|
|
|
|
|
|
if (besuPluginContext.getService(BesuConfigurationImpl.class).isPresent()) { |
|
|
|
|
|
|
|
this.pluginCommonConfiguration = |
|
|
|
|
|
|
|
besuPluginContext.getService(BesuConfigurationImpl.class).get(); |
|
|
|
|
|
|
|
} else { |
|
|
|
this.pluginCommonConfiguration = new BesuConfigurationImpl(); |
|
|
|
this.pluginCommonConfiguration = new BesuConfigurationImpl(); |
|
|
|
besuPluginContext.addService(BesuConfiguration.class, pluginCommonConfiguration); |
|
|
|
besuPluginContext.addService(BesuConfiguration.class, this.pluginCommonConfiguration); |
|
|
|
|
|
|
|
} |
|
|
|
this.rpcEndpointServiceImpl = rpcEndpointServiceImpl; |
|
|
|
this.rpcEndpointServiceImpl = rpcEndpointServiceImpl; |
|
|
|
this.transactionSelectionServiceImpl = transactionSelectionServiceImpl; |
|
|
|
this.transactionSelectionServiceImpl = transactionSelectionServiceImpl; |
|
|
|
this.transactionValidatorServiceImpl = transactionValidatorServiceImpl; |
|
|
|
this.transactionValidatorServiceImpl = transactionValidatorServiceImpl; |
|
|
@ -1821,9 +1821,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public BesuController buildController() { |
|
|
|
public BesuController buildController() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
return this.besuComponent == null |
|
|
|
return setupControllerBuilder().build(); |
|
|
|
? getControllerBuilder().build() |
|
|
|
|
|
|
|
: getControllerBuilder().besuComponent(this.besuComponent).build(); |
|
|
|
|
|
|
|
} catch (final Exception e) { |
|
|
|
} catch (final Exception e) { |
|
|
|
throw new ExecutionException(this.commandLine, e.getMessage(), e); |
|
|
|
throw new ExecutionException(this.commandLine, e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
@ -1834,7 +1832,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
* |
|
|
|
* |
|
|
|
* @return instance of BesuControllerBuilder |
|
|
|
* @return instance of BesuControllerBuilder |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public BesuControllerBuilder getControllerBuilder() { |
|
|
|
public BesuControllerBuilder setupControllerBuilder() { |
|
|
|
pluginCommonConfiguration |
|
|
|
pluginCommonConfiguration |
|
|
|
.init(dataDir(), dataDir().resolve(DATABASE_PATH), getDataStorageConfiguration()) |
|
|
|
.init(dataDir(), dataDir().resolve(DATABASE_PATH), getDataStorageConfiguration()) |
|
|
|
.withMiningParameters(miningParametersSupplier.get()) |
|
|
|
.withMiningParameters(miningParametersSupplier.get()) |
|
|
@ -2800,7 +2798,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { |
|
|
|
builder.setTxPoolImplementation(buildTransactionPoolConfiguration().getTxPoolImplementation()); |
|
|
|
builder.setTxPoolImplementation(buildTransactionPoolConfiguration().getTxPoolImplementation()); |
|
|
|
builder.setWorldStateUpdateMode(unstableEvmOptions.toDomainObject().worldUpdaterMode()); |
|
|
|
builder.setWorldStateUpdateMode(unstableEvmOptions.toDomainObject().worldUpdaterMode()); |
|
|
|
|
|
|
|
|
|
|
|
builder.setPluginContext(besuComponent.getBesuPluginContext()); |
|
|
|
builder.setPluginContext(this.besuPluginContext); |
|
|
|
|
|
|
|
|
|
|
|
return builder.build(); |
|
|
|
return builder.build(); |
|
|
|
} |
|
|
|
} |
|
|
|