use of tech.pegasys.teku.validator.client.loader.PublicKeyLoader in project teku by ConsenSys.
the class ValidatorClientService method createValidatorLoader.
private static ValidatorLoader createValidatorLoader(final ValidatorClientConfiguration config, final AsyncRunner asyncRunner, final ServiceConfig services) {
final Path slashingProtectionPath = getSlashingProtectionPath(services.getDataDirLayout());
final SlashingProtector slashingProtector = new LocalSlashingProtector(SyncDataAccessor.create(slashingProtectionPath), slashingProtectionPath);
final SlashingProtectionLogger slashingProtectionLogger = new SlashingProtectionLogger(slashingProtector, config.getSpec(), asyncRunner, ValidatorLogger.VALIDATOR_LOGGER);
return ValidatorLoader.create(config.getSpec(), config.getValidatorConfig(), config.getInteropConfig(), slashingProtector, slashingProtectionLogger, new PublicKeyLoader(), asyncRunner, services.getMetricsSystem(), config.getValidatorRestApiConfig().isRestApiEnabled() ? Optional.of(services.getDataDirLayout()) : Optional.empty());
}
use of tech.pegasys.teku.validator.client.loader.PublicKeyLoader in project teku by ConsenSys.
the class VoluntaryExitCommand method initialise.
private void initialise() {
config = tekuConfiguration();
final AsyncRunnerFactory asyncRunnerFactory = AsyncRunnerFactory.createDefault(new MetricTrackingExecutorFactory(metricsSystem));
final AsyncRunner asyncRunner = asyncRunnerFactory.create("voluntary-exits", 8);
apiClient = config.validatorClient().getValidatorConfig().getBeaconNodeApiEndpoint().map(RemoteSpecLoader::createApiClient).orElseThrow();
spec = getSpec(apiClient);
validateOrDefaultEpoch();
fork = spec.getForkSchedule().getFork(epoch);
// get genesis time
final Optional<Bytes32> maybeRoot = getGenesisRoot();
if (maybeRoot.isEmpty()) {
SUB_COMMAND_LOG.error("Unable to fetch genesis data, cannot generate an exit.");
System.exit(1);
}
genesisRoot = maybeRoot.get();
final RejectingSlashingProtector slashingProtector = new RejectingSlashingProtector();
final SlashingProtectionLogger slashingProtectionLogger = new SlashingProtectionLogger(slashingProtector, spec, asyncRunner, ValidatorLogger.VALIDATOR_LOGGER);
final ValidatorLoader validatorLoader = ValidatorLoader.create(spec, config.validatorClient().getValidatorConfig(), config.validatorClient().getInteropConfig(), new RejectingSlashingProtector(), slashingProtectionLogger, new PublicKeyLoader(), asyncRunner, metricsSystem, Optional.empty());
try {
validatorLoader.loadValidators();
validators = validatorLoader.getOwnedValidators();
} catch (InvalidConfigurationException ex) {
SUB_COMMAND_LOG.error(ex.getMessage());
System.exit(1);
}
if (validators.hasNoValidators()) {
SUB_COMMAND_LOG.error("No validators were found to exit.");
System.exit(1);
}
}
Aggregations