Document is_head_weak spec divergence and impact

This commit is contained in:
dapplion
2026-04-02 00:50:46 -05:00
parent a1296fc0c7
commit 9db37b8bd3

View File

@@ -672,12 +672,17 @@ impl ProtoArray {
Ok(()) Ok(())
} }
/// Spec: `is_head_weak`. // TODO(gloas): the spec adds weight from equivocating validators in the
/// // head slot's *committees*, regardless of who they voted for. We approximate
/// The spec adds weight from equivocating validators in the head slot's // with `equivocating_attestation_score` which only tracks equivocating
/// committees. We approximate this with `equivocating_attestation_score` // validators whose vote pointed at this block. This under-counts when an
/// which tracks equivocating validators that voted for this block (close // equivocating validator is in the committee but voted for a different fork,
/// but not identical to committee membership). // which could allow a re-org the spec wouldn't. In practice the deviation
// is small — it requires equivocating validators voting for competing forks
// AND the head weight to be exactly at the reorg threshold boundary.
// Fixing this properly requires committee computation from BeaconState,
// which is not available in proto_array. The fix would be to pass
// pre-computed equivocating committee weight from the beacon_chain caller.
fn is_head_weak<E: EthSpec>( fn is_head_weak<E: EthSpec>(
&self, &self,
head_node: &ProtoNode, head_node: &ProtoNode,