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:
Michael Sproul
2025-09-27 00:44:50 +10:00
committed by GitHub
parent 20c6ce4553
commit c754234b2c
19 changed files with 765 additions and 351 deletions

View File

@@ -230,6 +230,23 @@ pub enum BeaconChainError {
columns_found: usize,
},
FailedToReconstructBlobs(String),
ProposerCacheIncorrectState {
state_decision_block_root: Hash256,
requested_decision_block_root: Hash256,
},
ProposerCacheAccessorFailure {
decision_block_root: Hash256,
proposal_epoch: Epoch,
},
ProposerCacheOutOfBounds {
slot: Slot,
epoch: Epoch,
},
ProposerCacheWrongEpoch {
request_epoch: Epoch,
cache_epoch: Epoch,
},
SkipProposerPreparation,
}
easy_from_to!(SlotProcessingError, BeaconChainError);