Closed code423n4 closed 3 years ago
Last loop iterates over all markets but not comped markets will have speed set to 0. Emitted events might be useful because they indicate that compSpeed
was updated and for no comped market is 0. It's a confirmation that data is fresh and config is correct.
I agree here with the sponsor's view that CompSpeedUpdated event with speed set to 0 is a good indicator that data is fresh and config is correct. Thus, I'm marking it as invalid.
Handle
@cmichelio
Vulnerability details
Vulnerability Details
The last
for
loop iterates over all markets and sends aCompSpeedUpdated
event for all of them, even though some of these markets don't even have rewards (!isComped
).Impact
Performing the computation and sending events for all of these markets costs more gas and sending a
CompSpeedUpdated
event for markets that don't even have rewards feels wrong and could cause issues in off-chain scripts that don't expect it.Recommended Mitigation Steps
Perform an
if (markets[address(cToken)].isComped)
check like in the secondfor
loop and only update these markets.