Search in sources :

Example 1 with ProposerConfigLoader

use of tech.pegasys.teku.validator.client.proposerconfig.loader.ProposerConfigLoader in project teku by ConsenSys.

the class ValidatorClientService method initializeValidators.

private void initializeValidators(ValidatorClientConfiguration config, ValidatorApiChannel validatorApiChannel, AsyncRunner asyncRunner) {
    validatorLoader.loadValidators();
    final OwnedValidators validators = validatorLoader.getOwnedValidators();
    this.validatorIndexProvider = new ValidatorIndexProvider(validators, validatorApiChannel, asyncRunner);
    final BlockDutyFactory blockDutyFactory = new BlockDutyFactory(forkProvider, validatorApiChannel, spec);
    final AttestationDutyFactory attestationDutyFactory = new AttestationDutyFactory(spec, forkProvider, validatorApiChannel);
    final BeaconCommitteeSubscriptions beaconCommitteeSubscriptions = new BeaconCommitteeSubscriptions(validatorApiChannel);
    final DutyLoader<?> attestationDutyLoader = new RetryingDutyLoader<>(asyncRunner, new AttestationDutyLoader(validatorApiChannel, forkProvider, dependentRoot -> new SlotBasedScheduledDuties<>(attestationDutyFactory, dependentRoot), validators, validatorIndexProvider, beaconCommitteeSubscriptions, spec));
    final DutyLoader<?> blockDutyLoader = new RetryingDutyLoader<>(asyncRunner, new BlockProductionDutyLoader(validatorApiChannel, dependentRoot -> new SlotBasedScheduledDuties<>(blockDutyFactory, dependentRoot), validators, validatorIndexProvider));
    validatorTimingChannels.add(new BlockDutyScheduler(metricsSystem, blockDutyLoader, spec));
    validatorTimingChannels.add(new AttestationDutyScheduler(metricsSystem, attestationDutyLoader, spec));
    validatorTimingChannels.add(validatorLoader.getSlashingProtectionLogger());
    if (spec.isMilestoneSupported(SpecMilestone.ALTAIR)) {
        final ChainHeadTracker chainHeadTracker = new ChainHeadTracker();
        validatorTimingChannels.add(chainHeadTracker);
        final DutyLoader<SyncCommitteeScheduledDuties> syncCommitteeDutyLoader = new RetryingDutyLoader<>(asyncRunner, new SyncCommitteeDutyLoader(validators, validatorIndexProvider, spec, validatorApiChannel, chainHeadTracker, forkProvider));
        validatorTimingChannels.add(new SyncCommitteeScheduler(metricsSystem, spec, syncCommitteeDutyLoader, new Random()::nextInt));
    }
    if (spec.isMilestoneSupported(SpecMilestone.BELLATRIX)) {
        proposerConfigProvider = Optional.of(ProposerConfigProvider.create(asyncRunner, config.getValidatorConfig().getRefreshProposerConfigFromSource(), new ProposerConfigLoader(new JsonProvider().getObjectMapper()), config.getValidatorConfig().getProposerConfigSource()));
        validatorTimingChannels.add(new BeaconProposerPreparer(validatorApiChannel, validatorIndexProvider, proposerConfigProvider.get(), config.getValidatorConfig().getProposerDefaultFeeRecipient(), spec));
    } else {
        proposerConfigProvider = Optional.empty();
    }
    addValidatorCountMetric(metricsSystem, validators);
    this.validatorStatusLogger = new DefaultValidatorStatusLogger(metricsSystem, validators, validatorApiChannel, asyncRunner);
}
Also used : AttestationDutyFactory(tech.pegasys.teku.validator.client.duties.attestations.AttestationDutyFactory) BlockDutyFactory(tech.pegasys.teku.validator.client.duties.BlockDutyFactory) ValidatorLoader(tech.pegasys.teku.validator.client.loader.ValidatorLoader) DataDirLayout(tech.pegasys.teku.service.serviceutils.layout.DataDirLayout) SafeFuture(tech.pegasys.teku.infrastructure.async.SafeFuture) ValidatorRestApiConfig(tech.pegasys.teku.validator.client.restapi.ValidatorRestApiConfig) Random(java.util.Random) LocalSlashingProtector(tech.pegasys.teku.core.signatures.LocalSlashingProtector) ArrayList(java.util.ArrayList) EventChannels(tech.pegasys.teku.infrastructure.events.EventChannels) ValidatorRestApi(tech.pegasys.teku.validator.client.restapi.ValidatorRestApi) PublicKeyLoader(tech.pegasys.teku.validator.client.loader.PublicKeyLoader) SlotBasedScheduledDuties(tech.pegasys.teku.validator.client.duties.SlotBasedScheduledDuties) JsonProvider(tech.pegasys.teku.provider.JsonProvider) ChainHeadTracker(tech.pegasys.teku.validator.client.duties.synccommittee.ChainHeadTracker) BeaconCommitteeSubscriptions(tech.pegasys.teku.validator.client.duties.BeaconCommitteeSubscriptions) Spec(tech.pegasys.teku.spec.Spec) Path(java.nio.file.Path) Service(tech.pegasys.teku.service.serviceutils.Service) ProposerConfigProvider(tech.pegasys.teku.validator.client.proposerconfig.ProposerConfigProvider) AsyncRunner(tech.pegasys.teku.infrastructure.async.AsyncRunner) ValidatorLogger(tech.pegasys.teku.infrastructure.logging.ValidatorLogger) SyncDataAccessor(tech.pegasys.teku.infrastructure.io.SyncDataAccessor) RestApi(tech.pegasys.teku.infrastructure.restapi.RestApi) ServiceConfig(tech.pegasys.teku.service.serviceutils.ServiceConfig) BeaconNodeApi(tech.pegasys.teku.validator.beaconnode.BeaconNodeApi) SyncCommitteeScheduledDuties(tech.pegasys.teku.validator.client.duties.synccommittee.SyncCommitteeScheduledDuties) List(java.util.List) Logger(org.apache.logging.log4j.Logger) TekuMetricCategory(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory) ValidatorApiChannel(tech.pegasys.teku.validator.api.ValidatorApiChannel) InProcessBeaconNodeApi(tech.pegasys.teku.validator.eventadapter.InProcessBeaconNodeApi) OwnedValidators(tech.pegasys.teku.validator.client.loader.OwnedValidators) SlashingProtector(tech.pegasys.teku.core.signatures.SlashingProtector) SystemSignalListener(tech.pegasys.teku.infrastructure.io.SystemSignalListener) GenesisDataProvider(tech.pegasys.teku.validator.beaconnode.GenesisDataProvider) ProposerConfigLoader(tech.pegasys.teku.validator.client.proposerconfig.loader.ProposerConfigLoader) SlashingProtectionLogger(tech.pegasys.teku.validator.client.loader.SlashingProtectionLogger) Optional(java.util.Optional) RemoteBeaconNodeApi(tech.pegasys.teku.validator.remote.RemoteBeaconNodeApi) MetricsSystem(org.hyperledger.besu.plugin.services.MetricsSystem) LogManager(org.apache.logging.log4j.LogManager) SpecMilestone(tech.pegasys.teku.spec.SpecMilestone) ValidatorTimingChannel(tech.pegasys.teku.validator.api.ValidatorTimingChannel) AttestationDutyFactory(tech.pegasys.teku.validator.client.duties.attestations.AttestationDutyFactory) BlockDutyFactory(tech.pegasys.teku.validator.client.duties.BlockDutyFactory) ChainHeadTracker(tech.pegasys.teku.validator.client.duties.synccommittee.ChainHeadTracker) OwnedValidators(tech.pegasys.teku.validator.client.loader.OwnedValidators) BeaconCommitteeSubscriptions(tech.pegasys.teku.validator.client.duties.BeaconCommitteeSubscriptions) SyncCommitteeScheduledDuties(tech.pegasys.teku.validator.client.duties.synccommittee.SyncCommitteeScheduledDuties) ProposerConfigLoader(tech.pegasys.teku.validator.client.proposerconfig.loader.ProposerConfigLoader) JsonProvider(tech.pegasys.teku.provider.JsonProvider) SlotBasedScheduledDuties(tech.pegasys.teku.validator.client.duties.SlotBasedScheduledDuties) Random(java.util.Random)

Aggregations

Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 Random (java.util.Random)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 MetricsSystem (org.hyperledger.besu.plugin.services.MetricsSystem)1 LocalSlashingProtector (tech.pegasys.teku.core.signatures.LocalSlashingProtector)1 SlashingProtector (tech.pegasys.teku.core.signatures.SlashingProtector)1 AsyncRunner (tech.pegasys.teku.infrastructure.async.AsyncRunner)1 SafeFuture (tech.pegasys.teku.infrastructure.async.SafeFuture)1 EventChannels (tech.pegasys.teku.infrastructure.events.EventChannels)1 SyncDataAccessor (tech.pegasys.teku.infrastructure.io.SyncDataAccessor)1 SystemSignalListener (tech.pegasys.teku.infrastructure.io.SystemSignalListener)1 ValidatorLogger (tech.pegasys.teku.infrastructure.logging.ValidatorLogger)1 TekuMetricCategory (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory)1 RestApi (tech.pegasys.teku.infrastructure.restapi.RestApi)1 JsonProvider (tech.pegasys.teku.provider.JsonProvider)1 Service (tech.pegasys.teku.service.serviceutils.Service)1