Skip to content

test_stack_underflow_no_log()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_stack_underflow_no_log@b47f0253.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_stack_underflow_no_log --fork Amsterdam

Test that stack underflow during CALL/CREATE does NOT emit log.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
@pytest.mark.parametrize(
    "contract_code",
    [
        pytest.param(
            # CALL stack underflow: only push 6 items instead of 7
            Op.PUSH1(0)
            + Op.PUSH1(0)
            + Op.PUSH1(0)
            + Op.PUSH1(0)
            + Op.PUSH1(100)
            + Op.PUSH2(0x1234)
            + Op.CALL,
            id="call_stack_underflow",
        ),
        pytest.param(
            # CREATE stack underflow: only push 2 items instead of 3
            Op.PUSH1(0) + Op.PUSH1(0) + Op.CREATE,
            id="create_stack_underflow",
        ),
    ],
)
def test_stack_underflow_no_log(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    sender: EOA,
    contract_code: Bytecode,
) -> None:
    """Test that stack underflow during CALL/CREATE does NOT emit log."""
    contract = pre.deploy_contract(contract_code, balance=1000)

    tx = Transaction(
        sender=sender,
        to=contract,
        value=1000,
        gas_limit=100_000,
        expected_receipt=TransactionReceipt(logs=[]),  # TX fails, no logs
    )

    state_test(env=env, pre=pre, post={}, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.