Skip to content

test_calldata_lengths()

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

Generate fixtures for these test cases for Amsterdam with:

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

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

Source code in tests/cancun/eip4788_beacon_root/test_beacon_root_contract.py
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
@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 4 forks.