Skip to content

test_failed_inner_operation_no_log()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_failed_inner_operation_no_log@622620d8.

Generate fixtures for these test cases for Amsterdam with:

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

Test that failed inner operations do NOT emit transfer logs.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
@pytest.mark.parametrize_by_fork(
    "recipient_code,call_gas,call_value,recipient_balance,contract_balance",
    failing_inner_operations,
)
def test_failed_inner_operation_no_log(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    sender: EOA,
    recipient_code: Bytecode,
    call_gas: int | Op,
    call_value: int,
    recipient_balance: int,
    contract_balance: int,
) -> None:
    """Test that failed inner operations do NOT emit transfer logs."""
    recipient = pre.deploy_contract(recipient_code, balance=recipient_balance)
    tx_value = 1000

    contract_code = Op.CALL(
        gas=call_gas,
        address=recipient,
        value=call_value,
    )
    contract = pre.deploy_contract(contract_code, balance=contract_balance)

    tx = Transaction(
        sender=sender,
        to=contract,
        value=tx_value,
        expected_receipt=TransactionReceipt(
            logs=[transfer_log(sender, contract, tx_value)]
        ),
    )

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

Parametrized Test Cases

This test generates 5 parametrized test cases across 1 fork.