mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
fix: payload_attestation_data when no block received for slot (#9225)
Addresses issue #9220 The `payload_attestation_data` endpoint returns 400 when no block has been received for the requested slot. This causes the VC to log at CRIT level for what is expected behaviour per spec: validators should simply not submit a payload attestation when no block has been seen. - Return 404 (Not Found) instead of 400 from `payload_attestation_data` when no block exists for the slot. This is consistent with other beacon api endpoints. - Downgrade the VC log from `crit` to `debug` when a 503 is received, since this is an expected no-op per spec. - Add `BlockNotFound` rejection type to `warp_utils`. - Add a test asserting the 404 response for an empty slot. Co-Authored-By: Josh King <josh@sigmaprime.io> Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -139,14 +139,22 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
|
||||
beacon_node
|
||||
.get_validator_payload_attestation_data(slot)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get payload attestation data: {e:?}"))
|
||||
.map(|resp| resp.into_data())
|
||||
.map(|opt| opt.map(|resp| resp.into_data()))
|
||||
})
|
||||
.await
|
||||
{
|
||||
Ok(data) => data,
|
||||
Ok(Some(data)) => data,
|
||||
Ok(None) => {
|
||||
// Per the consensus spec, validators should not submit a
|
||||
// payload attestation when no block has been seen for the slot.
|
||||
debug!(
|
||||
%slot,
|
||||
"No block received for slot, skipping payload attestation"
|
||||
);
|
||||
return;
|
||||
}
|
||||
Err(e) => {
|
||||
crit!(
|
||||
error!(
|
||||
error = %e,
|
||||
%slot,
|
||||
"Failed to produce payload attestation data"
|
||||
|
||||
Reference in New Issue
Block a user