diff --git a/crates/consensus-any/src/block/header.rs b/crates/consensus-any/src/block/header.rs index 96a9ce5799e..e9f87c74fb3 100644 --- a/crates/consensus-any/src/block/header.rs +++ b/crates/consensus-any/src/block/header.rs @@ -95,16 +95,6 @@ pub struct AnyHeader { /// EIP-7685 requests hash. #[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))] pub requests_hash: Option, - /// EIP-7744 target blob count. - #[cfg_attr( - feature = "serde", - serde( - default, - with = "alloy_serde::quantity::opt", - skip_serializing_if = "Option::is_none" - ) - )] - pub target_blobs_per_block: Option, } impl AnyHeader { @@ -142,7 +132,6 @@ impl AnyHeader { excess_blob_gas, parent_beacon_block_root, requests_hash, - target_blobs_per_block, } = self; Ok(Header { @@ -167,7 +156,6 @@ impl AnyHeader { excess_blob_gas, parent_beacon_block_root, requests_hash, - target_blobs_per_block, }) } @@ -197,7 +185,6 @@ impl AnyHeader { excess_blob_gas, parent_beacon_block_root, requests_hash, - target_blobs_per_block, } = self; Header { @@ -222,7 +209,6 @@ impl AnyHeader { excess_blob_gas, parent_beacon_block_root, requests_hash, - target_blobs_per_block, } } } @@ -308,10 +294,6 @@ impl BlockHeader for AnyHeader { self.requests_hash } - fn target_blobs_per_block(&self) -> Option { - self.target_blobs_per_block - } - fn extra_data(&self) -> &Bytes { &self.extra_data } @@ -341,7 +323,6 @@ impl From
for AnyHeader { excess_blob_gas, parent_beacon_block_root, requests_hash, - target_blobs_per_block, } = value; Self { @@ -366,7 +347,6 @@ impl From
for AnyHeader { excess_blob_gas, parent_beacon_block_root, requests_hash, - target_blobs_per_block, } } } diff --git a/crates/consensus/src/block/header.rs b/crates/consensus/src/block/header.rs index ba16b5388a3..fd0a5e5048c 100644 --- a/crates/consensus/src/block/header.rs +++ b/crates/consensus/src/block/header.rs @@ -5,7 +5,6 @@ use alloy_eips::{ eip1559::{calc_next_block_base_fee, BaseFeeParams}, eip1898::BlockWithParent, eip4844::{self}, - eip7742, merge::ALLOWED_FUTURE_BLOCK_TIME_SECONDS, BlockNumHash, }; @@ -127,18 +126,6 @@ pub struct Header { /// [EIP-7685]: https://eips.ethereum.org/EIPS/eip-7685 #[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))] pub requests_hash: Option, - /// The target number of blobs in the block, introduced in [EIP-7742]. - /// - /// [EIP-7742]: https://eips.ethereum.org/EIPS/eip-7742 - #[cfg_attr( - feature = "serde", - serde( - default, - with = "alloy_serde::quantity::opt", - skip_serializing_if = "Option::is_none" - ) - )] - pub target_blobs_per_block: Option, } impl AsRef for Header { @@ -171,7 +158,6 @@ impl Default for Header { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, - target_blobs_per_block: None, } } } @@ -233,24 +219,12 @@ impl Header { /// Calculate excess blob gas for the next block according to the EIP-4844 /// spec. /// - /// If [`Self::target_blobs_per_block`] is [`Some`], uses EIP-7742 formula for calculating - /// the excess blob gas, otherwise uses EIP-4844 formula. - /// /// Returns a `None` if no excess blob gas is set, no EIP-4844 support pub fn next_block_excess_blob_gas(&self) -> Option { let excess_blob_gas = self.excess_blob_gas?; let blob_gas_used = self.blob_gas_used?; - Some(self.target_blobs_per_block.map_or_else( - || eip4844::calc_excess_blob_gas(excess_blob_gas, blob_gas_used), - |target_blobs_per_block| { - eip7742::calc_excess_blob_gas( - excess_blob_gas, - blob_gas_used, - target_blobs_per_block, - ) - }, - )) + Some(eip4844::calc_excess_blob_gas(excess_blob_gas, blob_gas_used)) } /// Calculate a heuristic for the in-memory size of the [Header]. @@ -325,10 +299,6 @@ impl Header { length += requests_hash.length(); } - if let Some(target_blobs_per_block) = self.target_blobs_per_block { - length += target_blobs_per_block.length(); - } - length } @@ -407,10 +377,6 @@ impl Encodable for Header { if let Some(ref requests_hash) = self.requests_hash { requests_hash.encode(out); } - - if let Some(ref target_blobs_per_block) = self.target_blobs_per_block { - target_blobs_per_block.encode(out); - } } fn length(&self) -> usize { @@ -450,7 +416,6 @@ impl Decodable for Header { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, - target_blobs_per_block: None, }; if started_len - buf.len() < rlp_head.payload_length { this.base_fee_per_gas = Some(u64::decode(buf)?); @@ -480,11 +445,6 @@ impl Decodable for Header { this.requests_hash = Some(B256::decode(buf)?); } - // Decode target blob count. - if started_len - buf.len() < rlp_head.payload_length { - this.target_blobs_per_block = Some(u64::decode(buf)?); - } - let consumed = started_len - buf.len(); if consumed != rlp_head.payload_length { return Err(alloy_rlp::Error::ListLengthMismatch { @@ -561,7 +521,6 @@ impl<'a> arbitrary::Arbitrary<'a> for Header { parent_beacon_block_root: u.arbitrary()?, requests_hash: u.arbitrary()?, withdrawals_root: u.arbitrary()?, - target_blobs_per_block: u.arbitrary()?, }; Ok(generate_valid_header( @@ -637,9 +596,6 @@ pub trait BlockHeader { /// Retrieves the requests hash of the block, if available fn requests_hash(&self) -> Option; - /// Retrieves the target blob count of the block, if available - fn target_blobs_per_block(&self) -> Option; - /// Retrieves the block's extra data field fn extra_data(&self) -> &Bytes; @@ -653,24 +609,12 @@ pub trait BlockHeader { /// Calculate excess blob gas for the next block according to the EIP-4844 /// spec. /// - /// If [`BlockHeader::target_blobs_per_block`] is [`Some`], uses EIP-7742 formula for - /// calculating the excess blob gas, otherwise uses EIP-4844 formula. - /// /// Returns a `None` if no excess blob gas is set, no EIP-4844 support fn next_block_excess_blob_gas(&self) -> Option { let excess_blob_gas = self.excess_blob_gas()?; let blob_gas_used = self.blob_gas_used()?; - Some(self.target_blobs_per_block().map_or_else( - || eip4844::calc_excess_blob_gas(excess_blob_gas, blob_gas_used), - |target_blobs_per_block| { - eip7742::calc_excess_blob_gas( - excess_blob_gas, - blob_gas_used, - target_blobs_per_block, - ) - }, - )) + Some(eip4844::calc_excess_blob_gas(excess_blob_gas, blob_gas_used)) } /// Returns the blob fee for the next block according to the EIP-4844 spec. @@ -821,10 +765,6 @@ impl BlockHeader for Header { self.requests_hash } - fn target_blobs_per_block(&self) -> Option { - self.target_blobs_per_block - } - fn extra_data(&self) -> &Bytes { &self.extra_data } @@ -912,10 +852,6 @@ impl BlockHeader for alloy_serde::WithOtherFields { self.inner.requests_hash() } - fn target_blobs_per_block(&self) -> Option { - self.inner.target_blobs_per_block() - } - fn extra_data(&self) -> &Bytes { self.inner.extra_data() } @@ -976,8 +912,6 @@ pub(crate) mod serde_bincode_compat { parent_beacon_block_root: Option, #[serde(default)] requests_hash: Option, - #[serde(default)] - target_blobs_per_block: Option, extra_data: Cow<'a, Bytes>, } @@ -1005,7 +939,6 @@ pub(crate) mod serde_bincode_compat { parent_beacon_block_root: value.parent_beacon_block_root, requests_hash: value.requests_hash, extra_data: Cow::Borrowed(&value.extra_data), - target_blobs_per_block: value.target_blobs_per_block, } } } @@ -1034,7 +967,6 @@ pub(crate) mod serde_bincode_compat { parent_beacon_block_root: value.parent_beacon_block_root, requests_hash: value.requests_hash, extra_data: value.extra_data.into_owned(), - target_blobs_per_block: value.target_blobs_per_block, } } } diff --git a/crates/eips/src/eip7742.rs b/crates/eips/src/eip7742.rs deleted file mode 100644 index 20a44ef5daa..00000000000 --- a/crates/eips/src/eip7742.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Contains constants and utility functions for [EIP-7742](https://eips.ethereum.org/EIPS/eip-7742) - -use crate::eip4844; - -/// Calculates the `excess_blob_gas` from the parent header's `blob_gas_used`, `excess_blob_gas` and -/// `target_blobs_per_block`. -/// -/// Similar to [`eip4844::calc_excess_blob_gas`], but uses the `target_blobs_per_block` to calculate -/// the target gas usage. -#[inline] -pub const fn calc_excess_blob_gas( - parent_excess_blob_gas: u64, - parent_blob_gas_used: u64, - parent_target_blobs_per_block: u64, -) -> u64 { - (parent_excess_blob_gas + parent_blob_gas_used) - .saturating_sub(parent_target_blobs_per_block * eip4844::DATA_GAS_PER_BLOB) -} diff --git a/crates/eips/src/lib.rs b/crates/eips/src/lib.rs index ce5190dbec2..39ad47ba50c 100644 --- a/crates/eips/src/lib.rs +++ b/crates/eips/src/lib.rs @@ -45,5 +45,3 @@ pub mod eip7685; pub mod eip7691; pub mod eip7702; - -pub mod eip7742; diff --git a/crates/rpc-types-beacon/src/examples/relay_builder_block_validation_request_v4.json b/crates/rpc-types-beacon/src/examples/relay_builder_block_validation_request_v4.json index e61d8277280..d7fb9b07b5b 100644 --- a/crates/rpc-types-beacon/src/examples/relay_builder_block_validation_request_v4.json +++ b/crates/rpc-types-beacon/src/examples/relay_builder_block_validation_request_v4.json @@ -159,6 +159,5 @@ } ] }, - "target_blobs_per_block": "6", "signature": "0xa37afc405ef69e4f331e79f9de77e0df870609898c0e10a1cfcd8162e8771c4e4fefa7258059d83f72fb599b12f1bb73068476ebfaedc65e5a068425693ba272f277d83e11334e87a7d1425a2fbd369ed9351f0eb14fdc8bd93115543f6a4c67" } \ No newline at end of file diff --git a/crates/rpc-types-beacon/src/payload.rs b/crates/rpc-types-beacon/src/payload.rs index 31f9bd2e10b..13bb1fa3099 100644 --- a/crates/rpc-types-beacon/src/payload.rs +++ b/crates/rpc-types-beacon/src/payload.rs @@ -108,12 +108,6 @@ struct BeaconPayloadAttributes { withdrawals: Option>, #[serde(skip_serializing_if = "Option::is_none")] parent_beacon_block_root: Option, - #[serde(skip_serializing_if = "Option::is_none")] - #[serde_as(as = "Option")] - target_blobs_per_block: Option, - #[serde(skip_serializing_if = "Option::is_none")] - #[serde_as(as = "Option")] - max_blobs_per_block: Option, } /// Optimism Payload Attributes @@ -155,8 +149,6 @@ pub mod beacon_api_payload_attributes { suggested_fee_recipient: payload_attributes.suggested_fee_recipient, withdrawals: payload_attributes.withdrawals.clone(), parent_beacon_block_root: payload_attributes.parent_beacon_block_root, - target_blobs_per_block: payload_attributes.target_blobs_per_block, - max_blobs_per_block: payload_attributes.max_blobs_per_block, }; beacon_api_payload_attributes.serialize(serializer) } @@ -173,8 +165,6 @@ pub mod beacon_api_payload_attributes { suggested_fee_recipient: beacon_api_payload_attributes.suggested_fee_recipient, withdrawals: beacon_api_payload_attributes.withdrawals, parent_beacon_block_root: beacon_api_payload_attributes.parent_beacon_block_root, - target_blobs_per_block: beacon_api_payload_attributes.target_blobs_per_block, - max_blobs_per_block: beacon_api_payload_attributes.max_blobs_per_block, }) } } diff --git a/crates/rpc-types-beacon/src/relay.rs b/crates/rpc-types-beacon/src/relay.rs index 2a4fe0e55dc..6672e1c8585 100644 --- a/crates/rpc-types-beacon/src/relay.rs +++ b/crates/rpc-types-beacon/src/relay.rs @@ -160,9 +160,6 @@ pub struct SignedBidSubmissionV4 { pub blobs_bundle: BlobsBundleV1, /// The Pectra execution requests for this bid. pub execution_requests: ExecutionRequestsV4, - /// The EIP-7742 blobs per block for this bid. - #[serde_as(as = "DisplayFromStr")] - pub target_blobs_per_block: u64, /// The signature associated with the submission. pub signature: BlsSignature, } diff --git a/crates/rpc-types-engine/src/payload.rs b/crates/rpc-types-engine/src/payload.rs index 0af7c8a9047..2d94ac134ff 100644 --- a/crates/rpc-types-engine/src/payload.rs +++ b/crates/rpc-types-engine/src/payload.rs @@ -699,26 +699,6 @@ pub struct PayloadAttributes { /// See also #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] pub parent_beacon_block_root: Option, - /// Target blob count for the block enabled with V4. - #[cfg_attr( - feature = "serde", - serde( - default, - with = "alloy_serde::quantity::opt", - skip_serializing_if = "Option::is_none" - ) - )] - pub target_blobs_per_block: Option, - /// Max blob count for block enabled with V4. - #[cfg_attr( - feature = "serde", - serde( - default, - with = "alloy_serde::quantity::opt", - skip_serializing_if = "Option::is_none" - ) - )] - pub max_blobs_per_block: Option, } /// This structure contains the result of processing a payload or fork choice update. diff --git a/crates/rpc-types-engine/src/prague.rs b/crates/rpc-types-engine/src/prague.rs index 36ae0a08135..07c9965cda2 100644 --- a/crates/rpc-types-engine/src/prague.rs +++ b/crates/rpc-types-engine/src/prague.rs @@ -11,14 +11,12 @@ use alloy_primitives::B256; pub struct PraguePayloadFields { /// EIP-7685 requests. pub requests: RequestsOrHash, - /// EIP-7742 target number of blobs in the block. - pub target_blobs_per_block: u64, } impl PraguePayloadFields { /// Returns a new [`PraguePayloadFields`] instance. - pub fn new(requests: impl Into, target_blobs_per_block: u64) -> Self { - Self { requests: requests.into(), target_blobs_per_block } + pub fn new(requests: impl Into) -> Self { + Self { requests: requests.into() } } } @@ -45,11 +43,6 @@ impl MaybePraguePayloadFields { self.fields.as_ref().and_then(|fields| fields.requests.requests()) } - /// Returns the target blobs per block, if any. - pub fn target_blobs_per_block(&self) -> Option { - self.fields.as_ref().map(|fields| fields.target_blobs_per_block) - } - /// Calculates or retrieves the requests hash. /// /// - If the `prague` field contains a list of requests, it calculates the requests hash diff --git a/crates/rpc-types-engine/src/sidecar.rs b/crates/rpc-types-engine/src/sidecar.rs index f2e262fabd3..79db14d3644 100644 --- a/crates/rpc-types-engine/src/sidecar.rs +++ b/crates/rpc-types-engine/src/sidecar.rs @@ -72,9 +72,4 @@ impl ExecutionPayloadSidecar { pub fn requests_hash(&self) -> Option { self.prague.requests_hash() } - - /// Returns the target blobs per block - pub fn target_blobs_per_block(&self) -> Option { - self.prague.target_blobs_per_block() - } } diff --git a/crates/rpc-types-eth/src/block.rs b/crates/rpc-types-eth/src/block.rs index 4f02eda2f71..1883a7ec640 100644 --- a/crates/rpc-types-eth/src/block.rs +++ b/crates/rpc-types-eth/src/block.rs @@ -259,10 +259,6 @@ impl BlockHeader for Header { self.inner.requests_hash() } - fn target_blobs_per_block(&self) -> Option { - self.inner.target_blobs_per_block() - } - fn extra_data(&self) -> &Bytes { self.inner.extra_data() } @@ -450,7 +446,6 @@ mod tests { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, - target_blobs_per_block: None, }, total_difficulty: Some(U256::from(100000)), size: None, @@ -498,7 +493,6 @@ mod tests { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, - target_blobs_per_block: None, }, size: None, total_difficulty: Some(U256::from(100000)), @@ -544,7 +538,6 @@ mod tests { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, - target_blobs_per_block: None, }, total_difficulty: Some(U256::from(100000)), size: None, @@ -816,7 +809,6 @@ mod tests { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, - target_blobs_per_block: None, }, size: None, total_difficulty: None, @@ -863,7 +855,6 @@ mod tests { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, - target_blobs_per_block: None, }, total_difficulty: None, size: Some(U256::from(505)), @@ -922,7 +913,6 @@ mod tests { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, - target_blobs_per_block: None, }, total_difficulty: Some(U256::from(100000)), size: Some(U256::from(19)),