Lighthouse: Remove "next epoch" committee cache

Created on 24 Jun 2019  路  4Comments  路  Source: sigp/lighthouse

Description

On the BeaconState we store three committee caches:

  • RelativeEpoch::Previous: for state.current_epoch() - 1
  • RelativeEpoch::Current: for state.current_epoch()
  • RelativeEpoch::Next: for state.current_epoch() + 1

I 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.

Steps to resolve

Change CACHED_EPOCHS to 2, leaving only the Previous and Current committee caches. Remove all code for the Next committee cache.

All 4 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulhauner picture paulhauner  路  5Comments

michaelsproul picture michaelsproul  路  5Comments

michaelsproul picture michaelsproul  路  4Comments

michaelsproul picture michaelsproul  路  4Comments

paulhauner picture paulhauner  路  3Comments