Skip to content

Commit 7887e4d

Browse files
committed
Remove ExecutionPayloadElectra
1 parent c06ac81 commit 7887e4d

31 files changed

+338
-1021
lines changed

beacon_node/beacon_chain/src/beacon_block_streamer.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ use types::{
1515
SignedBlindedBeaconBlock, Slot,
1616
};
1717
use types::{
18-
ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadElectra,
19-
ExecutionPayloadFulu, ExecutionPayloadHeader,
18+
ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadHeader,
2019
};
2120

2221
#[derive(PartialEq)]
@@ -98,9 +97,9 @@ fn reconstruct_default_header_block<E: EthSpec>(
9897
let payload: ExecutionPayload<E> = match fork {
9998
ForkName::Bellatrix => ExecutionPayloadBellatrix::default().into(),
10099
ForkName::Capella => ExecutionPayloadCapella::default().into(),
101-
ForkName::Deneb => ExecutionPayloadDeneb::default().into(),
102-
ForkName::Electra => ExecutionPayloadElectra::default().into(),
103-
ForkName::Fulu => ExecutionPayloadFulu::default().into(),
100+
ForkName::Deneb | ForkName::Electra | ForkName::Fulu => {
101+
ExecutionPayloadDeneb::default().into()
102+
}
104103
ForkName::Base | ForkName::Altair => {
105104
return Err(Error::PayloadReconstruction(format!(
106105
"Block with fork variant {} has execution payload",

beacon_node/beacon_chain/src/fulu_readiness.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Provides tools for checking if a node is ready for the Fulu upgrade.
22
33
use crate::{BeaconChain, BeaconChainTypes};
4-
use execution_layer::http::{ENGINE_GET_PAYLOAD_V5, ENGINE_NEW_PAYLOAD_V4};
4+
use execution_layer::http::ENGINE_NEW_PAYLOAD_V4;
55
use serde::{Deserialize, Serialize};
66
use std::fmt;
77
use std::time::Duration;
@@ -18,8 +18,8 @@ pub const ENGINE_CAPABILITIES_REFRESH_INTERVAL: u64 = 300;
1818
pub enum FuluReadiness {
1919
/// The execution engine is fulu-enabled (as far as we can tell)
2020
Ready,
21-
/// We are connected to an execution engine which doesn't support the V5 engine api methods
22-
V5MethodsNotSupported { error: String },
21+
/// We are connected to an execution engine which doesn't support the V4 engine api methods
22+
V4MethodsNotSupported { error: String },
2323
/// The transition configuration with the EL failed, there might be a problem with
2424
/// connectivity, authentication or a difference in configuration.
2525
ExchangeCapabilitiesFailed { error: String },
@@ -44,7 +44,7 @@ impl fmt::Display for FuluReadiness {
4444
"The --execution-endpoint flag is not specified, this is a \
4545
requirement post-merge"
4646
),
47-
FuluReadiness::V5MethodsNotSupported { error } => write!(
47+
FuluReadiness::V4MethodsNotSupported { error } => write!(
4848
f,
4949
"Execution endpoint does not support Fulu methods: {}",
5050
error
@@ -87,12 +87,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
8787
Ok(capabilities) => {
8888
let mut missing_methods = String::from("Required Methods Unsupported:");
8989
let mut all_good = true;
90-
if !capabilities.get_payload_v5 {
91-
missing_methods.push(' ');
92-
missing_methods.push_str(ENGINE_GET_PAYLOAD_V5);
93-
all_good = false;
94-
}
95-
// TODO(fulu) switch to v5 when the EL is ready
9690
if !capabilities.new_payload_v4 {
9791
missing_methods.push(' ');
9892
missing_methods.push_str(ENGINE_NEW_PAYLOAD_V4);
@@ -102,7 +96,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
10296
if all_good {
10397
FuluReadiness::Ready
10498
} else {
105-
FuluReadiness::V5MethodsNotSupported {
99+
FuluReadiness::V4MethodsNotSupported {
106100
error: missing_methods,
107101
}
108102
}

beacon_node/beacon_chain/src/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,7 +3216,7 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
32163216
ref mut message, ..
32173217
}) => {
32183218
// Get either zero blobs or a random number of blobs between 1 and Max Blobs.
3219-
let payload: &mut FullPayloadElectra<E> = &mut message.body.execution_payload;
3219+
let payload: &mut FullPayloadDeneb<E> = &mut message.body.execution_payload;
32203220
let num_blobs = match num_blobs {
32213221
NumBlobs::Random => rng.gen_range(1..=max_blobs),
32223222
NumBlobs::Number(n) => n,
@@ -3235,7 +3235,7 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
32353235
ref mut message, ..
32363236
}) => {
32373237
// Get either zero blobs or a random number of blobs between 1 and Max Blobs.
3238-
let payload: &mut FullPayloadFulu<E> = &mut message.body.execution_payload;
3238+
let payload: &mut FullPayloadDeneb<E> = &mut message.body.execution_payload;
32393239
let num_blobs = match num_blobs {
32403240
NumBlobs::Random => rng.gen_range(1..=max_blobs),
32413241
NumBlobs::Number(n) => n,

beacon_node/execution_layer/src/engine_api.rs

Lines changed: 34 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use crate::http::{
44
ENGINE_GET_BLOBS_V1, ENGINE_GET_BLOBS_V2, ENGINE_GET_CLIENT_VERSION_V1,
55
ENGINE_GET_PAYLOAD_BODIES_BY_HASH_V1, ENGINE_GET_PAYLOAD_BODIES_BY_RANGE_V1,
66
ENGINE_GET_PAYLOAD_V1, ENGINE_GET_PAYLOAD_V2, ENGINE_GET_PAYLOAD_V3, ENGINE_GET_PAYLOAD_V4,
7-
ENGINE_GET_PAYLOAD_V5, ENGINE_NEW_PAYLOAD_V1, ENGINE_NEW_PAYLOAD_V2, ENGINE_NEW_PAYLOAD_V3,
8-
ENGINE_NEW_PAYLOAD_V4, ENGINE_NEW_PAYLOAD_V5,
7+
ENGINE_NEW_PAYLOAD_V1, ENGINE_NEW_PAYLOAD_V2, ENGINE_NEW_PAYLOAD_V3, ENGINE_NEW_PAYLOAD_V4,
98
};
109
use eth2::types::{
1110
BlobsBundle, SsePayloadAttributes, SsePayloadAttributesV1, SsePayloadAttributesV2,
@@ -24,8 +23,8 @@ pub use types::{
2423
Uint256, VariableList, Withdrawal, Withdrawals,
2524
};
2625
use types::{
27-
ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb,
28-
ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionRequests, KzgProofs,
26+
ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionRequests,
27+
KzgProofs,
2928
};
3029
use types::{Graffiti, GRAFFITI_BYTES_LEN};
3130

@@ -36,7 +35,7 @@ mod new_payload_request;
3635

3736
pub use new_payload_request::{
3837
NewPayloadRequest, NewPayloadRequestBellatrix, NewPayloadRequestCapella,
39-
NewPayloadRequestDeneb, NewPayloadRequestElectra, NewPayloadRequestFulu,
38+
NewPayloadRequestDeneb, NewPayloadRequestElectra,
4039
};
4140

4241
pub const LATEST_TAG: &str = "latest";
@@ -269,10 +268,8 @@ pub struct ProposeBlindedBlockResponse {
269268
}
270269

271270
#[superstruct(
272-
variants(Bellatrix, Capella, Deneb, Electra, Fulu),
271+
variants(Bellatrix, Capella, Deneb, Electra),
273272
variant_attributes(derive(Clone, Debug, PartialEq),),
274-
map_into(ExecutionPayload),
275-
map_ref_into(ExecutionPayloadRef),
276273
cast_error(ty = "Error", expr = "Error::IncorrectStateVariant"),
277274
partial_getter_error(ty = "Error", expr = "Error::IncorrectStateVariant")
278275
)]
@@ -288,15 +285,13 @@ pub struct GetPayloadResponse<E: EthSpec> {
288285
#[superstruct(only(Deneb), partial_getter(rename = "execution_payload_deneb"))]
289286
pub execution_payload: ExecutionPayloadDeneb<E>,
290287
#[superstruct(only(Electra), partial_getter(rename = "execution_payload_electra"))]
291-
pub execution_payload: ExecutionPayloadElectra<E>,
292-
#[superstruct(only(Fulu), partial_getter(rename = "execution_payload_fulu"))]
293-
pub execution_payload: ExecutionPayloadFulu<E>,
288+
pub execution_payload: ExecutionPayloadDeneb<E>,
294289
pub block_value: Uint256,
295-
#[superstruct(only(Deneb, Electra, Fulu))]
290+
#[superstruct(only(Deneb, Electra))]
296291
pub blobs_bundle: BlobsBundle<E>,
297-
#[superstruct(only(Deneb, Electra, Fulu), partial_getter(copy))]
292+
#[superstruct(only(Deneb, Electra), partial_getter(copy))]
298293
pub should_override_builder: bool,
299-
#[superstruct(only(Electra, Fulu))]
294+
#[superstruct(only(Electra))]
300295
pub requests: ExecutionRequests<E>,
301296
}
302297

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

317312
impl<'a, E: EthSpec> From<GetPayloadResponseRef<'a, E>> for ExecutionPayloadRef<'a, E> {
318313
fn from(response: GetPayloadResponseRef<'a, E>) -> Self {
319-
map_get_payload_response_ref_into_execution_payload_ref!(&'a _, response, |inner, cons| {
320-
cons(&inner.execution_payload)
321-
})
314+
match response {
315+
GetPayloadResponseRef::Bellatrix(inner) => {
316+
ExecutionPayloadRef::Bellatrix(&inner.execution_payload)
317+
}
318+
GetPayloadResponseRef::Capella(inner) => {
319+
ExecutionPayloadRef::Capella(&inner.execution_payload)
320+
}
321+
GetPayloadResponseRef::Deneb(inner) => {
322+
ExecutionPayloadRef::Deneb(&inner.execution_payload)
323+
}
324+
GetPayloadResponseRef::Electra(inner) => {
325+
ExecutionPayloadRef::Deneb(&inner.execution_payload)
326+
}
327+
}
322328
}
323329
}
324330

325331
impl<E: EthSpec> From<GetPayloadResponse<E>> for ExecutionPayload<E> {
326332
fn from(response: GetPayloadResponse<E>) -> Self {
327-
map_get_payload_response_into_execution_payload!(response, |inner, cons| {
328-
cons(inner.execution_payload)
329-
})
333+
match response {
334+
GetPayloadResponse::Bellatrix(inner) => {
335+
ExecutionPayload::Bellatrix(inner.execution_payload)
336+
}
337+
GetPayloadResponse::Capella(inner) => {
338+
ExecutionPayload::Capella(inner.execution_payload)
339+
}
340+
GetPayloadResponse::Deneb(inner) => ExecutionPayload::Deneb(inner.execution_payload),
341+
GetPayloadResponse::Electra(inner) => ExecutionPayload::Deneb(inner.execution_payload),
342+
}
330343
}
331344
}
332345

@@ -359,13 +372,7 @@ impl<E: EthSpec> From<GetPayloadResponse<E>>
359372
None,
360373
),
361374
GetPayloadResponse::Electra(inner) => (
362-
ExecutionPayload::Electra(inner.execution_payload),
363-
inner.block_value,
364-
Some(inner.blobs_bundle),
365-
Some(inner.requests),
366-
),
367-
GetPayloadResponse::Fulu(inner) => (
368-
ExecutionPayload::Fulu(inner.execution_payload),
375+
ExecutionPayload::Deneb(inner.execution_payload),
369376
inner.block_value,
370377
Some(inner.blobs_bundle),
371378
Some(inner.requests),
@@ -475,62 +482,6 @@ impl<E: EthSpec> ExecutionPayloadBodyV1<E> {
475482
))
476483
}
477484
}
478-
ExecutionPayloadHeader::Electra(header) => {
479-
if let Some(withdrawals) = self.withdrawals {
480-
Ok(ExecutionPayload::Electra(ExecutionPayloadElectra {
481-
parent_hash: header.parent_hash,
482-
fee_recipient: header.fee_recipient,
483-
state_root: header.state_root,
484-
receipts_root: header.receipts_root,
485-
logs_bloom: header.logs_bloom,
486-
prev_randao: header.prev_randao,
487-
block_number: header.block_number,
488-
gas_limit: header.gas_limit,
489-
gas_used: header.gas_used,
490-
timestamp: header.timestamp,
491-
extra_data: header.extra_data,
492-
base_fee_per_gas: header.base_fee_per_gas,
493-
block_hash: header.block_hash,
494-
transactions: self.transactions,
495-
withdrawals,
496-
blob_gas_used: header.blob_gas_used,
497-
excess_blob_gas: header.excess_blob_gas,
498-
}))
499-
} else {
500-
Err(format!(
501-
"block {} is post capella but payload body doesn't have withdrawals",
502-
header.block_hash
503-
))
504-
}
505-
}
506-
ExecutionPayloadHeader::Fulu(header) => {
507-
if let Some(withdrawals) = self.withdrawals {
508-
Ok(ExecutionPayload::Fulu(ExecutionPayloadFulu {
509-
parent_hash: header.parent_hash,
510-
fee_recipient: header.fee_recipient,
511-
state_root: header.state_root,
512-
receipts_root: header.receipts_root,
513-
logs_bloom: header.logs_bloom,
514-
prev_randao: header.prev_randao,
515-
block_number: header.block_number,
516-
gas_limit: header.gas_limit,
517-
gas_used: header.gas_used,
518-
timestamp: header.timestamp,
519-
extra_data: header.extra_data,
520-
base_fee_per_gas: header.base_fee_per_gas,
521-
block_hash: header.block_hash,
522-
transactions: self.transactions,
523-
withdrawals,
524-
blob_gas_used: header.blob_gas_used,
525-
excess_blob_gas: header.excess_blob_gas,
526-
}))
527-
} else {
528-
Err(format!(
529-
"block {} is post capella but payload body doesn't have withdrawals",
530-
header.block_hash
531-
))
532-
}
533-
}
534485
}
535486
}
536487
}
@@ -541,7 +492,6 @@ pub struct EngineCapabilities {
541492
pub new_payload_v2: bool,
542493
pub new_payload_v3: bool,
543494
pub new_payload_v4: bool,
544-
pub new_payload_v5: bool,
545495
pub forkchoice_updated_v1: bool,
546496
pub forkchoice_updated_v2: bool,
547497
pub forkchoice_updated_v3: bool,
@@ -551,7 +501,6 @@ pub struct EngineCapabilities {
551501
pub get_payload_v2: bool,
552502
pub get_payload_v3: bool,
553503
pub get_payload_v4: bool,
554-
pub get_payload_v5: bool,
555504
pub get_client_version_v1: bool,
556505
pub get_blobs_v1: bool,
557506
pub get_blobs_v2: bool,
@@ -572,9 +521,6 @@ impl EngineCapabilities {
572521
if self.new_payload_v4 {
573522
response.push(ENGINE_NEW_PAYLOAD_V4);
574523
}
575-
if self.new_payload_v5 {
576-
response.push(ENGINE_NEW_PAYLOAD_V5);
577-
}
578524
if self.forkchoice_updated_v1 {
579525
response.push(ENGINE_FORKCHOICE_UPDATED_V1);
580526
}
@@ -602,9 +548,6 @@ impl EngineCapabilities {
602548
if self.get_payload_v4 {
603549
response.push(ENGINE_GET_PAYLOAD_V4);
604550
}
605-
if self.get_payload_v5 {
606-
response.push(ENGINE_GET_PAYLOAD_V5);
607-
}
608551
if self.get_client_version_v1 {
609552
response.push(ENGINE_GET_CLIENT_VERSION_V1);
610553
}

0 commit comments

Comments
 (0)