@@ -402,19 +402,6 @@ def call(evm: Evm) -> None:
402402 evm ,
403403 access_gas_cost + transfer_gas_cost + extend_memory .cost ,
404404 )
405- # Early balance check - before accessing target state.
406- # This ensures target is NOT in BAL when call fails due to insufficient funds.
407- sender_balance = get_account (
408- evm .message .block_env .state , evm .message .current_target
409- ).balance
410- if sender_balance < value :
411- # Only charge transfer + memory (not cold access, since we didn't access)
412- charge_gas (evm , transfer_gas_cost + extend_memory .cost )
413- evm .memory += b"\x00 " * extend_memory .expand_by
414- push (evm .stack , U256 (0 ))
415- evm .return_data = b""
416- evm .pc += Uint (1 )
417- return
418405
419406 # need to access account to check if account is alive, check gas before
420407 create_gas_cost = GAS_NEW_ACCOUNT
@@ -465,23 +452,30 @@ def call(evm: Evm) -> None:
465452 if evm .message .is_static and value != U256 (0 ):
466453 raise WriteInStaticContext
467454 evm .memory += b"\x00 " * extend_memory .expand_by
468-
469- generic_call (
470- evm ,
471- message_call_gas .sub_call ,
472- value ,
473- evm .message .current_target ,
474- to ,
475- code_address ,
476- True ,
477- False ,
478- memory_input_start_position ,
479- memory_input_size ,
480- memory_output_start_position ,
481- memory_output_size ,
482- code ,
483- disable_precompiles ,
484- )
455+ sender_balance = get_account (
456+ evm .message .block_env .state , evm .message .current_target
457+ ).balance
458+ if sender_balance < value :
459+ push (evm .stack , U256 (0 ))
460+ evm .return_data = b""
461+ evm .gas_left += message_call_gas .sub_call
462+ else :
463+ generic_call (
464+ evm ,
465+ message_call_gas .sub_call ,
466+ value ,
467+ evm .message .current_target ,
468+ to ,
469+ code_address ,
470+ True ,
471+ False ,
472+ memory_input_start_position ,
473+ memory_input_size ,
474+ memory_output_start_position ,
475+ memory_output_size ,
476+ code ,
477+ disable_precompiles ,
478+ )
485479
486480 # PROGRAM COUNTER
487481 evm .pc += Uint (1 )
0 commit comments