@@ -1845,15 +1845,16 @@ def test_create_code_deposit_oog_refunds_state_gas(
18451845)
18461846@pytest .mark .valid_from ("EIP8037" )
18471847def test_failed_create_tx_refunds_intrinsic_new_account (
1848- blockchain_test : BlockchainTestFiller ,
1848+ state_test : StateTestFiller ,
18491849 pre : Alloc ,
18501850 fork : Fork ,
18511851 init_code : Bytecode ,
18521852) -> None :
18531853 """
18541854 Verify the NEW_ACCOUNT × CPSB portion of intrinsic_state_gas is
1855- refunded on creation-tx revert/halt, so block state-gas excludes
1856- it and header gas_used reflects only the regular component.
1855+ refunded on creation-tx revert/halt. Block state-gas excludes it
1856+ so header gas_used reflects only the regular component, and the
1857+ sender's receipt reflects the same refund via cumulative_gas_used.
18571858 """
18581859 intrinsic_calc = fork .transaction_intrinsic_cost_calculator ()
18591860 create_state_gas = fork .create_state_gas (code_size = 0 )
@@ -1870,23 +1871,23 @@ def test_failed_create_tx_refunds_intrinsic_new_account(
18701871 regular_consumed = init_code .regular_cost (fork )
18711872
18721873 expected_gas_used = intrinsic_regular + regular_consumed
1874+ expected_cumulative = intrinsic_total + regular_consumed - create_state_gas
18731875
18741876 tx = Transaction (
18751877 to = None ,
18761878 data = init_code ,
18771879 gas_limit = gas_limit ,
18781880 sender = pre .fund_eoa (),
1881+ expected_receipt = TransactionReceipt (
1882+ cumulative_gas_used = expected_cumulative ,
1883+ ),
18791884 )
18801885
1881- blockchain_test (
1886+ state_test (
18821887 pre = pre ,
1883- blocks = [
1884- Block (
1885- txs = [tx ],
1886- header_verify = Header (gas_used = expected_gas_used ),
1887- ),
1888- ],
18891888 post = {},
1889+ tx = tx ,
1890+ blockchain_test_header_verify = Header (gas_used = expected_gas_used ),
18901891 )
18911892
18921893
@@ -1937,57 +1938,6 @@ def test_create_tx_collision_refunds_intrinsic_new_account(
19371938 )
19381939
19391940
1940- @pytest .mark .parametrize (
1941- "failure_mode" ,
1942- [
1943- pytest .param ("revert" , id = "revert" ),
1944- pytest .param ("halt" , id = "halt" ),
1945- ],
1946- )
1947- @pytest .mark .valid_from ("EIP8037" )
1948- def test_failed_create_tx_sender_billing (
1949- state_test : StateTestFiller ,
1950- pre : Alloc ,
1951- fork : Fork ,
1952- failure_mode : str ,
1953- ) -> None :
1954- """
1955- Verify sender billing for a failed creation tx with tight gas.
1956-
1957- Complements ``test_failed_create_tx_state_gas_dominates`` which
1958- checks the header. This pins ``cumulative_gas_used`` to verify
1959- the execution state gas refund reaches the sender.
1960- """
1961- intrinsic_calc = fork .transaction_intrinsic_cost_calculator ()
1962-
1963- if failure_mode == "revert" :
1964- init_code = Op .REVERT (0 , 0 )
1965- else :
1966- init_code = Op .INVALID
1967-
1968- intrinsic_total = intrinsic_calc (
1969- calldata = bytes (init_code ), contract_creation = True
1970- )
1971- gas_limit = intrinsic_total + 1000
1972-
1973- if failure_mode == "revert" :
1974- expected_cumulative = intrinsic_total + init_code .gas_cost (fork )
1975- else :
1976- expected_cumulative = gas_limit
1977-
1978- tx = Transaction (
1979- to = None ,
1980- data = init_code ,
1981- gas_limit = gas_limit ,
1982- sender = pre .fund_eoa (),
1983- expected_receipt = TransactionReceipt (
1984- cumulative_gas_used = expected_cumulative ,
1985- ),
1986- )
1987-
1988- state_test (pre = pre , post = {}, tx = tx )
1989-
1990-
19911941@pytest .mark .parametrize (
19921942 "initcode_size_delta" ,
19931943 [
0 commit comments