Skip to content

Commit 073f9ee

Browse files
ryanschneiderklkvr
andauthored
feat(pectra): Revert EIP-7742 (#1807)
* feat(pectra): Revert EIP-7742 * rm mod --------- Co-authored-by: Arsenii Kulikov <[email protected]>
1 parent 044ba71 commit 073f9ee

File tree

11 files changed

+4
-168
lines changed

11 files changed

+4
-168
lines changed

crates/consensus-any/src/block/header.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,6 @@ pub struct AnyHeader {
9595
/// EIP-7685 requests hash.
9696
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))]
9797
pub requests_hash: Option<B256>,
98-
/// EIP-7744 target blob count.
99-
#[cfg_attr(
100-
feature = "serde",
101-
serde(
102-
default,
103-
with = "alloy_serde::quantity::opt",
104-
skip_serializing_if = "Option::is_none"
105-
)
106-
)]
107-
pub target_blobs_per_block: Option<u64>,
10898
}
10999

110100
impl AnyHeader {
@@ -142,7 +132,6 @@ impl AnyHeader {
142132
excess_blob_gas,
143133
parent_beacon_block_root,
144134
requests_hash,
145-
target_blobs_per_block,
146135
} = self;
147136

148137
Ok(Header {
@@ -167,7 +156,6 @@ impl AnyHeader {
167156
excess_blob_gas,
168157
parent_beacon_block_root,
169158
requests_hash,
170-
target_blobs_per_block,
171159
})
172160
}
173161

@@ -197,7 +185,6 @@ impl AnyHeader {
197185
excess_blob_gas,
198186
parent_beacon_block_root,
199187
requests_hash,
200-
target_blobs_per_block,
201188
} = self;
202189

203190
Header {
@@ -222,7 +209,6 @@ impl AnyHeader {
222209
excess_blob_gas,
223210
parent_beacon_block_root,
224211
requests_hash,
225-
target_blobs_per_block,
226212
}
227213
}
228214
}
@@ -308,10 +294,6 @@ impl BlockHeader for AnyHeader {
308294
self.requests_hash
309295
}
310296

311-
fn target_blobs_per_block(&self) -> Option<u64> {
312-
self.target_blobs_per_block
313-
}
314-
315297
fn extra_data(&self) -> &Bytes {
316298
&self.extra_data
317299
}
@@ -341,7 +323,6 @@ impl From<Header> for AnyHeader {
341323
excess_blob_gas,
342324
parent_beacon_block_root,
343325
requests_hash,
344-
target_blobs_per_block,
345326
} = value;
346327

347328
Self {
@@ -366,7 +347,6 @@ impl From<Header> for AnyHeader {
366347
excess_blob_gas,
367348
parent_beacon_block_root,
368349
requests_hash,
369-
target_blobs_per_block,
370350
}
371351
}
372352
}

crates/consensus/src/block/header.rs

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use alloy_eips::{
55
eip1559::{calc_next_block_base_fee, BaseFeeParams},
66
eip1898::BlockWithParent,
77
eip4844::{self},
8-
eip7742,
98
merge::ALLOWED_FUTURE_BLOCK_TIME_SECONDS,
109
BlockNumHash,
1110
};
@@ -127,18 +126,6 @@ pub struct Header {
127126
/// [EIP-7685]: https://eips.ethereum.org/EIPS/eip-7685
128127
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))]
129128
pub requests_hash: Option<B256>,
130-
/// The target number of blobs in the block, introduced in [EIP-7742].
131-
///
132-
/// [EIP-7742]: https://eips.ethereum.org/EIPS/eip-7742
133-
#[cfg_attr(
134-
feature = "serde",
135-
serde(
136-
default,
137-
with = "alloy_serde::quantity::opt",
138-
skip_serializing_if = "Option::is_none"
139-
)
140-
)]
141-
pub target_blobs_per_block: Option<u64>,
142129
}
143130

144131
impl AsRef<Self> for Header {
@@ -171,7 +158,6 @@ impl Default for Header {
171158
excess_blob_gas: None,
172159
parent_beacon_block_root: None,
173160
requests_hash: None,
174-
target_blobs_per_block: None,
175161
}
176162
}
177163
}
@@ -233,24 +219,12 @@ impl Header {
233219
/// Calculate excess blob gas for the next block according to the EIP-4844
234220
/// spec.
235221
///
236-
/// If [`Self::target_blobs_per_block`] is [`Some`], uses EIP-7742 formula for calculating
237-
/// the excess blob gas, otherwise uses EIP-4844 formula.
238-
///
239222
/// Returns a `None` if no excess blob gas is set, no EIP-4844 support
240223
pub fn next_block_excess_blob_gas(&self) -> Option<u64> {
241224
let excess_blob_gas = self.excess_blob_gas?;
242225
let blob_gas_used = self.blob_gas_used?;
243226

244-
Some(self.target_blobs_per_block.map_or_else(
245-
|| eip4844::calc_excess_blob_gas(excess_blob_gas, blob_gas_used),
246-
|target_blobs_per_block| {
247-
eip7742::calc_excess_blob_gas(
248-
excess_blob_gas,
249-
blob_gas_used,
250-
target_blobs_per_block,
251-
)
252-
},
253-
))
227+
Some(eip4844::calc_excess_blob_gas(excess_blob_gas, blob_gas_used))
254228
}
255229

256230
/// Calculate a heuristic for the in-memory size of the [Header].
@@ -325,10 +299,6 @@ impl Header {
325299
length += requests_hash.length();
326300
}
327301

328-
if let Some(target_blobs_per_block) = self.target_blobs_per_block {
329-
length += target_blobs_per_block.length();
330-
}
331-
332302
length
333303
}
334304

@@ -407,10 +377,6 @@ impl Encodable for Header {
407377
if let Some(ref requests_hash) = self.requests_hash {
408378
requests_hash.encode(out);
409379
}
410-
411-
if let Some(ref target_blobs_per_block) = self.target_blobs_per_block {
412-
target_blobs_per_block.encode(out);
413-
}
414380
}
415381

416382
fn length(&self) -> usize {
@@ -450,7 +416,6 @@ impl Decodable for Header {
450416
excess_blob_gas: None,
451417
parent_beacon_block_root: None,
452418
requests_hash: None,
453-
target_blobs_per_block: None,
454419
};
455420
if started_len - buf.len() < rlp_head.payload_length {
456421
this.base_fee_per_gas = Some(u64::decode(buf)?);
@@ -480,11 +445,6 @@ impl Decodable for Header {
480445
this.requests_hash = Some(B256::decode(buf)?);
481446
}
482447

483-
// Decode target blob count.
484-
if started_len - buf.len() < rlp_head.payload_length {
485-
this.target_blobs_per_block = Some(u64::decode(buf)?);
486-
}
487-
488448
let consumed = started_len - buf.len();
489449
if consumed != rlp_head.payload_length {
490450
return Err(alloy_rlp::Error::ListLengthMismatch {
@@ -561,7 +521,6 @@ impl<'a> arbitrary::Arbitrary<'a> for Header {
561521
parent_beacon_block_root: u.arbitrary()?,
562522
requests_hash: u.arbitrary()?,
563523
withdrawals_root: u.arbitrary()?,
564-
target_blobs_per_block: u.arbitrary()?,
565524
};
566525

567526
Ok(generate_valid_header(
@@ -637,9 +596,6 @@ pub trait BlockHeader {
637596
/// Retrieves the requests hash of the block, if available
638597
fn requests_hash(&self) -> Option<B256>;
639598

640-
/// Retrieves the target blob count of the block, if available
641-
fn target_blobs_per_block(&self) -> Option<u64>;
642-
643599
/// Retrieves the block's extra data field
644600
fn extra_data(&self) -> &Bytes;
645601

@@ -653,24 +609,12 @@ pub trait BlockHeader {
653609
/// Calculate excess blob gas for the next block according to the EIP-4844
654610
/// spec.
655611
///
656-
/// If [`BlockHeader::target_blobs_per_block`] is [`Some`], uses EIP-7742 formula for
657-
/// calculating the excess blob gas, otherwise uses EIP-4844 formula.
658-
///
659612
/// Returns a `None` if no excess blob gas is set, no EIP-4844 support
660613
fn next_block_excess_blob_gas(&self) -> Option<u64> {
661614
let excess_blob_gas = self.excess_blob_gas()?;
662615
let blob_gas_used = self.blob_gas_used()?;
663616

664-
Some(self.target_blobs_per_block().map_or_else(
665-
|| eip4844::calc_excess_blob_gas(excess_blob_gas, blob_gas_used),
666-
|target_blobs_per_block| {
667-
eip7742::calc_excess_blob_gas(
668-
excess_blob_gas,
669-
blob_gas_used,
670-
target_blobs_per_block,
671-
)
672-
},
673-
))
617+
Some(eip4844::calc_excess_blob_gas(excess_blob_gas, blob_gas_used))
674618
}
675619

676620
/// Returns the blob fee for the next block according to the EIP-4844 spec.
@@ -821,10 +765,6 @@ impl BlockHeader for Header {
821765
self.requests_hash
822766
}
823767

824-
fn target_blobs_per_block(&self) -> Option<u64> {
825-
self.target_blobs_per_block
826-
}
827-
828768
fn extra_data(&self) -> &Bytes {
829769
&self.extra_data
830770
}
@@ -912,10 +852,6 @@ impl<T: BlockHeader> BlockHeader for alloy_serde::WithOtherFields<T> {
912852
self.inner.requests_hash()
913853
}
914854

915-
fn target_blobs_per_block(&self) -> Option<u64> {
916-
self.inner.target_blobs_per_block()
917-
}
918-
919855
fn extra_data(&self) -> &Bytes {
920856
self.inner.extra_data()
921857
}
@@ -976,8 +912,6 @@ pub(crate) mod serde_bincode_compat {
976912
parent_beacon_block_root: Option<B256>,
977913
#[serde(default)]
978914
requests_hash: Option<B256>,
979-
#[serde(default)]
980-
target_blobs_per_block: Option<u64>,
981915
extra_data: Cow<'a, Bytes>,
982916
}
983917

@@ -1005,7 +939,6 @@ pub(crate) mod serde_bincode_compat {
1005939
parent_beacon_block_root: value.parent_beacon_block_root,
1006940
requests_hash: value.requests_hash,
1007941
extra_data: Cow::Borrowed(&value.extra_data),
1008-
target_blobs_per_block: value.target_blobs_per_block,
1009942
}
1010943
}
1011944
}
@@ -1034,7 +967,6 @@ pub(crate) mod serde_bincode_compat {
1034967
parent_beacon_block_root: value.parent_beacon_block_root,
1035968
requests_hash: value.requests_hash,
1036969
extra_data: value.extra_data.into_owned(),
1037-
target_blobs_per_block: value.target_blobs_per_block,
1038970
}
1039971
}
1040972
}

crates/eips/src/eip7742.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

crates/eips/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,3 @@ pub mod eip7685;
4545
pub mod eip7691;
4646

4747
pub mod eip7702;
48-
49-
pub mod eip7742;

crates/rpc-types-beacon/src/examples/relay_builder_block_validation_request_v4.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,5 @@
159159
}
160160
]
161161
},
162-
"target_blobs_per_block": "6",
163162
"signature": "0xa37afc405ef69e4f331e79f9de77e0df870609898c0e10a1cfcd8162e8771c4e4fefa7258059d83f72fb599b12f1bb73068476ebfaedc65e5a068425693ba272f277d83e11334e87a7d1425a2fbd369ed9351f0eb14fdc8bd93115543f6a4c67"
164163
}

crates/rpc-types-beacon/src/payload.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,6 @@ struct BeaconPayloadAttributes {
108108
withdrawals: Option<Vec<Withdrawal>>,
109109
#[serde(skip_serializing_if = "Option::is_none")]
110110
parent_beacon_block_root: Option<B256>,
111-
#[serde(skip_serializing_if = "Option::is_none")]
112-
#[serde_as(as = "Option<DisplayFromStr>")]
113-
target_blobs_per_block: Option<u64>,
114-
#[serde(skip_serializing_if = "Option::is_none")]
115-
#[serde_as(as = "Option<DisplayFromStr>")]
116-
max_blobs_per_block: Option<u64>,
117111
}
118112

119113
/// Optimism Payload Attributes
@@ -155,8 +149,6 @@ pub mod beacon_api_payload_attributes {
155149
suggested_fee_recipient: payload_attributes.suggested_fee_recipient,
156150
withdrawals: payload_attributes.withdrawals.clone(),
157151
parent_beacon_block_root: payload_attributes.parent_beacon_block_root,
158-
target_blobs_per_block: payload_attributes.target_blobs_per_block,
159-
max_blobs_per_block: payload_attributes.max_blobs_per_block,
160152
};
161153
beacon_api_payload_attributes.serialize(serializer)
162154
}
@@ -173,8 +165,6 @@ pub mod beacon_api_payload_attributes {
173165
suggested_fee_recipient: beacon_api_payload_attributes.suggested_fee_recipient,
174166
withdrawals: beacon_api_payload_attributes.withdrawals,
175167
parent_beacon_block_root: beacon_api_payload_attributes.parent_beacon_block_root,
176-
target_blobs_per_block: beacon_api_payload_attributes.target_blobs_per_block,
177-
max_blobs_per_block: beacon_api_payload_attributes.max_blobs_per_block,
178168
})
179169
}
180170
}

crates/rpc-types-beacon/src/relay.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ pub struct SignedBidSubmissionV4 {
160160
pub blobs_bundle: BlobsBundleV1,
161161
/// The Pectra execution requests for this bid.
162162
pub execution_requests: ExecutionRequestsV4,
163-
/// The EIP-7742 blobs per block for this bid.
164-
#[serde_as(as = "DisplayFromStr")]
165-
pub target_blobs_per_block: u64,
166163
/// The signature associated with the submission.
167164
pub signature: BlsSignature,
168165
}

crates/rpc-types-engine/src/payload.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -699,26 +699,6 @@ pub struct PayloadAttributes {
699699
/// See also <https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#payloadattributesv3>
700700
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
701701
pub parent_beacon_block_root: Option<B256>,
702-
/// Target blob count for the block enabled with V4.
703-
#[cfg_attr(
704-
feature = "serde",
705-
serde(
706-
default,
707-
with = "alloy_serde::quantity::opt",
708-
skip_serializing_if = "Option::is_none"
709-
)
710-
)]
711-
pub target_blobs_per_block: Option<u64>,
712-
/// Max blob count for block enabled with V4.
713-
#[cfg_attr(
714-
feature = "serde",
715-
serde(
716-
default,
717-
with = "alloy_serde::quantity::opt",
718-
skip_serializing_if = "Option::is_none"
719-
)
720-
)]
721-
pub max_blobs_per_block: Option<u64>,
722702
}
723703

724704
/// This structure contains the result of processing a payload or fork choice update.

crates/rpc-types-engine/src/prague.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ use alloy_primitives::B256;
1111
pub struct PraguePayloadFields {
1212
/// EIP-7685 requests.
1313
pub requests: RequestsOrHash,
14-
/// EIP-7742 target number of blobs in the block.
15-
pub target_blobs_per_block: u64,
1614
}
1715

1816
impl PraguePayloadFields {
1917
/// Returns a new [`PraguePayloadFields`] instance.
20-
pub fn new(requests: impl Into<RequestsOrHash>, target_blobs_per_block: u64) -> Self {
21-
Self { requests: requests.into(), target_blobs_per_block }
18+
pub fn new(requests: impl Into<RequestsOrHash>) -> Self {
19+
Self { requests: requests.into() }
2220
}
2321
}
2422

@@ -45,11 +43,6 @@ impl MaybePraguePayloadFields {
4543
self.fields.as_ref().and_then(|fields| fields.requests.requests())
4644
}
4745

48-
/// Returns the target blobs per block, if any.
49-
pub fn target_blobs_per_block(&self) -> Option<u64> {
50-
self.fields.as_ref().map(|fields| fields.target_blobs_per_block)
51-
}
52-
5346
/// Calculates or retrieves the requests hash.
5447
///
5548
/// - If the `prague` field contains a list of requests, it calculates the requests hash

0 commit comments

Comments
 (0)