Problem
In ticketBroker.ts, the WinningTicketRedeemed handler uses event.params.faceValue for fee distribution math. However, the contract's updateTranscoderWithFees receives amountToTransfer, which can be less than faceValue when the sender's deposit is insufficient.
Contract flow (MixinTicketBrokerCore.sol:137-155)
if (_ticket.faceValue > sender.deposit) {
amountToTransfer = sender.deposit.add(
claimFromReserve(_ticket.sender, _ticket.recipient, _ticket.faceValue.sub(sender.deposit))
);
sender.deposit = 0;
} else {
amountToTransfer = _ticket.faceValue;
}
winningTicketTransfer(_ticket.recipient, amountToTransfer, _ticket.auxData);
winningTicketTransfer → updateTranscoderWithFees(_recipient, _amount, ...) uses amountToTransfer.
But the WinningTicketRedeemed event emits faceValue, not amountToTransfer:
emit WinningTicketRedeemed(_ticket.sender, _ticket.recipient, _ticket.faceValue, ...);
Impact
When a sender is underfunded (deposit < faceValue), the subgraph overcounts:
delegatorsFees and transcoderCommissionFees are computed on a higher base
cumulativeFeeFactor update is slightly inflated
pendingFeeCommission / lifetimeFeeCommission are slightly inflated
In the normal case (deposit >= faceValue), the values are equal and there is no issue.
Possible fix
The WinningTicketTransfer event emits amountToTransfer — could use that instead of or in addition to WinningTicketRedeemed.faceValue for the fee math.
Problem
In
ticketBroker.ts, theWinningTicketRedeemedhandler usesevent.params.faceValuefor fee distribution math. However, the contract'supdateTranscoderWithFeesreceivesamountToTransfer, which can be less thanfaceValuewhen the sender's deposit is insufficient.Contract flow (MixinTicketBrokerCore.sol:137-155)
winningTicketTransfer→updateTranscoderWithFees(_recipient, _amount, ...)usesamountToTransfer.But the
WinningTicketRedeemedevent emitsfaceValue, notamountToTransfer:Impact
When a sender is underfunded (
deposit < faceValue), the subgraph overcounts:delegatorsFeesandtranscoderCommissionFeesare computed on a higher basecumulativeFeeFactorupdate is slightly inflatedpendingFeeCommission/lifetimeFeeCommissionare slightly inflatedIn the normal case (
deposit >= faceValue), the values are equal and there is no issue.Possible fix
The
WinningTicketTransferevent emitsamountToTransfer— could use that instead of or in addition toWinningTicketRedeemed.faceValuefor the fee math.