Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions beacon_node/beacon_chain/src/beacon_block_streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use types::{
SignedBlindedBeaconBlock, Slot,
};
use types::{
ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadElectra,
ExecutionPayloadFulu, ExecutionPayloadHeader,
ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadHeader,
};

#[derive(PartialEq)]
Expand Down Expand Up @@ -98,9 +97,9 @@ fn reconstruct_default_header_block<E: EthSpec>(
let payload: ExecutionPayload<E> = match fork {
ForkName::Bellatrix => ExecutionPayloadBellatrix::default().into(),
ForkName::Capella => ExecutionPayloadCapella::default().into(),
ForkName::Deneb => ExecutionPayloadDeneb::default().into(),
ForkName::Electra => ExecutionPayloadElectra::default().into(),
ForkName::Fulu => ExecutionPayloadFulu::default().into(),
ForkName::Deneb | ForkName::Electra | ForkName::Fulu => {
ExecutionPayloadDeneb::default().into()
}
ForkName::Base | ForkName::Altair => {
return Err(Error::PayloadReconstruction(format!(
"Block with fork variant {} has execution payload",
Expand Down
16 changes: 5 additions & 11 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_V4};
use execution_layer::http::ENGINE_NEW_PAYLOAD_V4;
use serde::{Deserialize, Serialize};
use std::fmt;
use std::time::Duration;
Expand All @@ -18,8 +18,8 @@ pub const ENGINE_CAPABILITIES_REFRESH_INTERVAL: u64 = 300;
pub enum FuluReadiness {
/// The execution engine is fulu-enabled (as far as we can tell)
Ready,
/// We are connected to an execution engine which doesn't support the V5 engine api methods
V5MethodsNotSupported { error: String },
/// We are connected to an execution engine which doesn't support the V4 engine api methods
V4MethodsNotSupported { error: String },
/// The transition configuration with the EL failed, there might be a problem with
/// connectivity, authentication or a difference in configuration.
ExchangeCapabilitiesFailed { error: String },
Expand All @@ -44,7 +44,7 @@ impl fmt::Display for FuluReadiness {
"The --execution-endpoint flag is not specified, this is a \
requirement post-merge"
),
FuluReadiness::V5MethodsNotSupported { error } => write!(
FuluReadiness::V4MethodsNotSupported { error } => write!(
f,
"Execution endpoint does not support Fulu methods: {}",
error
Expand Down Expand Up @@ -87,12 +87,6 @@ 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 {
missing_methods.push(' ');
missing_methods.push_str(ENGINE_GET_PAYLOAD_V5);
all_good = false;
}
// TODO(fulu) switch to v5 when the EL is ready
if !capabilities.new_payload_v4 {
missing_methods.push(' ');
missing_methods.push_str(ENGINE_NEW_PAYLOAD_V4);
Expand All @@ -102,7 +96,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
if all_good {
FuluReadiness::Ready
} else {
FuluReadiness::V5MethodsNotSupported {
FuluReadiness::V4MethodsNotSupported {
error: missing_methods,
}
}
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3224,7 +3224,7 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
ref mut message, ..
}) => {
// Get either zero blobs or a random number of blobs between 1 and Max Blobs.
let payload: &mut FullPayloadElectra<E> = &mut message.body.execution_payload;
let payload: &mut FullPayloadDeneb<E> = &mut message.body.execution_payload;
let num_blobs = match num_blobs {
NumBlobs::Random => rng.gen_range(1..=max_blobs),
NumBlobs::Number(n) => n,
Expand All @@ -3243,7 +3243,7 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
ref mut message, ..
}) => {
// Get either zero blobs or a random number of blobs between 1 and Max Blobs.
let payload: &mut FullPayloadFulu<E> = &mut message.body.execution_payload;
let payload: &mut FullPayloadDeneb<E> = &mut message.body.execution_payload;
let num_blobs = match num_blobs {
NumBlobs::Random => rng.gen_range(1..=max_blobs),
NumBlobs::Number(n) => n,
Expand Down
125 changes: 34 additions & 91 deletions beacon_node/execution_layer/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use crate::http::{
ENGINE_GET_BLOBS_V1, ENGINE_GET_BLOBS_V2, ENGINE_GET_CLIENT_VERSION_V1,
ENGINE_GET_PAYLOAD_BODIES_BY_HASH_V1, ENGINE_GET_PAYLOAD_BODIES_BY_RANGE_V1,
ENGINE_GET_PAYLOAD_V1, ENGINE_GET_PAYLOAD_V2, ENGINE_GET_PAYLOAD_V3, ENGINE_GET_PAYLOAD_V4,
ENGINE_GET_PAYLOAD_V5, ENGINE_NEW_PAYLOAD_V1, ENGINE_NEW_PAYLOAD_V2, ENGINE_NEW_PAYLOAD_V3,
ENGINE_NEW_PAYLOAD_V4, ENGINE_NEW_PAYLOAD_V5,
ENGINE_NEW_PAYLOAD_V1, ENGINE_NEW_PAYLOAD_V2, ENGINE_NEW_PAYLOAD_V3, ENGINE_NEW_PAYLOAD_V4,
};
use eth2::types::{
BlobsBundle, SsePayloadAttributes, SsePayloadAttributesV1, SsePayloadAttributesV2,
Expand All @@ -24,8 +23,8 @@ pub use types::{
Uint256, VariableList, Withdrawal, Withdrawals,
};
use types::{
ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb,
ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionRequests, KzgProofs,
ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionRequests,
KzgProofs,
};
use types::{Graffiti, GRAFFITI_BYTES_LEN};

Expand All @@ -36,7 +35,7 @@ mod new_payload_request;

pub use new_payload_request::{
NewPayloadRequest, NewPayloadRequestBellatrix, NewPayloadRequestCapella,
NewPayloadRequestDeneb, NewPayloadRequestElectra, NewPayloadRequestFulu,
NewPayloadRequestDeneb, NewPayloadRequestElectra,
};

pub const LATEST_TAG: &str = "latest";
Expand Down Expand Up @@ -269,10 +268,8 @@ pub struct ProposeBlindedBlockResponse {
}

#[superstruct(
variants(Bellatrix, Capella, Deneb, Electra, Fulu),
variants(Bellatrix, Capella, Deneb, Electra),
variant_attributes(derive(Clone, Debug, PartialEq),),
map_into(ExecutionPayload),
map_ref_into(ExecutionPayloadRef),
cast_error(ty = "Error", expr = "Error::IncorrectStateVariant"),
partial_getter_error(ty = "Error", expr = "Error::IncorrectStateVariant")
)]
Expand All @@ -288,15 +285,13 @@ pub struct GetPayloadResponse<E: EthSpec> {
#[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))]
pub execution_payload: ExecutionPayloadDeneb<E>,
#[superstruct(only(Electra), partial_getter(rename = "execution_payload_electra"))]
pub execution_payload: ExecutionPayloadElectra<E>,
#[superstruct(only(Fulu), partial_getter(rename = "execution_payload_fulu"))]
pub execution_payload: ExecutionPayloadFulu<E>,
pub execution_payload: ExecutionPayloadDeneb<E>,
pub block_value: Uint256,
#[superstruct(only(Deneb, Electra, Fulu))]
#[superstruct(only(Deneb, Electra))]
pub blobs_bundle: BlobsBundle<E>,
#[superstruct(only(Deneb, Electra, Fulu), partial_getter(copy))]
#[superstruct(only(Deneb, Electra), partial_getter(copy))]
pub should_override_builder: bool,
#[superstruct(only(Electra, Fulu))]
#[superstruct(only(Electra))]
pub requests: ExecutionRequests<E>,
}

Expand All @@ -316,17 +311,35 @@ impl<E: EthSpec> GetPayloadResponse<E> {

impl<'a, E: EthSpec> From<GetPayloadResponseRef<'a, E>> for ExecutionPayloadRef<'a, E> {
fn from(response: GetPayloadResponseRef<'a, E>) -> Self {
map_get_payload_response_ref_into_execution_payload_ref!(&'a _, response, |inner, cons| {
cons(&inner.execution_payload)
})
match response {
GetPayloadResponseRef::Bellatrix(inner) => {
ExecutionPayloadRef::Bellatrix(&inner.execution_payload)
}
GetPayloadResponseRef::Capella(inner) => {
ExecutionPayloadRef::Capella(&inner.execution_payload)
}
GetPayloadResponseRef::Deneb(inner) => {
ExecutionPayloadRef::Deneb(&inner.execution_payload)
}
GetPayloadResponseRef::Electra(inner) => {
ExecutionPayloadRef::Deneb(&inner.execution_payload)
}
}
}
}

impl<E: EthSpec> From<GetPayloadResponse<E>> for ExecutionPayload<E> {
fn from(response: GetPayloadResponse<E>) -> Self {
map_get_payload_response_into_execution_payload!(response, |inner, cons| {
cons(inner.execution_payload)
})
match response {
GetPayloadResponse::Bellatrix(inner) => {
ExecutionPayload::Bellatrix(inner.execution_payload)
}
GetPayloadResponse::Capella(inner) => {
ExecutionPayload::Capella(inner.execution_payload)
}
GetPayloadResponse::Deneb(inner) => ExecutionPayload::Deneb(inner.execution_payload),
GetPayloadResponse::Electra(inner) => ExecutionPayload::Deneb(inner.execution_payload),
}
}
}

Expand Down Expand Up @@ -359,13 +372,7 @@ impl<E: EthSpec> From<GetPayloadResponse<E>>
None,
),
GetPayloadResponse::Electra(inner) => (
ExecutionPayload::Electra(inner.execution_payload),
inner.block_value,
Some(inner.blobs_bundle),
Some(inner.requests),
),
GetPayloadResponse::Fulu(inner) => (
ExecutionPayload::Fulu(inner.execution_payload),
ExecutionPayload::Deneb(inner.execution_payload),
inner.block_value,
Some(inner.blobs_bundle),
Some(inner.requests),
Expand Down Expand Up @@ -475,62 +482,6 @@ impl<E: EthSpec> ExecutionPayloadBodyV1<E> {
))
}
}
ExecutionPayloadHeader::Electra(header) => {
if let Some(withdrawals) = self.withdrawals {
Ok(ExecutionPayload::Electra(ExecutionPayloadElectra {
parent_hash: header.parent_hash,
fee_recipient: header.fee_recipient,
state_root: header.state_root,
receipts_root: header.receipts_root,
logs_bloom: header.logs_bloom,
prev_randao: header.prev_randao,
block_number: header.block_number,
gas_limit: header.gas_limit,
gas_used: header.gas_used,
timestamp: header.timestamp,
extra_data: header.extra_data,
base_fee_per_gas: header.base_fee_per_gas,
block_hash: header.block_hash,
transactions: self.transactions,
withdrawals,
blob_gas_used: header.blob_gas_used,
excess_blob_gas: header.excess_blob_gas,
}))
} else {
Err(format!(
"block {} is post capella but payload body doesn't have withdrawals",
header.block_hash
))
}
}
ExecutionPayloadHeader::Fulu(header) => {
if let Some(withdrawals) = self.withdrawals {
Ok(ExecutionPayload::Fulu(ExecutionPayloadFulu {
parent_hash: header.parent_hash,
fee_recipient: header.fee_recipient,
state_root: header.state_root,
receipts_root: header.receipts_root,
logs_bloom: header.logs_bloom,
prev_randao: header.prev_randao,
block_number: header.block_number,
gas_limit: header.gas_limit,
gas_used: header.gas_used,
timestamp: header.timestamp,
extra_data: header.extra_data,
base_fee_per_gas: header.base_fee_per_gas,
block_hash: header.block_hash,
transactions: self.transactions,
withdrawals,
blob_gas_used: header.blob_gas_used,
excess_blob_gas: header.excess_blob_gas,
}))
} else {
Err(format!(
"block {} is post capella but payload body doesn't have withdrawals",
header.block_hash
))
}
}
}
}
}
Expand All @@ -541,7 +492,6 @@ 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,
Expand All @@ -551,7 +501,6 @@ pub struct EngineCapabilities {
pub get_payload_v2: bool,
pub get_payload_v3: bool,
pub get_payload_v4: bool,
pub get_payload_v5: bool,
pub get_client_version_v1: bool,
pub get_blobs_v1: bool,
pub get_blobs_v2: bool,
Expand All @@ -572,9 +521,6 @@ 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);
}
Expand Down Expand Up @@ -602,9 +548,6 @@ impl EngineCapabilities {
if self.get_payload_v4 {
response.push(ENGINE_GET_PAYLOAD_V4);
}
if self.get_payload_v5 {
response.push(ENGINE_GET_PAYLOAD_V5);
}
if self.get_client_version_v1 {
response.push(ENGINE_GET_CLIENT_VERSION_V1);
}
Expand Down
Loading
Loading