Skip to content

test_insufficient_gas_for_access_list()

Documentation for tests/amsterdam/eip7981_increase_access_list_cost/test_transaction_validity.py::test_insufficient_gas_for_access_list@2119b382.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7981_increase_access_list_cost/test_transaction_validity.py::test_insufficient_gas_for_access_list --fork Amsterdam

Test that transactions with insufficient gas for access list costs are rejected.

With EIP-7981, the intrinsic gas must cover: - Base transaction cost - Calldata costs - Access list storage costs - Access list data costs (new in EIP-7981) - Floor cost including access list tokens

Source code in tests/amsterdam/eip7981_increase_access_list_cost/test_transaction_validity.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
72
73
74
75
76
@pytest.mark.exception_test
@pytest.mark.with_all_tx_types(selector=lambda tx_type: tx_type >= 1)
@pytest.mark.parametrize(
    "access_list,tx_gas_delta",
    [
        pytest.param(
            [AccessList(address=Address(1), storage_keys=[Hash(0)])],
            -1,
            id="insufficient_gas_by_one",
        ),
        pytest.param(
            [AccessList(address=Address(1), storage_keys=[Hash(0)])],
            -100,
            id="insufficient_gas_by_hundred",
        ),
        pytest.param(
            [
                AccessList(
                    address=Address(1),
                    storage_keys=[Hash(i) for i in range(10)],
                )
            ],
            -1,
            id="large_access_list_insufficient_gas",
        ),
    ],
)
@pytest.mark.parametrize(
    "to",
    [pytest.param("eoa", id="")],
    indirect=True,
)
def test_insufficient_gas_for_access_list(
    state_test: StateTestFiller,
    pre: Alloc,
    tx: Transaction,
) -> None:
    """
    Test that transactions with insufficient gas for access list costs
    are rejected.

    With EIP-7981, the intrinsic gas must cover:
    - Base transaction cost
    - Calldata costs
    - Access list storage costs
    - Access list data costs (new in EIP-7981)
    - Floor cost including access list tokens
    """
    state_test(
        pre=pre,
        post={},
        tx=tx,
    )

Parametrized Test Cases

This test generates 12 parametrized test cases across 1 fork.