Search in sources :

Example 1 with SlashingProtectionLogger

use of tech.pegasys.teku.validator.client.loader.SlashingProtectionLogger 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());
}
Also used : Path(java.nio.file.Path) PublicKeyLoader(tech.pegasys.teku.validator.client.loader.PublicKeyLoader) SlashingProtectionLogger(tech.pegasys.teku.validator.client.loader.SlashingProtectionLogger) LocalSlashingProtector(tech.pegasys.teku.core.signatures.LocalSlashingProtector) SlashingProtector(tech.pegasys.teku.core.signatures.SlashingProtector) LocalSlashingProtector(tech.pegasys.teku.core.signatures.LocalSlashingProtector)

Example 2 with SlashingProtectionLogger

use of tech.pegasys.teku.validator.client.loader.SlashingProtectionLogger 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);
    }
}
Also used : AsyncRunnerFactory(tech.pegasys.teku.infrastructure.async.AsyncRunnerFactory) ValidatorLoader(tech.pegasys.teku.validator.client.loader.ValidatorLoader) PublicKeyLoader(tech.pegasys.teku.validator.client.loader.PublicKeyLoader) MetricTrackingExecutorFactory(tech.pegasys.teku.infrastructure.async.MetricTrackingExecutorFactory) SlashingProtectionLogger(tech.pegasys.teku.validator.client.loader.SlashingProtectionLogger) Bytes32(org.apache.tuweni.bytes.Bytes32) RejectingSlashingProtector(tech.pegasys.teku.core.signatures.RejectingSlashingProtector) AsyncRunner(tech.pegasys.teku.infrastructure.async.AsyncRunner) InvalidConfigurationException(tech.pegasys.teku.infrastructure.exceptions.InvalidConfigurationException)

Aggregations

PublicKeyLoader (tech.pegasys.teku.validator.client.loader.PublicKeyLoader)2 SlashingProtectionLogger (tech.pegasys.teku.validator.client.loader.SlashingProtectionLogger)2 Path (java.nio.file.Path)1 Bytes32 (org.apache.tuweni.bytes.Bytes32)1 LocalSlashingProtector (tech.pegasys.teku.core.signatures.LocalSlashingProtector)1 RejectingSlashingProtector (tech.pegasys.teku.core.signatures.RejectingSlashingProtector)1 SlashingProtector (tech.pegasys.teku.core.signatures.SlashingProtector)1 AsyncRunner (tech.pegasys.teku.infrastructure.async.AsyncRunner)1 AsyncRunnerFactory (tech.pegasys.teku.infrastructure.async.AsyncRunnerFactory)1 MetricTrackingExecutorFactory (tech.pegasys.teku.infrastructure.async.MetricTrackingExecutorFactory)1 InvalidConfigurationException (tech.pegasys.teku.infrastructure.exceptions.InvalidConfigurationException)1 ValidatorLoader (tech.pegasys.teku.validator.client.loader.ValidatorLoader)1