Exclude slashed validators from all duties (EIP-8045)#5115
Open
barnabasbusa wants to merge 4 commits intoethereum:masterfrom
Open
Exclude slashed validators from all duties (EIP-8045)#5115barnabasbusa wants to merge 4 commits intoethereum:masterfrom
barnabasbusa wants to merge 4 commits intoethereum:masterfrom
Conversation
Filter slashed validators from the proposer candidate pool upfront in get_beacon_proposer_indices, so the EIP-7917 proposer_lookahead only contains active and unslashed indices. Add an in-loop slashed skip to compute_balance_weighted_selection, which transitively covers sync committee selection (get_next_sync_committee_indices), the payload timeliness committee (compute_ptc), and any future duty selection built on this primitive.
Covers the six test cases listed in the EIP text: proposer_lookahead (epoch_processing): - slashed validators do not appear in the newly appended lookahead epoch after process_proposer_lookahead - a full SLOTS_PER_EPOCH worth of proposers is still produced when the bulk of active validators are slashed compute_balance_weighted_selection (unittests): - shuffled sampling never returns slashed indices - in-order sampling (shuffle_indices=False, PTC code path) also skips slashed candidates get_next_sync_committee_indices (unittests): - sync committee output excludes slashed validators - a full SYNC_COMMITTEE_SIZE committee is still generated with many slashed validators compute_ptc (unittests): - every slot's PTC excludes slashed validators
4 tasks
The in-loop slashed skip could spin indefinitely whenever every candidate in the input pool is slashed (e.g. a minimal-preset test state where every beacon committee member of a slot is slashed, which compute_ptc passes through this helper). Move the filter in front of the selection loop so the degenerate all-slashed input terminates cleanly, and fall back to the original pool when no unslashed candidates remain so the helper stays live in that edge case. Also materially faster in realistic cases since we skip shuffled_index work on slashed candidates. Local: the full gloas minimal suite ran in 5:56 (1096 passed, 0 failed). With the previous in-loop skip the same suite hung indefinitely on CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements EIP-8045 ("Exclude slashed validators from all duties") at the Gloas fork. Paired with the EIP text update in ethereum/EIPs#11443.
Spec changes (
specs/gloas/beacon-chain.md)get_beacon_proposer_indices— filter slashed validators out of the active set upfront, before invokingcompute_proposer_indices. The EIP-7917proposer_lookaheadis populated from this function each epoch, so it is guaranteed to contain only active and unslashed validators.compute_balance_weighted_selection— in-loopslashedskip after the candidate is drawn. Because Gloas routes sync committee selection, proposer selection, and PTC selection (get_next_sync_committee_indices,compute_proposer_indices,compute_ptc) through this helper, a single change covers every balance-weighted duty, including any future one built on the same primitive.The two layers intentionally use different filtering strategies, consistent with the EIP's rationale: upfront for proposer (small candidate set, avoids wasted shuffling work), in-loop for the helper (matches its existing iterative acceptance-check shape).
Intro bullet list updated to reference EIP-8045 alongside EIP-7732. No new state fields, no fork transition logic, so
specs/gloas/fork.mdis untouched.Scope note
EIP-8045 targets balance-weighted duty selection. Attestation beacon committees (
compute_committee) are not modified — they're shuffle-based, not balance-weighted, and slashed attestors are already rejected atprocess_attestationtime. See the EIP text for the full rationale.Design notes
proposer_lookaheadis pre-computed once per epoch byprocess_proposer_lookahead. A validator slashed inside an already-populated lookahead window is not retroactively removed — the EIP security considerations explicitly accept this, since with EIP-7917 the lookahead is state-resident and slashings no longer reshuffle it.compute_balance_weighted_selectionslashed skip is a defense-in-depth no-op for the proposer path, but load-bearing for sync committee and PTC.get_next_sync_committee_indicesoverride needed in this PR — the Gloas version already callscompute_balance_weighted_selection, and the updated EIP text (Update EIP-8045: Exclude slashed validators from all duties EIPs#11443) was trimmed accordingly.Tests
All six EIP test cases (plus PTC coverage) are included under
tests/core/pyspec/eth_consensus_specs/test/gloas/:state.proposer_lookaheadafterprocess_proposer_lookaheadSLOTS_PER_EPOCHlookahead entries still produced with many slashed validatorsget_next_sync_committee_indicesoutputSYNC_COMMITTEE_SIZEcommittee produced with many slashed validatorscompute_balance_weighted_selectionskips slashed (shuffled path)compute_balance_weighted_selectionskips slashed (in-order path, PTC code path)compute_ptcexcludes slashed validators from every slot's PTCtest/fulu/epoch_processing/test_process_proposer_lookahead.pyLocal verification:
make lintclean, all 7 new tests pass on theminimalpreset.Test plan
Related
proposer_lookahead, already in Fulu) and EIP-7732 (compute_balance_weighted_selection, Gloas)