mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Fix bugs in proposer calculation post-Fulu (#8101)
As identified by a researcher during the Fusaka security competition, we were computing the proposer index incorrectly in some places by computing without lookahead. - [x] Add "low level" checks to computation functions in `consensus/types` to ensure they error cleanly - [x] Re-work the determination of proposer shuffling decision roots, which are now fork aware. - [x] Re-work and simplify the beacon proposer cache to be fork-aware. - [x] Optimise `with_proposer_cache` to use `OnceCell`. - [x] All tests passing. - [x] Resolve all remaining `FIXME(sproul)`s. - [x] Unit tests for `ProtoBlock::proposer_shuffling_root_for_child_block`. - [x] End-to-end regression test. - [x] Test on pre-Fulu network. - [x] Test on post-Fulu network. Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -123,7 +123,7 @@ pub fn is_epoch_cache_initialized<E: EthSpec>(
|
||||
let current_epoch = state.current_epoch();
|
||||
let epoch_cache: &EpochCache = state.epoch_cache();
|
||||
let decision_block_root = state
|
||||
.proposer_shuffling_decision_root(Hash256::zero())
|
||||
.epoch_cache_decision_root(Hash256::zero())
|
||||
.map_err(EpochCacheError::BeaconState)?;
|
||||
|
||||
Ok(epoch_cache
|
||||
@@ -146,7 +146,7 @@ pub fn initialize_epoch_cache<E: EthSpec>(
|
||||
let current_epoch = state.current_epoch();
|
||||
let next_epoch = state.next_epoch().map_err(EpochCacheError::BeaconState)?;
|
||||
let decision_block_root = state
|
||||
.proposer_shuffling_decision_root(Hash256::zero())
|
||||
.epoch_cache_decision_root(Hash256::zero())
|
||||
.map_err(EpochCacheError::BeaconState)?;
|
||||
|
||||
state.build_total_active_balance_cache(spec)?;
|
||||
|
||||
Reference in New Issue
Block a user