Skip to content

test_max_code_sections()

Documentation for tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py::test_max_code_sections@21fb11c8.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py::test_max_code_sections --fork Osaka

Verify EOF container maximum number of code sections.

Source code in tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
@pytest.mark.parametrize("plus_data", [False, True])
@pytest.mark.parametrize("plus_container", [False, True])
def test_max_code_sections(
    eof_test: EOFTestFiller,
    plus_data: bool,
    plus_container: bool,
):
    """Verify EOF container maximum number of code sections."""
    if plus_container:
        sections = [
            Section.Code(
                Op.JUMPF[i + 1] if i < (MAX_CODE_SECTIONS - 1) else Op.RETURNCONTRACT[0](0, 0)
            )
            for i in range(MAX_CODE_SECTIONS)
        ]
        sections.append(
            Section.Container(
                container=Container(
                    sections=[
                        Section.Code(Op.JUMPF[i + 1] if i < (MAX_CODE_SECTIONS - 1) else Op.STOP)
                        for i in range(MAX_CODE_SECTIONS)
                    ],
                )
            )
        )
    else:
        sections = [
            Section.Code(Op.JUMPF[i + 1] if i < (MAX_CODE_SECTIONS - 1) else Op.STOP)
            for i in range(MAX_CODE_SECTIONS)
        ]
    if plus_data:
        sections.append(Section.Data(data=b"\0"))
    eof_test(
        container=Container(
            name="max_code_sections",
            sections=sections,
            kind=ContainerKind.INITCODE if plus_container else ContainerKind.RUNTIME,
        ),
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) plus_container plus_data
...fork_Osaka-eof_test-plus_container_False-plus_data_False False False
...fork_Osaka-eof_test-plus_container_False-plus_data_True False True
...fork_Osaka-eof_test-plus_container_True-plus_data_False True False
...fork_Osaka-eof_test-plus_container_True-plus_data_True True True