@Test void performTask_shouldThrowInvalidCheckpointExceptionWhenStateIsAheadOfSlot() { chainBuilder.generateBlocksUpToSlot(EPOCH_START_SLOT.plus(1)); final SignedBlockAndState base = chainBuilder.getBlockAndStateAtSlot(EPOCH_START_SLOT.plus(1)); when(stateProvider.getState(base.getRoot())) .thenReturn(SafeFuture.completedFuture(Optional.of(base.getState()))); final SafeFuture<Optional<BeaconState>> result = createTask(EPOCH, base.getRoot()).performTask(); assertThatSafeFuture(result).isCompletedExceptionallyWith(InvalidCheckpointException.class); }
@Override public SafeFuture<Optional<BeaconState>> performTask() { return getBaseState().thenApply(maybeState -> maybeState.map(this::regenerateFromState)); }
CheckpointStateTask implements CacheableTask<Checkpoint, BeaconState> { @Override public SafeFuture<Optional<BeaconState>> performTask() { return getBaseState().thenApply(maybeState -> maybeState.map(this::regenerateFromState)); } }
CheckpointStateTask implements CacheableTask<Checkpoint, BeaconState> { @Override public SafeFuture<Optional<BeaconState>> performTask() { return getBaseState().thenApply(maybeState -> maybeState.map(this::regenerateFromState)); } CheckpointStateTask(final Checkpoint checkpoint, final AsyncStateProvider stateProvider); private  CheckpointStateTask(
      final Checkpoint checkpoint,
      final AsyncStateProvider stateProvider,
      final BeaconState baseState); }
CheckpointStateTask implements CacheableTask<Checkpoint, BeaconState> { @Override public SafeFuture<Optional<BeaconState>> performTask() { return getBaseState().thenApply(maybeState -> maybeState.map(this::regenerateFromState)); } CheckpointStateTask(final Checkpoint checkpoint, final AsyncStateProvider stateProvider); private  CheckpointStateTask(
      final Checkpoint checkpoint,
      final AsyncStateProvider stateProvider,
      final BeaconState baseState); @Override Checkpoint getKey(); @Override Stream<Checkpoint> streamIntermediateSteps(); @Override CacheableTask<Checkpoint, BeaconState> rebase(final BeaconState newBaseValue); @Override SafeFuture<Optional<BeaconState>> performTask(); }
CheckpointStateTask implements CacheableTask<Checkpoint, BeaconState> { @Override public SafeFuture<Optional<BeaconState>> performTask() { return getBaseState().thenApply(maybeState -> maybeState.map(this::regenerateFromState)); } CheckpointStateTask(final Checkpoint checkpoint, final AsyncStateProvider stateProvider); private  CheckpointStateTask(
      final Checkpoint checkpoint,
      final AsyncStateProvider stateProvider,
      final BeaconState baseState); @Override Checkpoint getKey(); @Override Stream<Checkpoint> streamIntermediateSteps(); @Override CacheableTask<Checkpoint, BeaconState> rebase(final BeaconState newBaseValue); @Override SafeFuture<Optional<BeaconState>> performTask();  }