class ChainDataProvider {

  public SafeFuture<Optional<List<Committee>>> getCommitteesAtEpoch(final UInt64 epoch) {
    if (!combinedChainDataClient.isChainDataFullyAvailable()) {
      return chainUnavailable();
    }

    final UInt64 earliestQueryableSlot =
        CommitteeUtil.getEarliestQueryableSlotForTargetEpoch(epoch);
    if (recentChainData.getHeadSlot().isLessThan(earliestQueryableSlot)) {
      return SafeFuture.completedFuture(Optional.empty());
    }

    final UInt64 queryEpoch = compute_epoch_at_slot(earliestQueryableSlot);
    return combinedChainDataClient
        .getCheckpointStateAtEpoch(queryEpoch)
        .thenApply(
            maybeResult ->
                maybeResult.map(
                    checkpointState ->
                        combinedChainDataClient
                            .getCommitteesFromState(checkpointState.getState(), epoch).stream()
                            .map(Committee::new)
                            .collect(Collectors.toList())));
  }

  public  ChainDataProvider(
      final RecentChainData recentChainData,
      final CombinedChainDataClient combinedChainDataClient);

}