Skip to content

Commit

Permalink
Use engine v4 methods for Fulu (v5 methods do not exist yet). Update …
Browse files Browse the repository at this point in the history
…kurtosis config for PeerDAS as electra genesis is not yet supported.
  • Loading branch information
jimmygchen committed Jan 15, 2025
1 parent 4e25302 commit 11e9e13
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 17 deletions.
11 changes: 6 additions & 5 deletions beacon_node/beacon_chain/src/fulu_readiness.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Provides tools for checking if a node is ready for the Fulu upgrade.
use crate::{BeaconChain, BeaconChainTypes};
use execution_layer::http::{ENGINE_GET_PAYLOAD_V5, ENGINE_NEW_PAYLOAD_V5};
use execution_layer::http::{ENGINE_GET_PAYLOAD_V4, ENGINE_NEW_PAYLOAD_V4};
use serde::{Deserialize, Serialize};
use std::fmt;
use std::time::Duration;
Expand Down Expand Up @@ -87,14 +87,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
Ok(capabilities) => {
let mut missing_methods = String::from("Required Methods Unsupported:");
let mut all_good = true;
if !capabilities.get_payload_v5 {
// TODO(fulu) switch to v5 when the EL is ready
if !capabilities.get_payload_v4 {
missing_methods.push(' ');
missing_methods.push_str(ENGINE_GET_PAYLOAD_V5);
missing_methods.push_str(ENGINE_GET_PAYLOAD_V4);
all_good = false;
}
if !capabilities.new_payload_v5 {
if !capabilities.new_payload_v4 {
missing_methods.push(' ');
missing_methods.push_str(ENGINE_NEW_PAYLOAD_V5);
missing_methods.push_str(ENGINE_NEW_PAYLOAD_V4);
all_good = false;
}

Expand Down
30 changes: 23 additions & 7 deletions beacon_node/execution_layer/src/engine_api/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,8 @@ impl HttpJsonRpc {
Ok(response.into())
}

pub async fn new_payload_v5_fulu<E: EthSpec>(
// TODO(fulu): switch to v5 endpoint when the EL is ready for Fulu
pub async fn new_payload_v4_fulu<E: EthSpec>(
&self,
new_payload_request_fulu: NewPayloadRequestFulu<'_, E>,
) -> Result<PayloadStatusV1, Error> {
Expand All @@ -844,7 +845,7 @@ impl HttpJsonRpc {

let response: JsonPayloadStatusV1 = self
.rpc_request(
ENGINE_NEW_PAYLOAD_V5,
ENGINE_NEW_PAYLOAD_V4,
params,
ENGINE_NEW_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
)
Expand Down Expand Up @@ -962,6 +963,19 @@ impl HttpJsonRpc {
.try_into()
.map_err(Error::BadResponse)
}
// TODO(fulu): remove when v5 method is ready.
ForkName::Fulu => {
let response: JsonGetPayloadResponseV5<E> = self
.rpc_request(
ENGINE_GET_PAYLOAD_V4,
params,
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
)
.await?;
JsonGetPayloadResponse::V5(response)
.try_into()
.map_err(Error::BadResponse)
}
_ => Err(Error::UnsupportedForkVariant(format!(
"called get_payload_v4 with {}",
fork_name
Expand Down Expand Up @@ -1263,10 +1277,11 @@ impl HttpJsonRpc {
}
}
NewPayloadRequest::Fulu(new_payload_request_fulu) => {
if engine_capabilities.new_payload_v5 {
self.new_payload_v5_fulu(new_payload_request_fulu).await
// TODO(fulu): switch to v5 endpoint when the EL is ready for Fulu
if engine_capabilities.new_payload_v4 {
self.new_payload_v4_fulu(new_payload_request_fulu).await
} else {
Err(Error::RequiredMethodUnsupported("engine_newPayloadV5"))
Err(Error::RequiredMethodUnsupported("engine_newPayloadV4"))
}
}
}
Expand Down Expand Up @@ -1305,8 +1320,9 @@ impl HttpJsonRpc {
}
}
ForkName::Fulu => {
if engine_capabilities.get_payload_v5 {
self.get_payload_v5(fork_name, payload_id).await
// TODO(fulu): switch to v5 when the EL is ready
if engine_capabilities.get_payload_v4 {
self.get_payload_v4(fork_name, payload_id).await
} else {
Err(Error::RequiredMethodUnsupported("engine_getPayloadv5"))
}
Expand Down
24 changes: 21 additions & 3 deletions beacon_node/execution_layer/src/test_utils/handle_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ pub async fn handle_rpc<E: EthSpec>(
if method == ENGINE_NEW_PAYLOAD_V1
|| method == ENGINE_NEW_PAYLOAD_V2
|| method == ENGINE_NEW_PAYLOAD_V3
|| method == ENGINE_NEW_PAYLOAD_V4
// TODO(fulu): Uncomment this once v5 method is ready for Fulu
// || method == ENGINE_NEW_PAYLOAD_V4
{
return Err((
format!("{} called after Fulu fork!", method),
Expand Down Expand Up @@ -381,8 +382,9 @@ pub async fn handle_rpc<E: EthSpec>(
== ForkName::Fulu
&& (method == ENGINE_GET_PAYLOAD_V1
|| method == ENGINE_GET_PAYLOAD_V2
|| method == ENGINE_GET_PAYLOAD_V3
|| method == ENGINE_GET_PAYLOAD_V4)
|| method == ENGINE_GET_PAYLOAD_V3)
// TODO(fulu): Uncomment this once v5 method is ready for Fulu
// || method == ENGINE_GET_PAYLOAD_V4)
{
return Err((
format!("{} called after Fulu fork!", method),
Expand Down Expand Up @@ -448,6 +450,22 @@ pub async fn handle_rpc<E: EthSpec>(
})
.unwrap()
}
// TODO(fulu): remove this once we switch to v5 method
JsonExecutionPayload::V5(execution_payload) => {
serde_json::to_value(JsonGetPayloadResponseV5 {
execution_payload,
block_value: Uint256::from(DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI),
blobs_bundle: maybe_blobs
.ok_or((
"No blobs returned despite V5 Payload".to_string(),
GENERIC_ERROR_CODE,
))?
.into(),
should_override_builder: false,
execution_requests: Default::default(),
})
.unwrap()
}
_ => unreachable!(),
}),
ENGINE_GET_PAYLOAD_V5 => Ok(match JsonExecutionPayload::from(response) {
Expand Down
4 changes: 2 additions & 2 deletions scripts/local_testnet/network_params_das.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ participants:
- --target-peers=3
count: 2
network_params:
electra_fork_epoch: 0
fulu_fork_epoch: 0
electra_fork_epoch: 1
fulu_fork_epoch: 2
seconds_per_slot: 6
snooper_enabled: false
global_log_level: debug
Expand Down

0 comments on commit 11e9e13

Please sign in to comment.