Skip to content

test_callf_operand_stack_overflow()

Documentation for tests/osaka/eip7692_eof_v1/eip4750_functions/test_callf_execution.py::test_callf_operand_stack_overflow@008e492e.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip4750_functions/test_callf_execution.py::test_callf_operand_stack_overflow --fork Osaka

Test stack overflowing 1024 items in called function.

Source code in tests/osaka/eip7692_eof_v1/eip4750_functions/test_callf_execution.py
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@pytest.mark.parametrize(
    "container",
    (
        Container(
            name="no_inputs",
            sections=[
                Section.Code(
                    code=Op.PUSH0 * 1023
                    + Op.CALLF[1]
                    + Op.POP * 1023
                    + Op.SSTORE(slot_code_worked, value_code_worked)
                    + Op.RETURN(0, 0),
                    max_stack_height=1023,
                ),
                Section.Code(
                    Op.PUSH0
                    +
                    # Stack has 1024 items
                    Op.CALLF[2]
                    + Op.POP
                    + Op.RETF,
                    code_inputs=0,
                    code_outputs=0,
                    max_stack_height=1,
                ),
                Section.Code(
                    Op.PUSH0
                    +
                    # Runtime stack overflow
                    Op.POP
                    + Op.RETF,
                    code_inputs=0,
                    code_outputs=0,
                    max_stack_height=1,
                ),
            ],
        ),
        Container(
            name="with_inputs",
            sections=[
                Section.Code(
                    code=Op.PUSH0 * 1023
                    + Op.CALLF[1]
                    + Op.POP * 1023
                    + Op.SSTORE(slot_code_worked, value_code_worked)
                    + Op.RETURN(0, 0),
                    max_stack_height=1023,
                ),
                Section.Code(
                    Op.PUSH0
                    +
                    # Stack has 1024 items
                    Op.CALLF[2]
                    + Op.POP
                    + Op.RETF,
                    code_inputs=3,
                    code_outputs=3,
                    max_stack_height=4,
                ),
                Section.Code(
                    Op.PUSH0
                    +
                    # Runtime stackoverflow
                    Op.POP
                    + Op.RETF,
                    code_inputs=3,
                    code_outputs=3,
                    max_stack_height=4,
                ),
            ],
        ),
    ),
    ids=lambda x: x.name,
)
def test_callf_operand_stack_overflow(eof_state_test: EOFStateTestFiller, container: Container):
    """Test stack overflowing 1024 items in called function."""
    eof_state_test(
        container=container,
        container_post=Account(storage={slot_code_worked: 0}),
    )

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated) container
...fork_Osaka-eof_test-no_inputs no_inputs
...fork_Osaka-eof_test-with_inputs with_inputs
...fork_Osaka-eof_state_test-no_inputs no_inputs
...fork_Osaka-eof_state_test-with_inputs with_inputs
...fork_Osaka-eof_blockchain_test-no_inputs no_inputs
...fork_Osaka-eof_blockchain_test-with_inputs with_inputs