Skip to content

test_block_intermediate_state()

Documentation for tests/frontier/examples/test_block_intermediate_state.py::test_block_intermediate_state@b314d18e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/frontier/examples/test_block_intermediate_state.py::test_block_intermediate_state --fork Amsterdam

Verify intermediate block states.

Source code in tests/frontier/examples/test_block_intermediate_state.py
13
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
45
46
47
@pytest.mark.valid_from("Frontier")
def test_block_intermediate_state(
    blockchain_test: BlockchainTestFiller, pre: Alloc
) -> None:
    """Verify intermediate block states."""
    sender = pre.fund_eoa()

    tx = Transaction(to=None, data=b"", sender=sender, protected=False)
    tx_2 = Transaction(to=None, data=b"", sender=sender, protected=False)

    block_1 = Block(
        txs=[tx],
        expected_post_state={
            sender: Account(
                nonce=1,
            ),
        },
    )

    block_2 = Block(txs=[])

    block_3 = Block(
        txs=[tx_2],
        expected_post_state={
            sender: Account(
                nonce=2,
            ),
        },
    )

    blockchain_test(
        pre=pre,
        post=block_3.expected_post_state,
        blocks=[block_1, block_2, block_3],
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 16 forks.