@@ -274,17 +274,30 @@ impl Env {
274
274
// Check if account has enough balance for gas_limit*gas_price and value transfer.
275
275
// Transfer will be done inside `*_inner` functions.
276
276
if balance_check > account. info . balance {
277
- if self . cfg . is_balance_check_disabled ( ) {
278
- // Add transaction cost to balance to ensure execution doesn't fail.
279
- account. info . balance = balance_check;
280
- } else {
281
- return Err ( InvalidTransaction :: LackOfFundForMaxFee {
282
- fee : Box :: new ( balance_check) ,
283
- balance : Box :: new ( account. info . balance ) ,
284
- } ) ;
277
+ cfg_if:: cfg_if! {
278
+ if #[ cfg( not( feature = "morph" ) ) ] {
279
+ if self . cfg. is_balance_check_disabled( ) {
280
+ // Add transaction cost to balance to ensure execution doesn't fail.
281
+ account. info. balance = balance_check;
282
+ } else {
283
+ return Err ( InvalidTransaction :: LackOfFundForMaxFee {
284
+ fee: Box :: new( balance_check) ,
285
+ balance: Box :: new( account. info. balance) ,
286
+ } ) ;
287
+ }
288
+ } else {
289
+ if self . cfg. is_balance_check_disabled( ) || self . tx. morph. is_l1_msg {
290
+ // Add transaction cost to balance to ensure execution doesn't fail.
291
+ account. info. balance = balance_check;
292
+ } else {
293
+ return Err ( InvalidTransaction :: LackOfFundForMaxFee {
294
+ fee: Box :: new( balance_check) ,
295
+ balance: Box :: new( account. info. balance) ,
296
+ } ) ;
297
+ }
298
+ }
285
299
}
286
300
}
287
-
288
301
Ok ( ( ) )
289
302
}
290
303
}
0 commit comments