Skip to content

test_zero_gas_price_and_touching()

Documentation for tests/frontier/touch/test_touch.py::test_zero_gas_price_and_touching@7b8124a7.

Generate fixtures for these test cases for Berlin with:

fill -v tests/frontier/touch/test_touch.py::test_zero_gas_price_and_touching --fork Berlin

Test sending a zero gasprice transaction in early forks respects account touching rules.

Source code in tests/frontier/touch/test_touch.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@pytest.mark.valid_from("Frontier")
@pytest.mark.valid_until("Berlin")
def test_zero_gas_price_and_touching(
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """
    Test sending a zero gasprice transaction in early forks respects
    account touching rules.
    """
    sender = pre.fund_eoa()
    value = 0x01

    contract = pre.deploy_contract(
        code=(Op.SSTORE(0, value) + Op.STOP),
    )

    tx = Transaction(
        gas_limit=500_000,
        to=contract,
        gas_price=0,  # Part of the test, do not change.
        sender=sender,
        protected=False,
    )

    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post={contract: Account(storage={0: value})},
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 7 forks.