Skip to content

test_block_intermidiate_state()

Documentation for tests/frontier/examples/test_block_intermediate_state.py::test_block_intermidiate_state@01f496f4.

Generate fixtures for these test cases for Prague with:

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

Verify intermidiate block states.

Source code in tests/frontier/examples/test_block_intermediate_state.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
@pytest.mark.valid_from("Frontier")
@pytest.mark.valid_until("Homestead")
def test_block_intermidiate_state(blockchain_test: BlockchainTestFiller, pre: Alloc):
    """Verify intermidiate block states."""
    env = Environment()
    sender = pre.fund_eoa()

    tx = Transaction(gas_limit=100_000, to=None, data=b"", sender=sender, protected=False)
    tx_2 = Transaction(gas_limit=100_000, 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(
        genesis_environment=env,
        pre=pre,
        post=block_3.expected_post_state,
        blocks=[block_1, block_2, block_3],
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated)
...fork_Frontier-blockchain_test
...fork_Homestead-blockchain_test