Skip to content

test_zero_value_operations_no_log()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_zero_value_operations_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_zero_value_operations_no_log --fork Amsterdam

Test that zero-value operations do NOT emit transfer logs.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
@pytest.mark.parametrize(
    "op_type",
    [
        pytest.param("call", id="call"),
        pytest.param("selfdestruct", id="selfdestruct"),
    ],
)
def test_zero_value_operations_no_log(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    sender: EOA,
    op_type: str,
) -> None:
    """Test that zero-value operations do NOT emit transfer logs."""
    target = pre.nonexistent_account()

    if op_type == "call":
        contract_code = Op.CALL(gas=100_000, address=target, value=0)
    else:
        contract_code = Op.SELFDESTRUCT(target)

    contract = pre.deploy_contract(contract_code, balance=0)

    tx = Transaction(
        sender=sender,
        to=contract,
        value=0,
        gas_limit=100_000,
        expected_receipt=TransactionReceipt(logs=[]),
    )

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

Parametrized Test Cases

This test generates 2 parametrized test cases across 1 fork.