class StateGenerationTask implements CacheableTask<Bytes32, SignedBlockAndState> {

  @Override
  public Stream<Bytes32> streamIntermediateSteps() {
    final Bytes32 rootParent = tree.getParent(tree.getRootHash()).orElseThrow();
    return Stream.iterate(
            tree.getParent(blockRoot),
            Optional::isPresent,
            current -> current.flatMap(tree::getParent))
        .flatMap(Optional::stream)
        // The root's parent is in the tree but is worse that the current starting point so exclude
        .filter(ancestorRoot -> !ancestorRoot.equals(rootParent));
  }

  public  StateGenerationTask(
      final Bytes32 blockRoot,
      final HashTree tree,
      final SignedBlockAndState baseBlockAndState,
      final Optional<Bytes32> epochBoundaryRoot,
      final BlockProvider blockProvider,
      final StateAndBlockProvider stateAndBlockProvider);

}