@@ -1989,10 +1989,14 @@ def test_bal_create_oog_code_deposit(
19891989 access_list = [],
19901990 )
19911991
1992+ # CREATE charges NEW_ACCOUNT (scales with cpsb under EIP-8037) plus
1993+ # base; the 500_000 buffer is enough for init code + a single SSTORE
1994+ # but well short of the 10_000-byte deposit. Including NEW_ACCOUNT
1995+ # keeps the budget CPSB-agnostic.
19921996 tx = Transaction (
19931997 sender = alice ,
19941998 to = factory ,
1995- gas_limit = intrinsic_gas + 500_000 , # insufficient for deposit
1999+ gas_limit = ( intrinsic_gas + 500_000 + fork . gas_costs (). NEW_ACCOUNT ),
19962000 )
19972001
19982002 # BAL expectations:
@@ -2571,6 +2575,7 @@ def test_bal_call_revert_insufficient_funds(
25712575def test_bal_create_selfdestruct_to_self_with_call (
25722576 pre : Alloc ,
25732577 blockchain_test : BlockchainTestFiller ,
2578+ fork : Fork ,
25742579) -> None :
25752580 """
25762581 Test BAL with init code that CALLs Oracle, writes storage, then
@@ -2598,9 +2603,12 @@ def test_bal_create_selfdestruct_to_self_with_call(
25982603 # 1. Calls Oracle (which writes to its slot 0x01)
25992604 # 2. Writes 0x42 to own slot 0x01
26002605 # 3. Selfdestructs to self
2606+ #
2607+ # Forward enough gas for Oracle's first-time SSTORE
2608+ # (regular base + state gas, CPSB-agnostic).
2609+ oracle_call_gas = 100_000 + fork .sstore_state_gas ()
26012610 initcode_runtime = (
2602- # CALL(gas, Oracle, value=0, ...)
2603- Op .CALL (100_000 , oracle , 0 , 0 , 0 , 0 , 0 )
2611+ Op .CALL (oracle_call_gas , oracle , 0 , 0 , 0 , 0 , 0 )
26042612 + Op .POP
26052613 # Write to own storage slot 0x01
26062614 + Op .SSTORE (0x01 , 0x42 )
@@ -2661,10 +2669,18 @@ def test_bal_create_selfdestruct_to_self_with_call(
26612669 opcode = Op .CREATE2 ,
26622670 )
26632671
2672+ # CREATE2 + 3 first-time SSTOREs (factory slot 0, oracle slot 1,
2673+ # ephemeral slot 1 in the created contract). NEW_ACCOUNT and
2674+ # `sstore_state_gas()` are 0 pre-EIP-8037 and scale with cpsb on
2675+ # Amsterdam, keeping this budget CPSB-agnostic.
2676+ gas_limit = (
2677+ 1_000_000 + fork .gas_costs ().NEW_ACCOUNT + 3 * fork .sstore_state_gas ()
2678+ )
2679+
26642680 tx = Transaction (
26652681 sender = alice ,
26662682 to = factory ,
2667- gas_limit = 1_000_000 ,
2683+ gas_limit = gas_limit ,
26682684 )
26692685
26702686 block = Block (
0 commit comments