mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 21:27:12 +00:00
Gloas engine api updates (#9150)
Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
This commit is contained in:
@@ -43,6 +43,7 @@ pub const ENGINE_GET_PAYLOAD_V2: &str = "engine_getPayloadV2";
|
||||
pub const ENGINE_GET_PAYLOAD_V3: &str = "engine_getPayloadV3";
|
||||
pub const ENGINE_GET_PAYLOAD_V4: &str = "engine_getPayloadV4";
|
||||
pub const ENGINE_GET_PAYLOAD_V5: &str = "engine_getPayloadV5";
|
||||
pub const ENGINE_GET_PAYLOAD_V6: &str = "engine_getPayloadV6";
|
||||
pub const ENGINE_GET_PAYLOAD_TIMEOUT: Duration = Duration::from_secs(2);
|
||||
|
||||
pub const ENGINE_FORKCHOICE_UPDATED_V1: &str = "engine_forkchoiceUpdatedV1";
|
||||
@@ -82,6 +83,7 @@ pub static LIGHTHOUSE_CAPABILITIES: &[&str] = &[
|
||||
ENGINE_GET_PAYLOAD_V3,
|
||||
ENGINE_GET_PAYLOAD_V4,
|
||||
ENGINE_GET_PAYLOAD_V5,
|
||||
ENGINE_GET_PAYLOAD_V6,
|
||||
ENGINE_FORKCHOICE_UPDATED_V1,
|
||||
ENGINE_FORKCHOICE_UPDATED_V2,
|
||||
ENGINE_FORKCHOICE_UPDATED_V3,
|
||||
@@ -1052,10 +1054,25 @@ impl HttpJsonRpc {
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
_ => Err(Error::UnsupportedForkVariant(format!(
|
||||
"called get_payload_v5 with {}",
|
||||
fork_name
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_payload_v6<E: EthSpec>(
|
||||
&self,
|
||||
fork_name: ForkName,
|
||||
payload_id: PayloadId,
|
||||
) -> Result<GetPayloadResponse<E>, Error> {
|
||||
let params = json!([JsonPayloadIdRequest::from(payload_id)]);
|
||||
|
||||
match fork_name {
|
||||
ForkName::Gloas => {
|
||||
let response: JsonGetPayloadResponseGloas<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V5,
|
||||
ENGINE_GET_PAYLOAD_V6,
|
||||
params,
|
||||
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
@@ -1065,7 +1082,7 @@ impl HttpJsonRpc {
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
_ => Err(Error::UnsupportedForkVariant(format!(
|
||||
"called get_payload_v5 with {}",
|
||||
"called get_payload_v6 with {}",
|
||||
fork_name
|
||||
))),
|
||||
}
|
||||
@@ -1237,6 +1254,7 @@ impl HttpJsonRpc {
|
||||
get_payload_v3: capabilities.contains(ENGINE_GET_PAYLOAD_V3),
|
||||
get_payload_v4: capabilities.contains(ENGINE_GET_PAYLOAD_V4),
|
||||
get_payload_v5: capabilities.contains(ENGINE_GET_PAYLOAD_V5),
|
||||
get_payload_v6: capabilities.contains(ENGINE_GET_PAYLOAD_V6),
|
||||
get_client_version_v1: capabilities.contains(ENGINE_GET_CLIENT_VERSION_V1),
|
||||
get_blobs_v1: capabilities.contains(ENGINE_GET_BLOBS_V1),
|
||||
get_blobs_v2: capabilities.contains(ENGINE_GET_BLOBS_V2),
|
||||
@@ -1429,10 +1447,10 @@ impl HttpJsonRpc {
|
||||
}
|
||||
}
|
||||
ForkName::Gloas => {
|
||||
if engine_capabilities.get_payload_v5 {
|
||||
self.get_payload_v5(fork_name, payload_id).await
|
||||
if engine_capabilities.get_payload_v6 {
|
||||
self.get_payload_v6(fork_name, payload_id).await
|
||||
} else {
|
||||
Err(Error::RequiredMethodUnsupported("engine_getPayloadv5"))
|
||||
Err(Error::RequiredMethodUnsupported("engine_getPayloadV6"))
|
||||
}
|
||||
}
|
||||
ForkName::Base | ForkName::Altair => Err(Error::UnsupportedForkVariant(format!(
|
||||
|
||||
Reference in New Issue
Block a user