Skip to content

test_invalid_pre_fork_block_with_bal_hash_field()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_fork_transition.py::test_invalid_pre_fork_block_with_bal_hash_field@87aba1a3.

Generate fixtures for these test cases for Amsterdam with:

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

Reject a pre-Amsterdam block whose header carries block_access_list_hash.

The engine fixture sends a pre-Amsterdam newPayload carrying an empty blockAccessList param; the client's reconstructed header omits the hash, so the block hash check fails.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_fork_transition.py
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
@EIPChecklist.BlockHeaderField.Test.ForkTransition.Before()
@pytest.mark.valid_at_transition_to("Amsterdam")
@pytest.mark.exception_test
def test_invalid_pre_fork_block_with_bal_hash_field(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    Reject a pre-Amsterdam block whose header carries
    `block_access_list_hash`.

    The engine fixture sends a pre-Amsterdam `newPayload` carrying an
    empty `blockAccessList` param; the client's reconstructed header
    omits the hash, so the block hash check fails.
    """
    sender = pre.fund_eoa()
    receiver = pre.fund_eoa(amount=0)

    tx = Transaction(sender=sender, to=receiver, value=100, gas_price=10)

    blockchain_test(
        pre=pre,
        post={},
        blocks=[
            Block(
                timestamp=FORK_TIMESTAMP - 1,
                txs=[tx],
                rlp_modifier=Header(block_access_list_hash=Hash(0)),
                exception=BlockException.INVALID_BLOCK_HASH,
            ),
        ],
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.