Skip to content

test_invalid_post_fork_block_without_slot_number()

Documentation for tests/amsterdam/eip7843_slotnum/test_fork_transition.py::test_invalid_post_fork_block_without_slot_number@ffe48572.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7843_slotnum/test_fork_transition.py::test_invalid_post_fork_block_without_slot_number --fork Amsterdam

Reject an activation block whose header lacks the slot_number field.

From the fork activation onward the field is mandatory: a header without it is malformed and the engine payload is missing a parameter required by its version.

Source code in tests/amsterdam/eip7843_slotnum/test_fork_transition.py
@EIPChecklist.BlockHeaderField.Test.ForkTransition.After()
@pytest.mark.valid_at_transition_to("EIP7843")
@pytest.mark.exception_test
def test_invalid_post_fork_block_without_slot_number(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    Reject an activation block whose header lacks the `slot_number`
    field.

    From the fork activation onward the field is mandatory: a header
    without it is malformed and the engine payload is missing a
    parameter required by its version.
    """
    sender = pre.fund_eoa()
    receiver = pre.fund_eoa(amount=0)

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

    blockchain_test(
        pre=pre,
        post={},
        blocks=[
            Block(
                timestamp=FORK_TIMESTAMP,
                txs=[tx],
                rlp_modifier=Header(slot_number=Header.REMOVE_FIELD),
                exception=BlockException.INCORRECT_BLOCK_FORMAT,
                engine_api_error_code=EngineAPIError.InvalidParams,
            ),
        ],
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.