Allow /validator apis to work pre-genesis (#7729)

N/A


  Lighthouse BN http endpoint would return a server error pre-genesis on the `validator/duties/attester` and `validator/prepare_beacon_proposer` because `slot_clock.now()` would return a `None` pre-genesis.

The prysm VC depends on the endpoints pre-genesis and was having issues interoping with the lighthouse bn because of this reason.

The proposer duties endpoint explicitly handles the pre-genesis case here
538067f1ff/beacon_node/http_api/src/proposer_duties.rs (L23-L28)

I see no reason why we can't make the other endpoints more flexible to work pre-genesis. This PR handles the pre-genesis case on the attester and prepare_beacon_proposer endpoints as well.

Thanks for raising @james-prysm.
This commit is contained in:
Pawan Dhananjay
2025-07-13 23:42:55 -07:00
committed by GitHub
parent 6409a32274
commit 309c301363
2 changed files with 22 additions and 7 deletions

View File

@@ -3790,7 +3790,11 @@ pub fn serve<T: BeaconChainTypes>(
.ok_or(BeaconChainError::ExecutionLayerMissing)
.map_err(warp_utils::reject::unhandled_error)?;
let current_slot = chain.slot().map_err(warp_utils::reject::unhandled_error)?;
let current_slot = chain
.slot_clock
.now_or_genesis()
.ok_or(BeaconChainError::UnableToReadSlot)
.map_err(warp_utils::reject::unhandled_error)?;
let current_epoch = current_slot.epoch(T::EthSpec::slots_per_epoch());
debug!(