# handle_l1_message may unfairly revert l2 tx with sufficient l1 sender balance, due to vulnerable fee charge implementation

Kakarot's handle_l1_message hardcodes gas_limit 2.1e9 and gas_price 1, pre-deducting max_fee from L1 sender balance and unfairly reverting L2 txs with sufficient funds.

- Payout: Audit contest
- Severity: medium
- Program: Kakarot
- Found by: oakcobalt
- Disclosed: 2024-12-10
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-09-kakarot-findings/issues/29
- Library page: https://bugbountylibrary.com/r/c4%3A2024-09-kakarot%3AM-11
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** Starknet L1 handler / EVM interpreter fee charging
**Root cause:** handle_l1_message hardcodes gas_limit=2100000000 and gas_price=1, so interpreter::execute subtracts max_fee (2.1e9) from the L1 sender's cached balance before value transfer and EVM run, regardless of actual gas needed.
**Steps:**
1. L1 sender has balance 2100000000+21000 and sends an L1->L2 message transferring value 2100000000.
2. handle_l1_message calls Interpreter::execute with gas_limit=2100000000, gas_price=1.
3. execute computes max_fee=2100000000 and does uint256_sub(sender.balance, max_fee) -> new_balance=2100.
4. State.add_transfer(value=2100000000) against cached balance 2100 fails, success=0.
5. EVM halts with EXCEPTIONAL_HALT, consuming all gas and charging max_fee 2100000000; transfer never occurs.
**How found:** Code reading of handle_l1_message and interpreter::execute, noticing hardcoded gas_limit/gas_price and that max_fee is deducted from cached balance before value transfer and EVM execution.
**Exploitation:** Not an attacker-driven exploit; a correctness/fee-charging flaw causing unfair reverts and overcharging of legitimate L1->L2 messages.
**Insight:** When a fee path pre-deducts max_fee from cached state before value transfer, check whether max_fee is user-controllable or hardcoded; hardcoded high gas limits can make otherwise-funded transfers fail and burn the full max_fee.

