@@ -469,38 +469,36 @@ impl PartialBlockForkExecutionTracer for NullPartialBlockExecutionTracer {
469469}
470470
471471/// Models consumed/reserved space on a block to be able to insert payout tx when finished filling the block.
472- /// @Pending: Add blob gas?
473472#[ derive( Debug , Clone , Copy , Default , PartialEq , Eq , Hash ) ]
474473pub struct BlockSpace {
475474 pub gas : u64 ,
476475 /// EIP-7934 limits the size of the final rlp block.
477476 /// Estimation of the sum of the rlp txs sizes.
478477 pub rlp_length : usize ,
478+ pub blob_gas : u64 ,
479479}
480480
481481impl BlockSpace {
482- pub fn new ( gas : u64 , rlp_length : usize ) -> Self {
483- Self { gas, rlp_length }
482+ pub fn new ( gas : u64 , rlp_length : usize , blob_gas : u64 ) -> Self {
483+ Self {
484+ gas,
485+ rlp_length,
486+ blob_gas,
487+ }
484488 }
485489
486490 pub const ZERO : Self = Self {
487491 gas : 0 ,
488492 rlp_length : 0 ,
493+ blob_gas : 0 ,
489494 } ;
490-
491- pub fn gas ( & self ) -> u64 {
492- self . gas
493- }
494-
495- pub fn rlp_length ( & self ) -> usize {
496- self . rlp_length
497- }
498495}
499496
500497impl AddAssign for BlockSpace {
501498 fn add_assign ( & mut self , other : Self ) {
502499 self . gas += other. gas ;
503500 self . rlp_length += other. rlp_length ;
501+ self . blob_gas += other. blob_gas ;
504502 }
505503}
506504
@@ -511,6 +509,7 @@ impl Add for BlockSpace {
511509 Self {
512510 gas : self . gas + other. gas ,
513511 rlp_length : self . rlp_length + other. rlp_length ,
512+ blob_gas : self . blob_gas + other. blob_gas ,
514513 }
515514 }
516515}
@@ -521,26 +520,19 @@ pub struct BlockBuildingSpaceState {
521520 space_used : BlockSpace ,
522521 /// Reserved gas/size for later use (usually final payout tx). When simulating we subtract this from the block gas limit.
523522 reserved_block_space : BlockSpace ,
524- blob_gas_used : u64 ,
525523}
526524
527525impl BlockBuildingSpaceState {
528- pub fn new (
529- space_used : BlockSpace ,
530- reserved_block_space : BlockSpace ,
531- blob_gas_used : u64 ,
532- ) -> Self {
526+ pub fn new ( space_used : BlockSpace , reserved_block_space : BlockSpace ) -> Self {
533527 Self {
534528 space_used,
535529 reserved_block_space,
536- blob_gas_used,
537530 }
538531 }
539532
540533 pub const ZERO : Self = Self {
541534 space_used : BlockSpace :: ZERO ,
542535 reserved_block_space : BlockSpace :: ZERO ,
543- blob_gas_used : 0 ,
544536 } ;
545537
546538 pub fn free_reserved_block_space ( & mut self ) {
@@ -557,11 +549,11 @@ impl BlockBuildingSpaceState {
557549 }
558550
559551 pub fn gas_used ( & self ) -> u64 {
560- self . space_used . gas ( )
552+ self . space_used . gas
561553 }
562554
563555 pub fn blob_gas_used ( & self ) -> u64 {
564- self . blob_gas_used
556+ self . space_used . blob_gas
565557 }
566558
567559 pub fn space_used ( & self ) -> BlockSpace {
@@ -572,9 +564,8 @@ impl BlockBuildingSpaceState {
572564 self . reserved_block_space += space;
573565 }
574566
575- pub fn use_space ( & mut self , space : BlockSpace , blob_gas_used : u64 ) {
567+ pub fn use_space ( & mut self , space : BlockSpace ) {
576568 self . space_used += space;
577- self . blob_gas_used += blob_gas_used;
578569 }
579570}
580571
@@ -788,8 +779,7 @@ impl<Tracer: SimulationTracer, PartialBlockExecutionTracerType: PartialBlockExec
788779 }
789780 }
790781
791- self . space_state
792- . use_space ( ok_result. space_used , ok_result. blob_gas_used ) ;
782+ self . space_state . use_space ( ok_result. space_used ) ;
793783 self . coinbase_profit += ok_result. coinbase_profit ;
794784 self . executed_tx_infos . extend ( ok_result. tx_infos . clone ( ) ) ;
795785
@@ -879,8 +869,7 @@ impl<Tracer: SimulationTracer, PartialBlockExecutionTracerType: PartialBlockExec
879869 return Err ( InsertPayoutTxErr :: CombinedRefundTxReverted ) ;
880870 }
881871
882- self . space_state
883- . use_space ( refund_result. space_used ( ) , refund_result. blob_gas_used ) ;
872+ self . space_state . use_space ( refund_result. space_used ( ) ) ;
884873 self . executed_tx_infos . push ( refund_result. tx_info ) ;
885874
886875 nonce += 1 ;
@@ -903,8 +892,7 @@ impl<Tracer: SimulationTracer, PartialBlockExecutionTracerType: PartialBlockExec
903892 return Err ( InsertPayoutTxErr :: PayoutTxReverted ) ;
904893 }
905894
906- self . space_state
907- . use_space ( ok_result. space_used ( ) , ok_result. blob_gas_used ) ;
895+ self . space_state . use_space ( ok_result. space_used ( ) ) ;
908896 self . executed_tx_infos . push ( ok_result. tx_info ) ;
909897
910898 Ok ( ( ) )
@@ -957,8 +945,7 @@ impl<Tracer: SimulationTracer, PartialBlockExecutionTracerType: PartialBlockExec
957945 return Err ( InsertPayoutTxErr :: CombinedRefundTxReverted ) ;
958946 }
959947
960- self . space_state
961- . use_space ( refund_result. space_used ( ) , refund_result. blob_gas_used ) ;
948+ self . space_state . use_space ( refund_result. space_used ( ) ) ;
962949 self . executed_tx_infos . push ( refund_result. tx_info ) ;
963950
964951 nonce += 1 ;
@@ -997,8 +984,7 @@ impl<Tracer: SimulationTracer, PartialBlockExecutionTracerType: PartialBlockExec
997984 return Err ( InsertPayoutTxErr :: PayoutTxReverted ) ;
998985 }
999986
1000- self . space_state
1001- . use_space ( ok_result. space_used ( ) , ok_result. blob_gas_used ) ;
987+ self . space_state . use_space ( ok_result. space_used ( ) ) ;
1002988 self . executed_tx_infos . push ( ok_result. tx_info ) ;
1003989
1004990 Ok ( ( ) )
@@ -1353,13 +1339,11 @@ impl<Tracer: SimulationTracer, PartialBlockExecutionTracerType: PartialBlockExec
13531339 state : & mut BlockState ,
13541340 ) -> eyre:: Result < ( ) > {
13551341 // We "pre-use" the RLP overhead for the withdrawals and the block header.
1356- self . space_state . use_space (
1357- BlockSpace :: new (
1358- 0 ,
1359- ctx. attributes . withdrawals . length ( ) + BLOCK_HEADER_RLP_OVERHEAD ,
1360- ) ,
1342+ self . space_state . use_space ( BlockSpace :: new (
13611343 0 ,
1362- ) ;
1344+ ctx. attributes . withdrawals . length ( ) + BLOCK_HEADER_RLP_OVERHEAD ,
1345+ 0 ,
1346+ ) ) ;
13631347
13641348 let mut db = state. new_db_ref ( & ctx. shared_cached_reads , & mut local_ctx. cached_reads ) ;
13651349 let mut system_caller = SystemCaller :: new ( ctx. chain_spec . clone ( ) ) ;
@@ -1448,7 +1432,6 @@ pub fn create_sim_value(
14481432 order_ok. coinbase_profit ,
14491433 non_mempool_coinbase_profit,
14501434 order_ok. space_used ,
1451- order_ok. blob_gas_used ,
14521435 order_ok. paid_kickbacks . clone ( ) ,
14531436 )
14541437}
@@ -1480,19 +1463,17 @@ mod test {
14801463 coinbase_profit : Default :: default ( ) ,
14811464 space_used : Default :: default ( ) ,
14821465 cumulative_space_used : Default :: default ( ) ,
1483- blob_gas_used : Default :: default ( ) ,
1484- cumulative_blob_gas_used : Default :: default ( ) ,
14851466 tx_infos : vec ! [
14861467 TransactionExecutionInfo {
14871468 tx: tx1,
14881469 receipt: Default :: default ( ) ,
1489- gas_used : Default :: default ( ) ,
1470+ space_used : Default :: default ( ) ,
14901471 coinbase_profit: profit_1,
14911472 } ,
14921473 TransactionExecutionInfo {
14931474 tx: tx2,
14941475 receipt: Default :: default ( ) ,
1495- gas_used : Default :: default ( ) ,
1476+ space_used : Default :: default ( ) ,
14961477 coinbase_profit: profit_2,
14971478 } ,
14981479 ] ,
@@ -1531,12 +1512,10 @@ mod test {
15311512 coinbase_profit : profit. unsigned_abs ( ) ,
15321513 space_used : Default :: default ( ) ,
15331514 cumulative_space_used : Default :: default ( ) ,
1534- blob_gas_used : Default :: default ( ) ,
1535- cumulative_blob_gas_used : Default :: default ( ) ,
15361515 tx_infos : vec ! [ TransactionExecutionInfo {
15371516 tx,
15381517 receipt: Default :: default ( ) ,
1539- gas_used : Default :: default ( ) ,
1518+ space_used : Default :: default ( ) ,
15401519 coinbase_profit: profit,
15411520 } ] ,
15421521 delayed_kickback : None ,
0 commit comments