Skip to content

Test ACL

Documentation for test cases from 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, fork)

Test type 1 transaction.

Source code in tests/berlin/eip2930_access_list/test_acl.py
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
60
61
62
63
64
65
66
67
68
69
70
@pytest.mark.valid_from("Berlin")
@pytest.mark.valid_until("London")
def test_access_list(state_test: StateTestFiller, fork: Fork):
    """
    Test type 1 transaction.
    """
    env = Environment()

    pre = {
        "0x000000000000000000000000000000000000aaaa": Account(
            balance=0x03,
            code=Op.PC + Op.SLOAD + Op.POP + Op.PC + Op.SLOAD,
            nonce=1,
        ),
        "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": Account(
            balance=0x300000,
            nonce=0,
        ),
    }

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

    post = {
        "0x000000000000000000000000000000000000aaaa": Account(
            code="0x5854505854",
            balance=4,
            nonce=1,
        ),
        "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": Account(
            balance=0x1BC16D674EC80000 if is_fork(fork, London) else 0x1BC16D674ECB26CE,
        ),
        "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": Account(
            balance=0x2CD931,
            nonce=1,
        ),
    }
    state_test(env=env, pre=pre, post=post, txs=[tx])