Skip to content

test_call_with_value_to_coinbase_no_priority_fee_log()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_call_with_value_to_coinbase_no_priority_fee_log@2119b382.

Generate fixtures for these test cases for Amsterdam with:

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

Verify no Transfer log is emitted for the coinbase priority fee.

A contract executes CALL with nonzero value to the coinbase address, and the transaction pays a nonzero priority fee to that same coinbase. Only the CALL-with-value must produce a Transfer log; the priority fee crediting happens outside the EVM as a protocol-level balance change and must not emit a log.

An implementation that hooks all balance additions (instead of only CALL / SELFDESTRUCT / tx-level value transfers) would emit an extra Transfer log for the fee and fail the exact-log assertion.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
@pytest.mark.execute(pytest.mark.skip("Requires specific base fee"))
def test_call_with_value_to_coinbase_no_priority_fee_log(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    sender: EOA,
    fork: Fork,
) -> None:
    """
    Verify no Transfer log is emitted for the coinbase priority fee.

    A contract executes CALL with nonzero value to the coinbase address,
    and the transaction pays a nonzero priority fee to that same
    coinbase. Only the CALL-with-value must produce a Transfer log; the
    priority fee crediting happens outside the EVM as a protocol-level
    balance change and must not emit a log.

    An implementation that hooks all balance additions (instead of only
    CALL / SELFDESTRUCT / tx-level value transfers) would emit an extra
    Transfer log for the fee and fail the exact-log assertion.
    """
    coinbase = env.fee_recipient
    call_value = 1

    caller_code = Op.CALL(gas=Op.GAS, address=coinbase, value=call_value)
    caller = pre.deploy_contract(caller_code, balance=call_value)
    env.base_fee_per_gas = ZeroPaddedHexNumber(7)
    max_fee_per_gas = int(env.base_fee_per_gas) * 2
    tx = Transaction(
        sender=sender,
        to=caller,
        value=0,
        max_fee_per_gas=max_fee_per_gas,
        max_priority_fee_per_gas=max_fee_per_gas,
        expected_receipt=TransactionReceipt(
            logs=[transfer_log(caller, coinbase, call_value)]
        ),
    )

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

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.