mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
USe payload v5
This commit is contained in:
@@ -435,7 +435,7 @@ async fn bellatrix_readiness_logging<T: BeaconChainTypes>(
|
||||
// bellatrix readiness logging in gloas if we dont skip the check below
|
||||
if beacon_chain
|
||||
.spec
|
||||
.fork_name_at_slot(current_slot)
|
||||
.fork_name_at_slot::<T::EthSpec>(current_slot)
|
||||
.gloas_enabled()
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -551,6 +551,7 @@ pub struct EngineCapabilities {
|
||||
pub new_payload_v2: bool,
|
||||
pub new_payload_v3: bool,
|
||||
pub new_payload_v4: bool,
|
||||
pub new_payload_v5: bool,
|
||||
pub forkchoice_updated_v1: bool,
|
||||
pub forkchoice_updated_v2: bool,
|
||||
pub forkchoice_updated_v3: bool,
|
||||
@@ -581,6 +582,9 @@ impl EngineCapabilities {
|
||||
if self.new_payload_v4 {
|
||||
response.push(ENGINE_NEW_PAYLOAD_V4);
|
||||
}
|
||||
if self.new_payload_v5 {
|
||||
response.push(ENGINE_NEW_PAYLOAD_V5);
|
||||
}
|
||||
if self.forkchoice_updated_v1 {
|
||||
response.push(ENGINE_FORKCHOICE_UPDATED_V1);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ pub const ENGINE_NEW_PAYLOAD_V1: &str = "engine_newPayloadV1";
|
||||
pub const ENGINE_NEW_PAYLOAD_V2: &str = "engine_newPayloadV2";
|
||||
pub const ENGINE_NEW_PAYLOAD_V3: &str = "engine_newPayloadV3";
|
||||
pub const ENGINE_NEW_PAYLOAD_V4: &str = "engine_newPayloadV4";
|
||||
pub const ENGINE_NEW_PAYLOAD_V5: &str = "engine_newPayloadV5";
|
||||
pub const ENGINE_NEW_PAYLOAD_TIMEOUT: Duration = Duration::from_secs(8);
|
||||
|
||||
pub const ENGINE_GET_PAYLOAD_V1: &str = "engine_getPayloadV1";
|
||||
@@ -74,6 +75,7 @@ pub static LIGHTHOUSE_CAPABILITIES: &[&str] = &[
|
||||
ENGINE_NEW_PAYLOAD_V2,
|
||||
ENGINE_NEW_PAYLOAD_V3,
|
||||
ENGINE_NEW_PAYLOAD_V4,
|
||||
ENGINE_NEW_PAYLOAD_V5,
|
||||
ENGINE_GET_PAYLOAD_V1,
|
||||
ENGINE_GET_PAYLOAD_V2,
|
||||
ENGINE_GET_PAYLOAD_V3,
|
||||
@@ -883,7 +885,7 @@ impl HttpJsonRpc {
|
||||
Ok(response.into())
|
||||
}
|
||||
|
||||
pub async fn new_payload_v4_gloas<E: EthSpec>(
|
||||
pub async fn new_payload_v5_gloas<E: EthSpec>(
|
||||
&self,
|
||||
new_payload_request_gloas: NewPayloadRequestGloas<'_, E>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
@@ -903,7 +905,7 @@ impl HttpJsonRpc {
|
||||
|
||||
let response: JsonPayloadStatusV1 = self
|
||||
.rpc_request(
|
||||
ENGINE_NEW_PAYLOAD_V4,
|
||||
ENGINE_NEW_PAYLOAD_V5,
|
||||
params,
|
||||
ENGINE_NEW_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
@@ -1198,6 +1200,7 @@ impl HttpJsonRpc {
|
||||
new_payload_v2: capabilities.contains(ENGINE_NEW_PAYLOAD_V2),
|
||||
new_payload_v3: capabilities.contains(ENGINE_NEW_PAYLOAD_V3),
|
||||
new_payload_v4: capabilities.contains(ENGINE_NEW_PAYLOAD_V4),
|
||||
new_payload_v5: capabilities.contains(ENGINE_NEW_PAYLOAD_V5),
|
||||
forkchoice_updated_v1: capabilities.contains(ENGINE_FORKCHOICE_UPDATED_V1),
|
||||
forkchoice_updated_v2: capabilities.contains(ENGINE_FORKCHOICE_UPDATED_V2),
|
||||
forkchoice_updated_v3: capabilities.contains(ENGINE_FORKCHOICE_UPDATED_V3),
|
||||
@@ -1353,10 +1356,10 @@ impl HttpJsonRpc {
|
||||
}
|
||||
}
|
||||
NewPayloadRequest::Gloas(new_payload_request_gloas) => {
|
||||
if engine_capabilities.new_payload_v4 {
|
||||
self.new_payload_v4_gloas(new_payload_request_gloas).await
|
||||
if engine_capabilities.new_payload_v5 {
|
||||
self.new_payload_v5_gloas(new_payload_request_gloas).await
|
||||
} else {
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayloadV4"))
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayloadV5"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,8 @@ pub async fn handle_rpc<E: EthSpec>(
|
||||
ENGINE_NEW_PAYLOAD_V1
|
||||
| ENGINE_NEW_PAYLOAD_V2
|
||||
| ENGINE_NEW_PAYLOAD_V3
|
||||
| ENGINE_NEW_PAYLOAD_V4 => {
|
||||
| ENGINE_NEW_PAYLOAD_V4
|
||||
| ENGINE_NEW_PAYLOAD_V5 => {
|
||||
let request = match method {
|
||||
ENGINE_NEW_PAYLOAD_V1 => JsonExecutionPayload::Bellatrix(
|
||||
get_param::<JsonExecutionPayloadBellatrix<E>>(params, 0)
|
||||
@@ -118,17 +119,16 @@ pub async fn handle_rpc<E: EthSpec>(
|
||||
ENGINE_NEW_PAYLOAD_V3 => get_param::<JsonExecutionPayloadDeneb<E>>(params, 0)
|
||||
.map(|jep| JsonExecutionPayload::Deneb(jep))
|
||||
.map_err(|s| (s, BAD_PARAMS_ERROR_CODE))?,
|
||||
ENGINE_NEW_PAYLOAD_V4 => get_param::<JsonExecutionPayloadGloas<E>>(params, 0)
|
||||
.map(|jep| JsonExecutionPayload::Gloas(jep))
|
||||
.or_else(|_| {
|
||||
get_param::<JsonExecutionPayloadFulu<E>>(params, 0)
|
||||
.map(|jep| JsonExecutionPayload::Fulu(jep))
|
||||
})
|
||||
ENGINE_NEW_PAYLOAD_V4 => get_param::<JsonExecutionPayloadFulu<E>>(params, 0)
|
||||
.map(|jep| JsonExecutionPayload::Fulu(jep))
|
||||
.or_else(|_| {
|
||||
get_param::<JsonExecutionPayloadElectra<E>>(params, 0)
|
||||
.map(|jep| JsonExecutionPayload::Electra(jep))
|
||||
})
|
||||
.map_err(|s| (s, BAD_PARAMS_ERROR_CODE))?,
|
||||
ENGINE_NEW_PAYLOAD_V5 => get_param::<JsonExecutionPayloadGloas<E>>(params, 0)
|
||||
.map(|jep| JsonExecutionPayload::Gloas(jep))
|
||||
.map_err(|s| (s, BAD_PARAMS_ERROR_CODE))?,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -192,7 +192,7 @@ pub async fn handle_rpc<E: EthSpec>(
|
||||
));
|
||||
}
|
||||
}
|
||||
ForkName::Electra | ForkName::Fulu | ForkName::Gloas => {
|
||||
ForkName::Electra | ForkName::Fulu => {
|
||||
if method == ENGINE_NEW_PAYLOAD_V1
|
||||
|| method == ENGINE_NEW_PAYLOAD_V2
|
||||
|| method == ENGINE_NEW_PAYLOAD_V3
|
||||
@@ -230,6 +230,14 @@ pub async fn handle_rpc<E: EthSpec>(
|
||||
));
|
||||
}
|
||||
}
|
||||
ForkName::Gloas => {
|
||||
if method != ENGINE_NEW_PAYLOAD_V5 {
|
||||
return Err((
|
||||
format!("{} called for Gloas fork, use engine_newPayloadV5!", method),
|
||||
GENERIC_ERROR_CODE,
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ pub const DEFAULT_ENGINE_CAPABILITIES: EngineCapabilities = EngineCapabilities {
|
||||
new_payload_v2: true,
|
||||
new_payload_v3: true,
|
||||
new_payload_v4: true,
|
||||
new_payload_v5: true,
|
||||
forkchoice_updated_v1: true,
|
||||
forkchoice_updated_v2: true,
|
||||
forkchoice_updated_v3: true,
|
||||
|
||||
Reference in New Issue
Block a user