@@ -282,14 +282,11 @@ where
282
282
ctx. metrics . sequencer_tx_gauge . set ( sequencer_tx_time) ;
283
283
284
284
// If we have payload with txpool we add first builder tx right after deposits
285
- self . builder_tx
286
- . add_builder_txs ( & state_provider, & mut info, & ctx, & mut db) ?;
285
+ let builder_txs =
286
+ self . builder_tx
287
+ . add_builder_txs ( & state_provider, & mut info, & ctx, & mut db) ?;
287
288
288
289
// We subtract gas limit and da limit for builder transaction from the whole limit
289
- let builder_txs = self
290
- . builder_tx
291
- . simulate_builder_txs ( & state_provider, & mut info, & ctx, & mut db)
292
- . map_err ( |err| PayloadBuilderError :: Other ( Box :: new ( err) ) ) ?;
293
290
let builder_tx_gas = builder_txs. iter ( ) . fold ( 0 , |acc, tx| acc + tx. gas_used ) ;
294
291
let builder_tx_da_size: u64 = builder_txs. iter ( ) . fold ( 0 , |acc, tx| acc + tx. da_size ) ;
295
292
@@ -430,19 +427,28 @@ where
430
427
) ;
431
428
let flashblock_build_start_time = Instant :: now ( ) ;
432
429
let state = StateProviderDatabase :: new ( & state_provider) ;
430
+ let mut db = State :: builder ( )
431
+ . with_database ( state)
432
+ . with_bundle_update ( )
433
+ . with_bundle_prestate ( bundle_state. clone ( ) )
434
+ . build ( ) ;
435
+
436
+ let builder_txs = self . builder_tx . simulate_builder_txs (
437
+ & state_provider,
438
+ & mut info,
439
+ & ctx,
440
+ & mut db,
441
+ ) ?;
442
+ let builder_tx_gas = builder_txs. iter ( ) . fold ( 0 , |acc, tx| acc + tx. gas_used ) ;
443
+ let builder_tx_da_size: u64 =
444
+ builder_txs. iter ( ) . fold ( 0 , |acc, tx| acc + tx. da_size ) ;
433
445
434
446
total_gas_per_batch = total_gas_per_batch. saturating_sub ( builder_tx_gas) ;
435
447
// saturating sub just in case, we will log an error if da_limit too small for builder_tx_da_size
436
448
if let Some ( da_limit) = total_da_per_batch. as_mut ( ) {
437
449
* da_limit = da_limit. saturating_sub ( builder_tx_da_size) ;
438
450
}
439
451
440
- let mut db = State :: builder ( )
441
- . with_database ( state)
442
- . with_bundle_update ( )
443
- . with_bundle_prestate ( bundle_state. clone ( ) )
444
- . build ( ) ;
445
-
446
452
let best_txs_start_time = Instant :: now ( ) ;
447
453
let best_txs = BestPayloadTransactions :: new (
448
454
// We are not using without_updates in here, so arriving transaction could target the current block
0 commit comments