Search in sources :

Example 1 with StorageUpdateChannel

use of tech.pegasys.teku.storage.api.StorageUpdateChannel in project teku by ConsenSys.

the class BeaconChainController method initialize.

protected SafeFuture<?> initialize() {
    final StoreConfig storeConfig = beaconConfig.storeConfig();
    coalescingChainHeadChannel = new CoalescingChainHeadChannel(eventChannels.getPublisher(ChainHeadChannel.class), EVENT_LOG);
    StorageQueryChannel storageQueryChannel = eventChannels.getPublisher(StorageQueryChannel.class, beaconAsyncRunner);
    StorageUpdateChannel storageUpdateChannel = eventChannels.getPublisher(StorageUpdateChannel.class, beaconAsyncRunner);
    final VoteUpdateChannel voteUpdateChannel = eventChannels.getPublisher(VoteUpdateChannel.class);
    return initWeakSubjectivity(storageQueryChannel, storageUpdateChannel).thenCompose(__ -> StorageBackedRecentChainData.create(metricsSystem, storeConfig, beaconAsyncRunner, storageQueryChannel, storageUpdateChannel, voteUpdateChannel, eventChannels.getPublisher(FinalizedCheckpointChannel.class, beaconAsyncRunner), coalescingChainHeadChannel, spec)).thenCompose(client -> {
        // Setup chain storage
        this.recentChainData = client;
        if (recentChainData.isPreGenesis()) {
            setupInitialState(client);
        } else if (beaconConfig.eth2NetworkConfig().isUsingCustomInitialState()) {
            STATUS_LOG.warnInitialStateIgnored();
        }
        return SafeFuture.completedFuture(client);
    }).thenAccept(client -> {
        // Init other services
        this.initAll();
        eventChannels.subscribe(TimeTickChannel.class, this);
        recentChainData.subscribeStoreInitialized(this::onStoreInitialized);
        recentChainData.subscribeBestBlockInitialized(this::startServices);
    });
}
Also used : SyncCommitteePerformanceTracker(tech.pegasys.teku.validator.coordinator.performance.SyncCommitteePerformanceTracker) SyncCommitteeSubscriptionManager(tech.pegasys.teku.networking.eth2.gossip.subnets.SyncCommitteeSubscriptionManager) Eth2P2PNetwork(tech.pegasys.teku.networking.eth2.Eth2P2PNetwork) SyncCommitteeStateUtils(tech.pegasys.teku.statetransition.synccommittee.SyncCommitteeStateUtils) TimeProvider(tech.pegasys.teku.infrastructure.time.TimeProvider) VersionProvider(tech.pegasys.teku.infrastructure.version.VersionProvider) SyncServiceFactory(tech.pegasys.teku.beacon.sync.SyncServiceFactory) OperationPool(tech.pegasys.teku.statetransition.OperationPool) StableSubnetSubscriber(tech.pegasys.teku.networking.eth2.gossip.subnets.StableSubnetSubscriber) AggregateAttestationValidator(tech.pegasys.teku.statetransition.validation.AggregateAttestationValidator) BlockImportChannel(tech.pegasys.teku.statetransition.block.BlockImportChannel) EpochCachePrimer(tech.pegasys.teku.statetransition.EpochCachePrimer) Duration(java.time.Duration) Path(java.nio.file.Path) Service(tech.pegasys.teku.service.serviceutils.Service) SyncService(tech.pegasys.teku.beacon.sync.SyncService) AsyncRunner(tech.pegasys.teku.infrastructure.async.AsyncRunner) OperationsReOrgManager(tech.pegasys.teku.statetransition.OperationsReOrgManager) ValidatorBasedStableSubnetSubscriber(tech.pegasys.teku.networking.eth2.gossip.subnets.ValidatorBasedStableSubnetSubscriber) NoOpPerformanceTracker(tech.pegasys.teku.validator.coordinator.performance.NoOpPerformanceTracker) SyncCommitteeMessageValidator(tech.pegasys.teku.statetransition.synccommittee.SyncCommitteeMessageValidator) TerminalPowBlockMonitor(tech.pegasys.teku.statetransition.forkchoice.TerminalPowBlockMonitor) ActiveValidatorTracker(tech.pegasys.teku.validator.coordinator.ActiveValidatorTracker) AttestationValidator(tech.pegasys.teku.statetransition.validation.AttestationValidator) Logger(org.apache.logging.log4j.Logger) ValidatorApiChannel(tech.pegasys.teku.validator.api.ValidatorApiChannel) RecentChainData(tech.pegasys.teku.storage.client.RecentChainData) BlockManager(tech.pegasys.teku.statetransition.block.BlockManager) ForkChoice(tech.pegasys.teku.statetransition.forkchoice.ForkChoice) SafeFuture(tech.pegasys.teku.infrastructure.async.SafeFuture) SignedVoluntaryExit(tech.pegasys.teku.spec.datastructures.operations.SignedVoluntaryExit) Bytes(org.apache.tuweni.bytes.Bytes) EventChannels(tech.pegasys.teku.infrastructure.events.EventChannels) WeakSubjectivityValidator(tech.pegasys.teku.weaksubjectivity.WeakSubjectivityValidator) FileKeyValueStore(tech.pegasys.teku.storage.store.FileKeyValueStore) SyncCommitteeMessagePool(tech.pegasys.teku.statetransition.synccommittee.SyncCommitteeMessagePool) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) SignatureVerificationService(tech.pegasys.teku.statetransition.validation.signatures.SignatureVerificationService) ZERO(tech.pegasys.teku.infrastructure.unsigned.UInt64.ZERO) SignedBeaconBlock(tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock) FinalizedCheckpointChannel(tech.pegasys.teku.storage.api.FinalizedCheckpointChannel) ForkChoiceNotifierImpl(tech.pegasys.teku.statetransition.forkchoice.ForkChoiceNotifierImpl) AttestationManager(tech.pegasys.teku.statetransition.attestation.AttestationManager) DiscoveryConfig(tech.pegasys.teku.networking.p2p.discovery.DiscoveryConfig) Throwables(com.google.common.base.Throwables) InteropStartupUtil(tech.pegasys.teku.spec.datastructures.interop.InteropStartupUtil) StorageQueryChannel(tech.pegasys.teku.storage.api.StorageQueryChannel) ServiceConfig(tech.pegasys.teku.service.serviceutils.ServiceConfig) PerformanceTracker(tech.pegasys.teku.validator.coordinator.performance.PerformanceTracker) BlockImportNotifications(tech.pegasys.teku.statetransition.block.BlockImportNotifications) CoalescingChainHeadChannel(tech.pegasys.teku.beacon.sync.events.CoalescingChainHeadChannel) STATUS_LOG(tech.pegasys.teku.infrastructure.logging.StatusLogger.STATUS_LOG) SpecMilestone(tech.pegasys.teku.spec.SpecMilestone) CombinedChainDataClient(tech.pegasys.teku.storage.client.CombinedChainDataClient) StoreConfig(tech.pegasys.teku.storage.store.StoreConfig) StorageBackedRecentChainData(tech.pegasys.teku.storage.client.StorageBackedRecentChainData) InvalidConfigurationException(tech.pegasys.teku.infrastructure.exceptions.InvalidConfigurationException) ValidatorPerformanceTrackingMode(tech.pegasys.teku.validator.api.ValidatorPerformanceTrackingMode) Random(java.util.Random) AggregatingAttestationPool(tech.pegasys.teku.statetransition.attestation.AggregatingAttestationPool) Eth1VotingPeriod(tech.pegasys.teku.validator.coordinator.Eth1VotingPeriod) P2PConfig(tech.pegasys.teku.networking.eth2.P2PConfig) AttesterSlashing(tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing) ProposerSlashingValidator(tech.pegasys.teku.statetransition.validation.ProposerSlashingValidator) BeaconBlockBodySchema(tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBodySchema) Eth2P2PNetworkBuilder(tech.pegasys.teku.networking.eth2.Eth2P2PNetworkBuilder) ChainDataProvider(tech.pegasys.teku.api.ChainDataProvider) ActiveValidatorChannel(tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorChannel) Eth1DataCache(tech.pegasys.teku.validator.coordinator.Eth1DataCache) DefaultPerformanceTracker(tech.pegasys.teku.validator.coordinator.performance.DefaultPerformanceTracker) BlockFactory(tech.pegasys.teku.validator.coordinator.BlockFactory) ValidatorApiHandler(tech.pegasys.teku.validator.coordinator.ValidatorApiHandler) DepositProvider(tech.pegasys.teku.validator.coordinator.DepositProvider) TimeTickChannel(tech.pegasys.teku.services.timer.TimeTickChannel) ExecutionEngineChannel(tech.pegasys.teku.spec.executionengine.ExecutionEngineChannel) OperationAcceptedFilter(tech.pegasys.teku.statetransition.OperationAcceptedFilter) BlockValidator(tech.pegasys.teku.statetransition.validation.BlockValidator) FutureItems(tech.pegasys.teku.statetransition.util.FutureItems) AttesterSlashingValidator(tech.pegasys.teku.statetransition.validation.AttesterSlashingValidator) BlockOperationSelectorFactory(tech.pegasys.teku.validator.coordinator.BlockOperationSelectorFactory) SyncCommitteeContributionPool(tech.pegasys.teku.statetransition.synccommittee.SyncCommitteeContributionPool) AsyncRunnerFactory(tech.pegasys.teku.infrastructure.async.AsyncRunnerFactory) ForkChoiceNotifier(tech.pegasys.teku.statetransition.forkchoice.ForkChoiceNotifier) Optional(java.util.Optional) PortAvailability(tech.pegasys.teku.infrastructure.io.PortAvailability) VoteUpdateChannel(tech.pegasys.teku.storage.api.VoteUpdateChannel) MetricsSystem(org.hyperledger.besu.plugin.services.MetricsSystem) ActiveValidatorCache(tech.pegasys.teku.statetransition.validatorcache.ActiveValidatorCache) SignedContributionAndProofValidator(tech.pegasys.teku.statetransition.synccommittee.SignedContributionAndProofValidator) BlockGossipChannel(tech.pegasys.teku.networking.eth2.gossip.BlockGossipChannel) ChainHeadChannel(tech.pegasys.teku.storage.api.ChainHeadChannel) ReexecutingExecutionPayloadBlockManager(tech.pegasys.teku.statetransition.block.ReexecutingExecutionPayloadBlockManager) ForkChoiceTrigger(tech.pegasys.teku.statetransition.forkchoice.ForkChoiceTrigger) AttestationTopicSubscriber(tech.pegasys.teku.networking.eth2.gossip.subnets.AttestationTopicSubscriber) BindException(java.net.BindException) DutyMetrics(tech.pegasys.teku.validator.coordinator.DutyMetrics) Function(java.util.function.Function) NoOpEth2P2PNetwork(tech.pegasys.teku.networking.eth2.mock.NoOpEth2P2PNetwork) ValidatorPerformanceMetrics(tech.pegasys.teku.validator.coordinator.performance.ValidatorPerformanceMetrics) KeyValueStore(tech.pegasys.teku.storage.store.KeyValueStore) ProposerSlashing(tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing) PendingPool(tech.pegasys.teku.statetransition.util.PendingPool) Bytes20(tech.pegasys.teku.infrastructure.bytes.Bytes20) BlockImporter(tech.pegasys.teku.statetransition.block.BlockImporter) Spec(tech.pegasys.teku.spec.Spec) AggregatingSignatureVerificationService(tech.pegasys.teku.statetransition.validation.signatures.AggregatingSignatureVerificationService) SlotEventsChannel(tech.pegasys.teku.ethereum.events.SlotEventsChannel) VoluntaryExitValidator(tech.pegasys.teku.statetransition.validation.VoluntaryExitValidator) EVENT_LOG(tech.pegasys.teku.infrastructure.logging.EventLogger.EVENT_LOG) StorageUpdateChannel(tech.pegasys.teku.storage.api.StorageUpdateChannel) AllSubnetsSubscriber(tech.pegasys.teku.networking.eth2.gossip.subnets.AllSubnetsSubscriber) BeaconRestApi(tech.pegasys.teku.beaconrestapi.BeaconRestApi) AnchorPoint(tech.pegasys.teku.spec.datastructures.state.AnchorPoint) ValidateableAttestation(tech.pegasys.teku.spec.datastructures.attestation.ValidateableAttestation) GenesisHandler(tech.pegasys.teku.statetransition.genesis.GenesisHandler) Comparator(java.util.Comparator) LogManager(org.apache.logging.log4j.LogManager) DataProvider(tech.pegasys.teku.api.DataProvider) AllSyncCommitteeSubscriptions(tech.pegasys.teku.networking.eth2.gossip.subnets.AllSyncCommitteeSubscriptions) Eth1EventsChannel(tech.pegasys.teku.pow.api.Eth1EventsChannel) InteropConfig(tech.pegasys.teku.validator.api.InteropConfig) AsyncRunnerEventThread(tech.pegasys.teku.infrastructure.async.eventthread.AsyncRunnerEventThread) BeaconState(tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState) MergeTransitionBlockValidator(tech.pegasys.teku.statetransition.forkchoice.MergeTransitionBlockValidator) StorageQueryChannel(tech.pegasys.teku.storage.api.StorageQueryChannel) CoalescingChainHeadChannel(tech.pegasys.teku.beacon.sync.events.CoalescingChainHeadChannel) StoreConfig(tech.pegasys.teku.storage.store.StoreConfig) VoteUpdateChannel(tech.pegasys.teku.storage.api.VoteUpdateChannel) StorageUpdateChannel(tech.pegasys.teku.storage.api.StorageUpdateChannel)

Aggregations

Throwables (com.google.common.base.Throwables)1 BindException (java.net.BindException)1 Path (java.nio.file.Path)1 Duration (java.time.Duration)1 Comparator (java.util.Comparator)1 Optional (java.util.Optional)1 Random (java.util.Random)1 Function (java.util.function.Function)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 Bytes (org.apache.tuweni.bytes.Bytes)1 MetricsSystem (org.hyperledger.besu.plugin.services.MetricsSystem)1 ChainDataProvider (tech.pegasys.teku.api.ChainDataProvider)1 DataProvider (tech.pegasys.teku.api.DataProvider)1 SyncService (tech.pegasys.teku.beacon.sync.SyncService)1 SyncServiceFactory (tech.pegasys.teku.beacon.sync.SyncServiceFactory)1 CoalescingChainHeadChannel (tech.pegasys.teku.beacon.sync.events.CoalescingChainHeadChannel)1 BeaconRestApi (tech.pegasys.teku.beaconrestapi.BeaconRestApi)1 SlotEventsChannel (tech.pegasys.teku.ethereum.events.SlotEventsChannel)1 AsyncRunner (tech.pegasys.teku.infrastructure.async.AsyncRunner)1