class RecentChainData implements StoreUpdateHandler {

  public SafeFuture<Void> initializeFromGenesis(final BeaconState genesisState) {
    final AnchorPoint genesis = AnchorPoint.fromGenesisState(genesisState);
    return StoreBuilder.forkChoiceStoreBuilder(
            asyncRunner, metricsSystem, blockProvider, stateProvider, genesis)
        .storeConfig(storeConfig)
        .build()
        .thenAccept(
            store -> {
              final boolean result = setStore(store);
              if (!result) {
                throw new IllegalStateException(
                    "Failed to set genesis state: store has already been initialized");
              }

              storageUpdateChannel.onGenesis(genesis);
              eventBus.post(genesis);

              // The genesis state is by definition finalized so just get the root from there.
              final SignedBlockAndState headBlock = store.getLatestFinalizedBlockAndState();
              updateHead(headBlock.getRoot(), headBlock.getSlot());
            });
  }

    RecentChainData(
      final AsyncRunner asyncRunner,
      final MetricsSystem metricsSystem,
      final StoreConfig storeConfig,
      final BlockProvider blockProvider,
      final StateAndBlockProvider stateProvider,
      final StorageUpdateChannel storageUpdateChannel,
      final ProtoArrayStorageChannel protoArrayStorageChannel,
      final FinalizedCheckpointChannel finalizedCheckpointChannel,
      final ChainHeadChannel chainHeadChannel,
      final EventBus eventBus);

}