Search in sources :

Example 1 with ActiveValidatorCache

use of tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorCache in project teku by ConsenSys.

the class AbstractDataBackedRestAPIIntegrationTest method setupStorage.

private void setupStorage(final StateStorageMode storageMode, final boolean useMockForkChoice, final SpecMilestone specMilestone) {
    this.spec = TestSpecFactory.createMinimal(specMilestone);
    this.specConfig = spec.getGenesisSpecConfig();
    this.storageSystem = InMemoryStorageSystemBuilder.create().specProvider(spec).storageMode(storageMode).build();
    activeValidatorChannel = new ActiveValidatorCache(spec, 10);
    recentChainData = storageSystem.recentChainData();
    chainBuilder = ChainBuilder.create(spec, VALIDATOR_KEYS);
    chainUpdater = new ChainUpdater(recentChainData, chainBuilder, spec);
    forkChoice = useMockForkChoice ? mock(ForkChoice.class) : new ForkChoice(spec, new InlineEventThread(), recentChainData, new StubForkChoiceNotifier(), new MergeTransitionBlockValidator(spec, recentChainData, ExecutionEngineChannel.NOOP));
}
Also used : ActiveValidatorCache(tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorCache) ChainUpdater(tech.pegasys.teku.storage.client.ChainUpdater) MergeTransitionBlockValidator(tech.pegasys.teku.statetransition.forkchoice.MergeTransitionBlockValidator) ForkChoice(tech.pegasys.teku.statetransition.forkchoice.ForkChoice) InlineEventThread(tech.pegasys.teku.infrastructure.async.eventthread.InlineEventThread) StubForkChoiceNotifier(tech.pegasys.teku.statetransition.forkchoice.StubForkChoiceNotifier)

Example 2 with ActiveValidatorCache

use of tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorCache in project teku by ConsenSys.

the class BeaconChainController method initRestAPI.

public void initRestAPI() {
    LOG.debug("BeaconChainController.initRestAPI()");
    final DataProvider dataProvider = DataProvider.builder().spec(spec).recentChainData(recentChainData).combinedChainDataClient(combinedChainDataClient).p2pNetwork(p2pNetwork).syncService(syncService).validatorApiChannel(eventChannels.getPublisher(ValidatorApiChannel.class, beaconAsyncRunner)).attestationPool(attestationPool).blockManager(blockManager).attestationManager(attestationManager).isLivenessTrackingEnabled(beaconConfig.beaconRestApiConfig().isBeaconLivenessTrackingEnabled()).activeValidatorChannel(eventChannels.getPublisher(ActiveValidatorChannel.class, beaconAsyncRunner)).attesterSlashingPool(attesterSlashingPool).proposerSlashingPool(proposerSlashingPool).voluntaryExitPool(voluntaryExitPool).syncCommitteeContributionPool(syncCommitteeContributionPool).payloadAttributesCalculator(Optional.of(forkChoiceNotifier.getPayloadAttributesCalculator())).build();
    if (beaconConfig.beaconRestApiConfig().isRestApiEnabled()) {
        beaconRestAPI = Optional.of(new BeaconRestApi(dataProvider, beaconConfig.beaconRestApiConfig(), eventChannels, eventAsyncRunner));
        if (beaconConfig.beaconRestApiConfig().isBeaconLivenessTrackingEnabled()) {
            final int initialValidatorsCount = spec.getGenesisSpec().getConfig().getMinGenesisActiveValidatorCount();
            eventChannels.subscribe(ActiveValidatorChannel.class, new ActiveValidatorCache(spec, initialValidatorsCount));
        }
    } else {
        LOG.info("rest-api-enabled is false, not starting rest api.");
    }
}
Also used : ChainDataProvider(tech.pegasys.teku.api.ChainDataProvider) DataProvider(tech.pegasys.teku.api.DataProvider) ActiveValidatorCache(tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorCache) ActiveValidatorChannel(tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorChannel) BeaconRestApi(tech.pegasys.teku.beaconrestapi.BeaconRestApi) AnchorPoint(tech.pegasys.teku.spec.datastructures.state.AnchorPoint)

Aggregations

ActiveValidatorCache (tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorCache)2 ChainDataProvider (tech.pegasys.teku.api.ChainDataProvider)1 DataProvider (tech.pegasys.teku.api.DataProvider)1 BeaconRestApi (tech.pegasys.teku.beaconrestapi.BeaconRestApi)1 InlineEventThread (tech.pegasys.teku.infrastructure.async.eventthread.InlineEventThread)1 AnchorPoint (tech.pegasys.teku.spec.datastructures.state.AnchorPoint)1 ForkChoice (tech.pegasys.teku.statetransition.forkchoice.ForkChoice)1 MergeTransitionBlockValidator (tech.pegasys.teku.statetransition.forkchoice.MergeTransitionBlockValidator)1 StubForkChoiceNotifier (tech.pegasys.teku.statetransition.forkchoice.StubForkChoiceNotifier)1 ActiveValidatorChannel (tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorChannel)1 ChainUpdater (tech.pegasys.teku.storage.client.ChainUpdater)1