Skip to content

test_call_new_account_no_execution_account_creation_cost()

Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_call.py::test_call_new_account_no_execution_account_creation_cost@26332146.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_call.py::test_call_new_account_no_execution_account_creation_cost --fork Amsterdam

Verify CALL with value to a non-existent account does not charge an execution-gas account-creation cost on top of state gas.

Source code in tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_call.py
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
@pytest.mark.valid_from("EIP8037")
def test_call_new_account_no_execution_account_creation_cost(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
) -> None:
    """
    Verify CALL with value to a non-existent account does not
    charge an execution-gas account-creation cost on top of state gas.
    """
    target = pre.fund_eoa(amount=0)

    caller_code = (
        Op.POP(
            Op.CALL(
                gas=0,
                address=target,
                value=1,
                value_transfer=True,
                account_new=True,
            )
        )
        + Op.STOP
    )
    caller = pre.deploy_contract(code=caller_code, balance=1)

    # Tight budget: slack is less than the old pre-Amsterdam execution
    # account-creation cost, so any extra execution draw would OOG.
    intrinsic = fork.transaction_intrinsic_cost_calculator()()
    tx = Transaction(
        to=caller,
        gas_limit=(intrinsic + caller_code.gas_cost(fork) + 20_000),
        sender=pre.fund_eoa(),
    )

    state_test(pre=pre, post={target: Account(balance=1)}, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.