Skip to content

test_bal_fork_transition_happy_path()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_fork_transition.py::test_bal_fork_transition_happy_path@9c2813ee.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_fork_transition.py::test_bal_fork_transition_happy_path --fork Amsterdam

Verify that a BAL is produced at the Amsterdam activation block.

  • Pre-fork block (timestamp < 15_000): no BAL hash, no BAL body.
  • Activation block (timestamp == 15_000): BAL hash and body are present and match the actual access activity in the block.
Source code in tests/amsterdam/eip7928_block_level_access_lists/test_fork_transition.py
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
77
78
79
80
81
82
83
@EIPChecklist.BlockHeaderField.Test.ForkTransition.Initial()
@pytest.mark.valid_at_transition_to("Amsterdam")
def test_bal_fork_transition_happy_path(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    Verify that a BAL is produced at the Amsterdam activation block.

    - Pre-fork block (timestamp < 15_000): no BAL hash, no BAL body.
    - Activation block (timestamp == 15_000): BAL hash and body are present
      and match the actual access activity in the block.
    """
    alice = pre.fund_eoa()
    bob = pre.fund_eoa(amount=0)

    pre_fork_tx = Transaction(sender=alice, to=bob, value=100, gas_price=10)
    post_fork_tx = Transaction(sender=alice, to=bob, value=100, gas_price=10)

    blocks = [
        Block(
            timestamp=FORK_TIMESTAMP - 1,
            txs=[pre_fork_tx],
            header_verify=Header(
                block_access_list_hash=Header.EMPTY_FIELD,
            ),
        ),
        Block(
            timestamp=FORK_TIMESTAMP,
            txs=[post_fork_tx],
            expected_block_access_list=BlockAccessListExpectation(
                account_expectations={
                    alice: BalAccountExpectation(
                        nonce_changes=[
                            BalNonceChange(block_access_index=1, post_nonce=2)
                        ],
                    ),
                    bob: BalAccountExpectation(
                        balance_changes=[
                            BalBalanceChange(
                                block_access_index=1, post_balance=200
                            ),
                        ],
                    ),
                }
            ),
        ),
    ]

    blockchain_test(
        pre=pre,
        blocks=blocks,
        post={bob: Account(balance=200)},
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.