Skip to content

test_calldata_lengths()

Documentation for tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py::test_calldata_lengths@ffe48572.

Generate fixtures for these test cases for Bogota with:

fill -v tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py::test_calldata_lengths --fork Bogota

Tests the beacon root contract call using multiple invalid input lengths.

Source code in tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py
@pytest.mark.parametrize(
    "tx_data",
    [
        pytest.param(bytes(), id="empty_calldata"),
        pytest.param(
            int.to_bytes(12, length=1, byteorder="big"), id="one_byte"
        ),
        pytest.param(
            int.to_bytes(12, length=31, byteorder="big"), id="31_bytes"
        ),
        pytest.param(
            int.to_bytes(12, length=33, byteorder="big"), id="33_bytes"
        ),
        pytest.param(
            int.to_bytes(12, length=1024, byteorder="big"), id="1024_bytes"
        ),
    ],
)
@pytest.mark.parametrize("valid_call,valid_input", [(False, False)])
@pytest.mark.parametrize("timestamp", [12])
@pytest.mark.valid_from("Cancun")
def test_calldata_lengths(
    blockchain_test: BlockchainTestFiller,
    beacon_root: bytes,
    timestamp: int,
    pre: Alloc,
    tx: Transaction,
    post: Dict,
) -> None:
    """
    Tests the beacon root contract call using multiple invalid input lengths.
    """
    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=[tx],
                parent_beacon_block_root=beacon_root,
                timestamp=timestamp,
            )
        ],
        post=post,
    )

Parametrized Test Cases

This test generates 5 parametrized test cases across 5 forks.