Fix get_validator_duties_early after #8415 merge

PR #8415 added Gloas-only payload-timeliness-committee assertions to
test_get_validator_duties_early but kept the test using
ApiTester::new() (default mainnet spec). With FORK_NAME=gloas this
produces a phase0 chain, so post_validator_duties_ptc returns 500
with BeaconStateError(IncorrectStateVariant).

Two issues fixed:

1. Switch the test wrapper to ApiTester::new_with_hard_forks() so the
   chain is actually at Gloas under FORK_NAME=gloas. This is the same
   pattern already used by get_validator_duties_ptc and
   get_validator_payload_attestation_data.

2. Compute dependent_root using
   ChainSpec::proposer_shuffling_decision_slot rather than the
   hardcoded "(current_epoch - 1).end_slot()" formula. Post-Fulu the
   proposer shuffling decision slot moved to the end of epoch N - 2,
   so the cache is now keyed by that root. The old formula matched
   the legacy cache key and silently passed on phase0 chains.

Verified locally with FORK_NAME=gloas (195/195) and FORK_NAME=fulu
(195/195).
This commit is contained in:
dapplion
2026-04-27 10:10:51 +02:00
parent 20ba83abbf
commit 2cfe5ff380

View File

@@ -3566,7 +3566,9 @@ impl ApiTester {
let dependent_root = self
.chain
.block_root_at_slot(
current_epoch.start_slot(E::slots_per_epoch()) - 1,
self.chain
.spec
.proposer_shuffling_decision_slot::<E>(current_epoch),
WhenSlotSkipped::Prev,
)
.unwrap()
@@ -7971,7 +7973,7 @@ async fn get_validator_duties_early() {
if !fork_name_from_env().is_some_and(|f| f.gloas_enabled()) {
return;
}
ApiTester::new()
ApiTester::new_with_hard_forks()
.await
.test_get_validator_duties_early()
.await;