@@ -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
144131impl 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 }
0 commit comments