Closed code423n4 closed 1 year ago
Mhm, I don't really see the problem you mention.
Maybe there is a misunderstanding about the value of maxCycle.
Here are the cases in my opinion:
Case 1: maxCycle is bigger than range
from cycle = 50
toCycle = 100
maxCycle: 70
the if condition is not true.
fromCycle: 100
toCycle: 50
receivableCycles: 0
This seems correct. Everything until latest finished cycle will be received.
Case 2: maxCycle is smaller than range
fromCycle = 50
toCycle = 100
maxCycle: 20
In that case, we want to receive the range from 50 to 70 and receivableCycles after the call should be 30.
Then the if condition is true.
if (100 - 50 > 20) {
receivableCycles = 100 - 50 - 20;
toCycle = 100 - receivableCycles;
}
These are correct in my opinion.
[dispute validity]
What Manuel said. receiveableCycles
is /// @param receivableCycles The number of cycles which still can be received.
, these is the number of NOT received cycles.
CodeSandwich marked the issue as sponsor disputed
Closing for lack of proof
GalloDaSballo marked the issue as unsatisfactory: Insufficient proof
Lines of code
https://github.com/code-423n4/2023-01-drips/blob/9fd776b50f4be23ca038b1d0426e63a69c7a511d/src/Drips.sol#L283
Vulnerability details
Description
receivableCycles
can still be> maxCycles
in_receiveDripsResult
Line: https://github.com/code-423n4/2023-01-drips/blob/9fd776b50f4be23ca038b1d0426e63a69c7a511d/src/Drips.sol#L283
In this case if
toCycle - fromCycle > 2 * maxCycles
, thenreceivableCycles > maxCycles
which should not be the case.The value of
toCycle
is correct (MAX: maxCycles away from fromCycle) since:However, in
_receiveDrips
,emit ReceivedDrips
is called withreceivableCycles
which will no longer be the true reflected value. Any system that depends on this emit will therefore be wrong.See line: https://github.com/code-423n4/2023-01-drips/blob/9fd776b50f4be23ca038b1d0426e63a69c7a511d/src/Drips.sol#L256
Tools Used
Manual Audit
Recommended Mitigation Steps
Set
receivableCycles = maxCycles
whentoCycle - fromCycle > maxCycles
. Make sure to fix thetoCycle
update line as well.toCycle = fronCycle + receivableCycles