@@ -93,9 +93,7 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
9393
9494 /// Returns the block gas limit to target.
9595 pub ( super ) fn block_gas_limit ( & self ) -> u64 {
96- self . attributes ( )
97- . gas_limit
98- . unwrap_or ( self . evm_env . block_env . gas_limit )
96+ self . attributes ( ) . gas_limit . unwrap_or ( self . evm_env . block_env . gas_limit )
9997 }
10098
10199 /// Returns the block number for the block.
@@ -110,10 +108,7 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
110108
111109 /// Returns the current blob gas price.
112110 pub ( super ) fn get_blob_gasprice ( & self ) -> Option < u64 > {
113- self . evm_env
114- . block_env
115- . blob_gasprice ( )
116- . map ( |gasprice| gasprice as u64 )
111+ self . evm_env . block_env . blob_gasprice ( ) . map ( |gasprice| gasprice as u64 )
117112 }
118113
119114 /// Returns the blob fields for the header.
@@ -123,11 +118,7 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
123118 // OP doesn't support blobs/EIP-4844.
124119 // https://specs.optimism.io/protocol/exec-engine.html#ecotone-disable-blob-transactions
125120 // Need [Some] or [None] based on hardfork to match block hash.
126- if self . is_ecotone_active ( ) {
127- ( Some ( 0 ) , Some ( 0 ) )
128- } else {
129- ( None , None )
130- }
121+ if self . is_ecotone_active ( ) { ( Some ( 0 ) , Some ( 0 ) ) } else { ( None , None ) }
131122 }
132123
133124 /// Returns the extra data for the block.
@@ -159,32 +150,27 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
159150
160151 /// Returns true if regolith is active for the payload.
161152 pub ( super ) fn is_regolith_active ( & self ) -> bool {
162- self . chain_spec
163- . is_regolith_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
153+ self . chain_spec . is_regolith_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
164154 }
165155
166156 /// Returns true if ecotone is active for the payload.
167157 pub ( super ) fn is_ecotone_active ( & self ) -> bool {
168- self . chain_spec
169- . is_ecotone_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
158+ self . chain_spec . is_ecotone_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
170159 }
171160
172161 /// Returns true if canyon is active for the payload.
173162 pub ( super ) fn is_canyon_active ( & self ) -> bool {
174- self . chain_spec
175- . is_canyon_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
163+ self . chain_spec . is_canyon_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
176164 }
177165
178166 /// Returns true if holocene is active for the payload.
179167 pub ( super ) fn is_holocene_active ( & self ) -> bool {
180- self . chain_spec
181- . is_holocene_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
168+ self . chain_spec . is_holocene_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
182169 }
183170
184171 /// Returns true if isthmus is active for the payload.
185172 pub ( super ) fn is_isthmus_active ( & self ) -> bool {
186- self . chain_spec
187- . is_isthmus_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
173+ self . chain_spec . is_isthmus_active_at_timestamp ( self . attributes ( ) . timestamp ( ) )
188174 }
189175
190176 /// Returns the chain id
@@ -247,12 +233,9 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
247233 // purely for the purposes of utilizing the `evm_config.tx_env`` function.
248234 // Deposit transactions do not have signatures, so if the tx is a deposit, this
249235 // will just pull in its `from` address.
250- let sequencer_tx = sequencer_tx
251- . value ( )
252- . try_clone_into_recovered ( )
253- . map_err ( |_| {
254- PayloadBuilderError :: other ( OpPayloadBuilderError :: TransactionEcRecoverFailed )
255- } ) ?;
236+ let sequencer_tx = sequencer_tx. value ( ) . try_clone_into_recovered ( ) . map_err ( |_| {
237+ PayloadBuilderError :: other ( OpPayloadBuilderError :: TransactionEcRecoverFailed )
238+ } ) ?;
256239
257240 // Cache the depositor account prior to the state transition for the deposit nonce.
258241 //
@@ -339,12 +322,8 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
339322
340323 // Remove once we merge Reth 1.4.4
341324 // Fixed in https://github.com/paradigmxyz/reth/pull/16514
342- self . metrics
343- . da_block_size_limit
344- . set ( block_da_limit. map_or ( -1.0 , |v| v as f64 ) ) ;
345- self . metrics
346- . da_tx_size_limit
347- . set ( tx_da_limit. map_or ( -1.0 , |v| v as f64 ) ) ;
325+ self . metrics . da_block_size_limit . set ( block_da_limit. map_or ( -1.0 , |v| v as f64 ) ) ;
326+ self . metrics . da_tx_size_limit . set ( tx_da_limit. map_or ( -1.0 , |v| v as f64 ) ) ;
348327
349328 let block_attr = BlockConditionalAttributes {
350329 number : self . block_number ( ) ,
@@ -361,9 +340,11 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
361340 let tx_hash = tx. tx_hash ( ) ;
362341
363342 // exclude reverting transaction if:
364- // - the transaction comes from a bundle (is_some) and the hash **is not** in reverted hashes
365- // Note that we need to use the Option to signal whether the transaction comes from a bundle,
366- // otherwise, we would exclude all transactions that are not in the reverted hashes.
343+ // - the transaction comes from a bundle (is_some) and the hash **is not** in reverted
344+ // hashes
345+ // Note that we need to use the Option to signal whether the transaction comes from a
346+ // bundle, otherwise, we would exclude all transactions that are not in the
347+ // reverted hashes.
367348 let is_bundle_tx = reverted_hashes. is_some ( ) ;
368349 let exclude_reverting_txs =
369350 is_bundle_tx && !reverted_hashes. unwrap ( ) . contains ( & tx_hash) ;
@@ -382,19 +363,20 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
382363 num_txs_considered += 1 ;
383364
384365 // TODO: ideally we should get this from the txpool stream
385- if let Some ( conditional) = conditional
386- && !conditional. matches_block_attributes ( & block_attr)
366+ if let Some ( conditional) = conditional &&
367+ !conditional. matches_block_attributes ( & block_attr)
387368 {
388369 best_txs. mark_invalid ( tx. signer ( ) , tx. nonce ( ) ) ;
389370 continue ;
390371 }
391372
392- // TODO: remove this condition and feature once we are comfortable enabling interop for everything
373+ // TODO: remove this condition and feature once we are comfortable enabling interop for
374+ // everything
393375 if cfg ! ( feature = "interop" ) {
394- // We skip invalid cross chain txs, they would be removed on the next block update in
395- // the maintenance job
396- if let Some ( interop) = interop
397- && !is_valid_interop ( interop, self . config . attributes . timestamp ( ) )
376+ // We skip invalid cross chain txs, they would be removed on the next block update
377+ // in the maintenance job
378+ if let Some ( interop) = interop &&
379+ !is_valid_interop ( interop, self . config . attributes . timestamp ( ) )
398380 {
399381 log_txn ( TxnExecutionResult :: InteropFailed ) ;
400382 best_txs. mark_invalid ( tx. signer ( ) , tx. nonce ( ) ) ;
@@ -455,21 +437,15 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
455437 }
456438 } ;
457439
458- self . metrics
459- . tx_simulation_duration
460- . record ( tx_simulation_start_time. elapsed ( ) ) ;
440+ self . metrics . tx_simulation_duration . record ( tx_simulation_start_time. elapsed ( ) ) ;
461441 self . metrics . tx_byte_size . record ( tx. inner ( ) . size ( ) as f64 ) ;
462442 num_txs_simulated += 1 ;
463443
464444 // Run the per-address gas limiting before checking if the tx has
465445 // reverted or not, as this is a check against maliciously searchers
466446 // sending txs that are expensive to compute but always revert.
467447 let gas_used = result. gas_used ( ) ;
468- if self
469- . address_gas_limiter
470- . consume_gas ( tx. signer ( ) , gas_used)
471- . is_err ( )
472- {
448+ if self . address_gas_limiter . consume_gas ( tx. signer ( ) , gas_used) . is_err ( ) {
473449 log_txn ( TxnExecutionResult :: MaxGasUsageExceeded ) ;
474450 best_txs. mark_invalid ( tx. signer ( ) , tx. nonce ( ) ) ;
475451 continue ;
@@ -495,12 +471,12 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
495471
496472 // add gas used by the transaction to cumulative gas used, before creating the
497473 // receipt
498- if let Some ( max_gas_per_txn) = self . max_gas_per_txn {
499- if gas_used > max_gas_per_txn {
500- log_txn ( TxnExecutionResult :: MaxGasUsageExceeded ) ;
501- best_txs . mark_invalid ( tx . signer ( ) , tx . nonce ( ) ) ;
502- continue ;
503- }
474+ if let Some ( max_gas_per_txn) = self . max_gas_per_txn &&
475+ gas_used > max_gas_per_txn
476+ {
477+ log_txn ( TxnExecutionResult :: MaxGasUsageExceeded ) ;
478+ best_txs . mark_invalid ( tx . signer ( ) , tx . nonce ( ) ) ;
479+ continue ;
504480 }
505481
506482 info. cumulative_gas_used += gas_used;
0 commit comments