Skip to content

test_create_charges_state_gas()

Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_eip_mainnet.py::test_create_charges_state_gas@622620d8.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_eip_mainnet.py::test_create_charges_state_gas --fork Amsterdam

Test CREATE charges state gas for new account creation.

Source code in tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_eip_mainnet.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def test_create_charges_state_gas(
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """Test CREATE charges state gas for new account creation."""
    init_code = Op.STOP
    mstore_value, size = init_code_at_high_bytes(init_code)

    storage = Storage()
    contract = pre.deploy_contract(
        code=(
            Op.MSTORE(0, mstore_value)
            + Op.SSTORE(
                storage.store_next(True),
                Op.GT(Op.CREATE(0, 0, size), 0),
            )
        ),
    )

    tx = Transaction(
        to=contract,
        state_gas_reservoir=0,
        sender=pre.fund_eoa(),
    )

    post = {contract: Account(storage=storage)}
    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.