Skip to content

test_reverted_transaction_no_log()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_reverted_transaction_no_log@87aba1a3.

Generate fixtures for these test cases for Amsterdam with:

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

Test that a failed transaction does NOT emit a transfer log.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
@pytest.mark.parametrize(
    "reverting_code",
    [
        pytest.param(Op.REVERT(0, 0), id="revert"),
        pytest.param(Op.INVALID, id="invalid_opcode"),
        pytest.param(Op.ADD, id="stack_underflow"),
        pytest.param(Op.MSTORE(2**256 - 1, 0), id="out_of_gas"),
    ],
)
def test_reverted_transaction_no_log(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    sender: EOA,
    reverting_code: Bytecode,
) -> None:
    """Test that a failed transaction does NOT emit a transfer log."""
    contract = pre.deploy_contract(reverting_code)

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

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

Parametrized Test Cases

This test generates 3 parametrized test cases across 1 fork.