On the BeaconState we store three committee caches:
RelativeEpoch::Previous: for state.current_epoch() - 1RelativeEpoch::Current: for state.current_epoch()RelativeEpoch::Next: for state.current_epoch() + 1I propose that the RelativeEpoch::Next is unnecessary whilst MIN_SEED_LOOKAHEAD < 2 (it is presently 1).
As we process randao reveals during state.current_epoch(), we're updating the randao mix for state.current_epoch() + MIN_SEED_LOOKAHEAD. Therefore, whilst MIN_SEED_LOOKAHEAD == 1, the randao mix (and therefore the shuffling seed) for RelativeEpoch::Next cannot be known until the last block has been applied to the current epoch.
There's no case where we _must_ know the shuffling for the next epoch and it seems that having the usually-invalid next-epoch shuffling hanging around is likely to entice bugs.
Change CACHED_EPOCHS to 2, leaving only the Previous and Current committee caches. Remove all code for the Next committee cache.
This is probably not a great first issue until the linked eth-specs issue is resolved
Consider it blocked!
EDIT: Blocked on spec issue #1269
Closing as v0.8.1 of the spec fixes the off-by-one error and makes the next epoch cache viable again!
MNECVA!