@@ -136,7 +136,7 @@ pub struct Header {
136136 skip_serializing_if = "Option::is_none"
137137 )
138138 ) ]
139- pub target_blob_count : Option < u64 > ,
139+ pub target_blobs_per_block : Option < u64 > ,
140140}
141141
142142impl AsRef < Self > for Header {
@@ -169,7 +169,7 @@ impl Default for Header {
169169 excess_blob_gas : None ,
170170 parent_beacon_block_root : None ,
171171 requests_hash : None ,
172- target_blob_count : None ,
172+ target_blobs_per_block : None ,
173173 }
174174 }
175175}
@@ -219,16 +219,19 @@ impl Header {
219219 ///
220220 /// Returns `None` if `excess_blob_gas` is None.
221221 ///
222- /// If `next_block_target_blob_count ` is [`Some`], uses EIP-7742 formula for calculating the
223- /// blob gas price, otherwise uses EIP-4844 formula.
222+ /// If `next_block_target_blobs_per_block ` is [`Some`], uses EIP-7742 formula for calculating
223+ /// the blob gas price, otherwise uses EIP-4844 formula.
224224 ///
225225 /// See also [Self::next_block_excess_blob_gas]
226- pub fn next_block_blob_fee ( & self , next_block_target_blob_count : Option < u64 > ) -> Option < u128 > {
226+ pub fn next_block_blob_fee (
227+ & self ,
228+ next_block_target_blobs_per_block : Option < u64 > ,
229+ ) -> Option < u128 > {
227230 let next_block_excess_blob_gas = self . next_block_excess_blob_gas ( ) ?;
228- Some ( next_block_target_blob_count . map_or_else (
231+ Some ( next_block_target_blobs_per_block . map_or_else (
229232 || eip4844:: calc_blob_gasprice ( next_block_excess_blob_gas) ,
230- |target_blob_count | {
231- eip7742:: calc_blob_gasprice ( next_block_excess_blob_gas, target_blob_count )
233+ |target_blobs_per_block | {
234+ eip7742:: calc_blob_gasprice ( next_block_excess_blob_gas, target_blobs_per_block )
232235 } ,
233236 ) )
234237 }
@@ -253,10 +256,14 @@ impl Header {
253256 let excess_blob_gas = self . excess_blob_gas ?;
254257 let blob_gas_used = self . blob_gas_used ?;
255258
256- Some ( self . target_blob_count . map_or_else (
259+ Some ( self . target_blobs_per_block . map_or_else (
257260 || eip4844:: calc_excess_blob_gas ( excess_blob_gas, blob_gas_used) ,
258- |target_blob_count| {
259- eip7742:: calc_excess_blob_gas ( excess_blob_gas, blob_gas_used, target_blob_count)
261+ |target_blobs_per_block| {
262+ eip7742:: calc_excess_blob_gas (
263+ excess_blob_gas,
264+ blob_gas_used,
265+ target_blobs_per_block,
266+ )
260267 } ,
261268 ) )
262269 }
@@ -333,8 +340,8 @@ impl Header {
333340 length += requests_hash. length ( ) ;
334341 }
335342
336- if let Some ( target_blob_count ) = self . target_blob_count {
337- length += target_blob_count . length ( ) ;
343+ if let Some ( target_blobs_per_block ) = self . target_blobs_per_block {
344+ length += target_blobs_per_block . length ( ) ;
338345 }
339346
340347 length
@@ -431,8 +438,8 @@ impl Encodable for Header {
431438 requests_hash. encode ( out) ;
432439 }
433440
434- if let Some ( ref target_blob_count ) = self . target_blob_count {
435- target_blob_count . encode ( out) ;
441+ if let Some ( ref target_blobs_per_block ) = self . target_blobs_per_block {
442+ target_blobs_per_block . encode ( out) ;
436443 }
437444 }
438445
@@ -473,7 +480,7 @@ impl Decodable for Header {
473480 excess_blob_gas : None ,
474481 parent_beacon_block_root : None ,
475482 requests_hash : None ,
476- target_blob_count : None ,
483+ target_blobs_per_block : None ,
477484 } ;
478485 if started_len - buf. len ( ) < rlp_head. payload_length {
479486 this. base_fee_per_gas = Some ( u64:: decode ( buf) ?) ;
@@ -505,7 +512,7 @@ impl Decodable for Header {
505512
506513 // Decode target blob count.
507514 if started_len - buf. len ( ) < rlp_head. payload_length {
508- this. target_blob_count = Some ( u64:: decode ( buf) ?) ;
515+ this. target_blobs_per_block = Some ( u64:: decode ( buf) ?) ;
509516 }
510517
511518 let consumed = started_len - buf. len ( ) ;
@@ -584,7 +591,7 @@ impl<'a> arbitrary::Arbitrary<'a> for Header {
584591 parent_beacon_block_root : u. arbitrary ( ) ?,
585592 requests_hash : u. arbitrary ( ) ?,
586593 withdrawals_root : u. arbitrary ( ) ?,
587- target_blob_count : u. arbitrary ( ) ?,
594+ target_blobs_per_block : u. arbitrary ( ) ?,
588595 } ;
589596
590597 Ok ( generate_valid_header (
@@ -660,7 +667,7 @@ pub trait BlockHeader {
660667 fn requests_hash ( & self ) -> Option < B256 > ;
661668
662669 /// Retrieves the target blob count of the block, if available
663- fn target_blob_count ( & self ) -> Option < u64 > ;
670+ fn target_blobs_per_block ( & self ) -> Option < u64 > ;
664671
665672 /// Retrieves the block's extra data field
666673 fn extra_data ( & self ) -> & Bytes ;
@@ -673,10 +680,14 @@ pub trait BlockHeader {
673680 let excess_blob_gas = self . excess_blob_gas ( ) ?;
674681 let blob_gas_used = self . blob_gas_used ( ) ?;
675682
676- Some ( self . target_blob_count ( ) . map_or_else (
683+ Some ( self . target_blobs_per_block ( ) . map_or_else (
677684 || eip4844:: calc_excess_blob_gas ( excess_blob_gas, blob_gas_used) ,
678- |target_blob_count| {
679- eip7742:: calc_excess_blob_gas ( excess_blob_gas, blob_gas_used, target_blob_count)
685+ |target_blobs_per_block| {
686+ eip7742:: calc_excess_blob_gas (
687+ excess_blob_gas,
688+ blob_gas_used,
689+ target_blobs_per_block,
690+ )
680691 } ,
681692 ) )
682693 }
@@ -685,16 +696,16 @@ pub trait BlockHeader {
685696 ///
686697 /// Returns `None` if `excess_blob_gas` is None.
687698 ///
688- /// If `next_block_target_blob_count ` is [`Some`], uses EIP-7742 formula for calculating the
689- /// blob gas price, otherwise uses EIP-4844 formula.
699+ /// If `next_block_target_blobs_per_block ` is [`Some`], uses EIP-7742 formula for calculating
700+ /// the blob gas price, otherwise uses EIP-4844 formula.
690701 ///
691702 /// See also [BlockHeader::next_block_excess_blob_gas]
692- fn next_block_blob_fee ( & self , next_block_target_blob_count : Option < u64 > ) -> Option < u128 > {
703+ fn next_block_blob_fee ( & self , next_block_target_blobs_per_block : Option < u64 > ) -> Option < u128 > {
693704 let next_block_excess_blob_gas = self . next_block_excess_blob_gas ( ) ?;
694- Some ( next_block_target_blob_count . map_or_else (
705+ Some ( next_block_target_blobs_per_block . map_or_else (
695706 || eip4844:: calc_blob_gasprice ( next_block_excess_blob_gas) ,
696- |target_blob_count | {
697- eip7742:: calc_blob_gasprice ( next_block_excess_blob_gas, target_blob_count )
707+ |target_blobs_per_block | {
708+ eip7742:: calc_blob_gasprice ( next_block_excess_blob_gas, target_blobs_per_block )
698709 } ,
699710 ) )
700711 }
@@ -781,8 +792,8 @@ impl BlockHeader for Header {
781792 self . requests_hash
782793 }
783794
784- fn target_blob_count ( & self ) -> Option < u64 > {
785- self . target_blob_count
795+ fn target_blobs_per_block ( & self ) -> Option < u64 > {
796+ self . target_blobs_per_block
786797 }
787798
788799 fn extra_data ( & self ) -> & Bytes {
@@ -842,7 +853,7 @@ pub(crate) mod serde_bincode_compat {
842853 #[ serde( default ) ]
843854 requests_hash : Option < B256 > ,
844855 #[ serde( default ) ]
845- target_blob_count : Option < u64 > ,
856+ target_blobs_per_block : Option < u64 > ,
846857 extra_data : Cow < ' a , Bytes > ,
847858 }
848859
@@ -870,7 +881,7 @@ pub(crate) mod serde_bincode_compat {
870881 parent_beacon_block_root : value. parent_beacon_block_root ,
871882 requests_hash : value. requests_hash ,
872883 extra_data : Cow :: Borrowed ( & value. extra_data ) ,
873- target_blob_count : value. target_blob_count ,
884+ target_blobs_per_block : value. target_blobs_per_block ,
874885 }
875886 }
876887 }
@@ -899,7 +910,7 @@ pub(crate) mod serde_bincode_compat {
899910 parent_beacon_block_root : value. parent_beacon_block_root ,
900911 requests_hash : value. requests_hash ,
901912 extra_data : value. extra_data . into_owned ( ) ,
902- target_blob_count : value. target_blob_count ,
913+ target_blobs_per_block : value. target_blobs_per_block ,
903914 }
904915 }
905916 }
0 commit comments