@@ -412,34 +412,44 @@ impl PartialHeader {
412412 } ) ,
413413 blob_gas : overrides. blob_gas . or_else ( || {
414414 if evm_spec_id >= EvmSpecId :: CANCUN {
415- let excess_gas = parent. and_then ( |parent| parent . blob_gas . as_ref ( ) ) . map_or (
416- // For the first (post-fork) block, both parent. blob_gas_used and
417- // parent.excess_blob_gas are evaluated as 0.
415+ let excess_gas = parent. map_or (
416+ // For the first block, both ` blob_gas_used` and `excess_blob_gas` are
417+ // evaluated as 0.
418418 0 ,
419- |BlobGas {
420- gas_used,
421- excess_gas,
422- } | {
423- let blob_params = blob_params_for_hardfork (
424- evm_spec_id,
425- timestamp,
426- scheduled_blob_params. as_ref ( ) ,
427- ) ;
428-
429- let base_fee = if evm_spec_id >= EvmSpecId :: OSAKA {
430- base_fee. expect ( "base fee must be set for post-Osaka blocks" )
431- } else {
432- // In pre-Osaka (EIP-4844) scenarios, the base fee parameter is not
433- // used in excess blob gas calculation. Passing 0 is acceptable here
434- // because `next_block_excess_blob_gas_osaka` ignores the base fee
435- // value for these hardforks.
436- 0
437- } ;
438-
439- blob_params. next_block_excess_blob_gas_osaka (
440- * excess_gas,
441- * gas_used,
442- base_fee. try_into ( ) . expect ( "base fee is too large" ) ,
419+ |parent| {
420+ parent. blob_gas . as_ref ( ) . map_or (
421+ // For the first post-fork block, both `blob_gas_used` and
422+ // `excess_blob_gas` are evaluated as 0.
423+ 0 ,
424+ |BlobGas {
425+ gas_used,
426+ excess_gas,
427+ } | {
428+ let blob_params = blob_params_for_hardfork (
429+ evm_spec_id,
430+ timestamp,
431+ scheduled_blob_params. as_ref ( ) ,
432+ ) ;
433+
434+ let base_fee = if evm_spec_id >= EvmSpecId :: OSAKA {
435+ parent
436+ . base_fee_per_gas
437+ . expect ( "base fee must be set for post-Osaka blocks" )
438+ } else {
439+ // In pre-Osaka (EIP-4844) scenarios, the base fee parameter
440+ // is not used in excess blob gas calculation. Passing 0 is
441+ // acceptable here because
442+ // `next_block_excess_blob_gas_osaka` ignores the base fee
443+ // value for these hardforks.
444+ 0
445+ } ;
446+
447+ blob_params. next_block_excess_blob_gas_osaka (
448+ * excess_gas,
449+ * gas_used,
450+ base_fee. try_into ( ) . expect ( "base fee is too large" ) ,
451+ )
452+ } ,
443453 )
444454 } ,
445455 ) ;
0 commit comments