@@ -40,7 +40,7 @@ use foundry_evm_core::{either_evm::EitherEvm, precompiles::EC_RECOVER};
40
40
use op_revm:: { L1BlockInfo , OpContext , precompiles:: OpPrecompiles } ;
41
41
use revm:: {
42
42
Database , DatabaseRef , Inspector , Journal ,
43
- context:: { Block as RevmBlock , BlockEnv , CfgEnv , Evm as RevmEvm , JournalTr , LocalContext } ,
43
+ context:: { Block as RevmBlock , BlockEnv , Cfg , CfgEnv , Evm as RevmEvm , JournalTr , LocalContext } ,
44
44
context_interface:: result:: { EVMError , ExecutionResult , Output } ,
45
45
database:: WrapDatabaseRef ,
46
46
handler:: { EthPrecompiles , instructions:: EthInstructions } ,
@@ -174,14 +174,18 @@ impl<DB: Db + ?Sized, V: TransactionValidator> TransactionExecutor<'_, DB, V> {
174
174
included. push ( tx. transaction . clone ( ) ) ;
175
175
tx
176
176
}
177
- TransactionExecutionOutcome :: Exhausted ( tx) => {
177
+ TransactionExecutionOutcome :: BlockGasExhausted ( tx) => {
178
178
trace ! ( target: "backend" , tx_gas_limit = %tx. pending_transaction. transaction. gas_limit( ) , ?tx, "block gas limit exhausting, skipping transaction" ) ;
179
179
continue ;
180
180
}
181
181
TransactionExecutionOutcome :: BlobGasExhausted ( tx) => {
182
182
trace ! ( target: "backend" , blob_gas = %tx. pending_transaction. transaction. blob_gas( ) . unwrap_or_default( ) , ?tx, "block blob gas limit exhausting, skipping transaction" ) ;
183
183
continue ;
184
184
}
185
+ TransactionExecutionOutcome :: TransactionGasExhausted ( tx) => {
186
+ trace ! ( target: "backend" , tx_gas_limit = %tx. pending_transaction. transaction. gas_limit( ) , ?tx, "transaction gas limit exhausting, skipping transaction" ) ;
187
+ continue ;
188
+ }
185
189
TransactionExecutionOutcome :: Invalid ( tx, _) => {
186
190
trace ! ( target: "backend" , ?tx, "skipping invalid transaction" ) ;
187
191
invalid. push ( tx) ;
@@ -285,10 +289,12 @@ pub enum TransactionExecutionOutcome {
285
289
Executed ( ExecutedTransaction ) ,
286
290
/// Invalid transaction not executed
287
291
Invalid ( Arc < PoolTransaction > , InvalidTransactionError ) ,
288
- /// Execution skipped because could exceed gas limit
289
- Exhausted ( Arc < PoolTransaction > ) ,
292
+ /// Execution skipped because could exceed block gas limit
293
+ BlockGasExhausted ( Arc < PoolTransaction > ) ,
290
294
/// Execution skipped because it exceeded the blob gas limit
291
295
BlobGasExhausted ( Arc < PoolTransaction > ) ,
296
+ /// Execution skipped because it exceeded the transaction gas limit
297
+ TransactionGasExhausted ( Arc < PoolTransaction > ) ,
292
298
/// When an error occurred during execution
293
299
DatabaseError ( Arc < PoolTransaction > , DatabaseError ) ,
294
300
}
@@ -306,10 +312,19 @@ impl<DB: Db + ?Sized, V: TransactionValidator> Iterator for &mut TransactionExec
306
312
let env = self . env_for ( & transaction. pending_transaction ) ;
307
313
308
314
// check that we comply with the block's gas limit, if not disabled
309
- let max_gas = self . gas_used . saturating_add ( env. tx . base . gas_limit ) ;
310
- if !env. evm_env . cfg_env . disable_block_gas_limit && max_gas > env. evm_env . block_env . gas_limit
315
+ let max_block_gas = self . gas_used . saturating_add ( env. tx . base . gas_limit ) ;
316
+ if !env. evm_env . cfg_env . disable_block_gas_limit
317
+ && max_block_gas > env. evm_env . block_env . gas_limit
318
+ {
319
+ return Some ( TransactionExecutionOutcome :: BlockGasExhausted ( transaction) ) ;
320
+ }
321
+
322
+ // check that we comply with the transaction's gas limit as imposed by Osaka (EIP-7825)
323
+ if env. evm_env . cfg_env . tx_gas_limit_cap . is_none ( )
324
+ && transaction. pending_transaction . transaction . gas_limit ( )
325
+ > env. evm_env . cfg_env ( ) . tx_gas_limit_cap ( )
311
326
{
312
- return Some ( TransactionExecutionOutcome :: Exhausted ( transaction) ) ;
327
+ return Some ( TransactionExecutionOutcome :: TransactionGasExhausted ( transaction) ) ;
313
328
}
314
329
315
330
// check that we comply with the block's blob gas limit
0 commit comments