mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Permit a null LVH from an INVALID response to newPayload (#4037)
## Issue Addressed NA ## Proposed Changes As discovered in #4034, Lighthouse is not accepting `latest_valid_hash == None` in an `INVALID` response to `newPayload`. The `null`/`None` response *was* illegal at one point, however it was added in https://github.com/ethereum/execution-apis/pull/254. This PR brings Lighthouse in line with the standard and should fix the root cause of what #4034 patched around. ## Additional Info NA
This commit is contained in:
@@ -10,7 +10,9 @@ use types::ExecutionBlockHash;
|
||||
pub enum PayloadStatus {
|
||||
Valid,
|
||||
Invalid {
|
||||
latest_valid_hash: ExecutionBlockHash,
|
||||
/// The EE will provide a `None` LVH when it is unable to determine the
|
||||
/// latest valid ancestor.
|
||||
latest_valid_hash: Option<ExecutionBlockHash>,
|
||||
validation_error: Option<String>,
|
||||
},
|
||||
Syncing,
|
||||
@@ -55,22 +57,10 @@ pub fn process_payload_status(
|
||||
})
|
||||
}
|
||||
}
|
||||
PayloadStatusV1Status::Invalid => {
|
||||
if let Some(latest_valid_hash) = response.latest_valid_hash {
|
||||
// The response is only valid if `latest_valid_hash` is not `null`.
|
||||
Ok(PayloadStatus::Invalid {
|
||||
latest_valid_hash,
|
||||
validation_error: response.validation_error.clone(),
|
||||
})
|
||||
} else {
|
||||
Err(EngineError::Api {
|
||||
error: ApiError::BadResponse(
|
||||
"new_payload: response.status = INVALID but null latest_valid_hash"
|
||||
.to_string(),
|
||||
),
|
||||
})
|
||||
}
|
||||
}
|
||||
PayloadStatusV1Status::Invalid => Ok(PayloadStatus::Invalid {
|
||||
latest_valid_hash: response.latest_valid_hash,
|
||||
validation_error: response.validation_error,
|
||||
}),
|
||||
PayloadStatusV1Status::InvalidBlockHash => {
|
||||
// In the interests of being liberal with what we accept, only raise a
|
||||
// warning here.
|
||||
|
||||
Reference in New Issue
Block a user