Problem
The contract's latestCumulativeFactorsPool() tracks reward and fee factors independently using separate lastRewardRound and lastFeeRound fields. The subgraph only has lastRewardRound on the Transcoder entity.
When a transcoder reactivates after being inactive, the roundsManager newRound handler falls back to lastRewardRound for both cumulativeRewardFactor and cumulativeFeeFactor. If fees were earned in a later round than the last reward (i.e. lastFeeRound > lastRewardRound), the propagated cumulativeFeeFactor will be stale.
Example
- Round 98:
reward() called, fees earned → lastRewardRound=98, lastFeeRound=98
- Round 99: no
reward(), fees earned → lastRewardRound=98, lastFeeRound=99
- Rounds 100-104: deactivated
- Round 105: reactivated → subgraph falls back to round 98 for both factors, missing the fee factor update from round 99
Fix
- Add
lastFeeRound: Round to the Transcoder schema
- Set
transcoder.lastFeeRound = round.id in the ticketBroker fee handler
- In roundsManager
newRound, use separate fallback lookups:
cumulativeRewardFactor from lastRewardRound pool
cumulativeFeeFactor from lastFeeRound pool
This mirrors the contract's independent lastRewardRound/lastFeeRound lookups in latestCumulativeFactorsPool().
Context
Related to PR #217. The reactivation fallback to lastRewardRound was added in that PR but only covers the reward factor correctly.
Problem
The contract's
latestCumulativeFactorsPool()tracks reward and fee factors independently using separatelastRewardRoundandlastFeeRoundfields. The subgraph only haslastRewardRoundon the Transcoder entity.When a transcoder reactivates after being inactive, the roundsManager
newRoundhandler falls back tolastRewardRoundfor bothcumulativeRewardFactorandcumulativeFeeFactor. If fees were earned in a later round than the last reward (i.e.lastFeeRound > lastRewardRound), the propagatedcumulativeFeeFactorwill be stale.Example
reward()called, fees earned →lastRewardRound=98,lastFeeRound=98reward(), fees earned →lastRewardRound=98,lastFeeRound=99Fix
lastFeeRound: Roundto the Transcoder schematranscoder.lastFeeRound = round.idin the ticketBroker fee handlernewRound, use separate fallback lookups:cumulativeRewardFactorfromlastRewardRoundpoolcumulativeFeeFactorfromlastFeeRoundpoolThis mirrors the contract's independent
lastRewardRound/lastFeeRoundlookups inlatestCumulativeFactorsPool().Context
Related to PR #217. The reactivation fallback to
lastRewardRoundwas added in that PR but only covers the reward factor correctly.