Skip to content

Test ACL

Documentation for tests/berlin/eip2930_access_list/test_acl.py.

Generate fixtures for these test cases with:

fill -v tests/berlin/eip2930_access_list/test_acl.py

Test ACL Transaction Source Code Examples

test_access_list(state_test, pre)

Test type 1 transaction.

Source code in tests/berlin/eip2930_access_list/test_acl.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@pytest.mark.valid_from("Berlin")
def test_access_list(state_test: StateTestFiller, pre: Alloc):
    """
    Test type 1 transaction.
    """
    env = Environment()

    contract_address = pre.deploy_contract(
        Op.PC + Op.SLOAD + Op.POP + Op.PC + Op.SLOAD,
        balance=0x03,
    )
    sender = pre.fund_eoa(0x300000)

    tx = Transaction(
        ty=1,
        chain_id=0x01,
        to=contract_address,
        value=1,
        gas_limit=323328,
        gas_price=7,
        access_list=[
            AccessList(
                address="0x0000000000000000000000000000000000000000",
                storage_keys=[
                    "0x0000000000000000000000000000000000000000000000000000000000000000",
                ],
            )
        ],
        secret_key="0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
        protected=True,
        sender=sender,
    )

    post = {
        contract_address: Account(
            code="0x5854505854",
            balance=4,
            nonce=1,
        ),
        sender: Account(
            balance=0x2CD931,
            nonce=1,
        ),
    }
    state_test(env=env, pre=pre, post=post, tx=tx)