Proposer duties backwards compat (#8335)

The beacon API spec wasn't updated to use the Fulu definition of `dependent_root` for the proposer duties endpoint. No other client updated their logic, so to retain backwards compatibility the decision has been made to continue using the block root at the end of epoch `N - 1`, and introduce a new v2 endpoint down the track to use the correct dependent root.

Eth R&D discussion: https://discord.com/channels/595666850260713488/598292067260825641/1433036715848765562


  Change the behaviour of the v1 endpoint back to using the last slot of `N - 1` rather than the last slot of `N - 2`. This introduces the possibility of dependent root false positives (the root can change without changing the shuffling), but causes the least compatibility issues with other clients.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
Michael Sproul
2025-11-03 19:06:03 +11:00
committed by GitHub
parent 25832e5862
commit 4908687e7d
6 changed files with 64 additions and 16 deletions

View File

@@ -911,6 +911,22 @@ impl<E: EthSpec> BeaconState<E> {
}
}
/// Returns the block root at the last slot of `epoch - 1`.
///
/// This can be deleted after Glamsterdam and the removal of the v1 proposer duties endpoint.
pub fn legacy_proposer_shuffling_decision_root_at_epoch(
&self,
epoch: Epoch,
head_block_root: Hash256,
) -> Result<Hash256, Error> {
let decision_slot = epoch.saturating_sub(1u64).end_slot(E::slots_per_epoch());
if self.slot() <= decision_slot {
Ok(head_block_root)
} else {
self.get_block_root(decision_slot).copied()
}
}
/// Returns the block root which decided the proposer shuffling for the current epoch. This root
/// can be used to key this proposer shuffling.
///