Add attestation_due_bps_gloas and payload_attestation_due_bps to ChainSpec

Spec: `get_attestation_due_ms(epoch)` uses ATTESTATION_DUE_BPS_GLOAS
(2500) for Gloas epochs vs ATTESTATION_DUE_BPS (3333) pre-Gloas.
`get_payload_attestation_due_ms` uses PAYLOAD_ATTESTATION_DUE_BPS (7500).

- Add both BPS fields to ChainSpec with derived Duration values
- Add `get_attestation_due::<E>(slot)` that returns epoch-appropriate
  threshold matching the spec
- Add `get_payload_attestation_due()` matching the spec
- Use them in proto_array record_block_timeliness instead of hardcoded
  values
This commit is contained in:
dapplion
2026-04-02 00:56:42 -05:00
parent 9db37b8bd3
commit 6763862e0f
2 changed files with 55 additions and 6 deletions

View File

@@ -632,11 +632,9 @@ impl ProtoArray {
// Anchor gets [True, True]. Others computed from time_into_slot.
block_timeliness_attestation_threshold: is_genesis
|| (is_current_slot
&& time_into_slot < spec.get_unaggregated_attestation_due()),
// TODO(gloas): use Gloas-specific PTC due threshold once
// `get_payload_attestation_due_ms` is on ChainSpec.
&& time_into_slot < spec.get_attestation_due::<E>(current_slot)),
block_timeliness_ptc_threshold: is_genesis
|| (is_current_slot && time_into_slot < 3 * spec.get_slot_duration() / 4),
|| (is_current_slot && time_into_slot < spec.get_payload_attestation_due()),
equivocating_attestation_score: 0,
})
};
@@ -672,6 +670,7 @@ impl ProtoArray {
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
// with `equivocating_attestation_score` which only tracks equivocating