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@bc691d13.

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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
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
@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),
                ),
                Section.Code(
                    Op.PUSH0  # Stack has 1024 items
                    + Op.CALLF[2]
                    + Op.POP
                    + Op.RETF,
                    code_outputs=0,
                ),
                Section.Code(
                    Op.PUSH0  # Runtime stack overflow
                    + Op.POP
                    + Op.RETF,
                    code_outputs=0,
                ),
            ],
        ),
        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),
                ),
                Section.Code(
                    Op.PUSH0  # Stack has 1024 items
                    + Op.CALLF[2]
                    + Op.POP
                    + Op.RETF,
                    code_inputs=3,
                    code_outputs=3,
                    max_stack_increase=1,
                ),
                Section.Code(
                    Op.PUSH0  # Runtime stackoverflow
                    + Op.POP
                    + Op.RETF,
                    code_inputs=3,
                    code_outputs=3,
                    max_stack_increase=1,
                ),
            ],
        ),
    ),
    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