If the value of maxLockingDuration is decreased while there are locked deposits in process, the deposit to those lockIds will be reverted, not allowing users to deposit more to their lockId.
The user can add amounts multiple times to the same lockId with the help of the function SDLPoolPrimary::_storeUpdatedLock, this will cause it to be deposited to the same lockId if the user so wishes. The problem arises when the variable maxLockingDuration is decremented using the function LinearBoostController::setMaxLockingDuration, causing subsequent user deposits to the same lockId be reversed.
The following test shows how the user can deposit multiple times to the same lockId=1, however once maxLockingDuration is decreased, subsequent deposits for the same lockId will be reversed, making the user no longer able to deposit to the same lockId. Test steps:
User stakes 100 tokens using the max locking duration (4 years).
User deposits another 100 tokens to the lockId=1 using the same duration 4 years.
Now the admin reduces the max locking duration to 2 years.
User deposits more tokens to the lockId=1 using the same duration 4 years (like the step 2). The transaction will be reverted by MaxLockingDurationExceeded()
The user tries to reduce the duration time to an accepted time (1 year) and deposits to the same lockId=1 but the transaction will be reverted by InvalidLockingDuration
The user will not be able to deposit tokens to the same lockId if the maxLockingDuration decreases, even if the user reduces its duration, the transaction will be reversed.
Manual review
Allow deposits to the same lockId even if maxLockingDuration decreases. Modifying maxLockingDuration should not affect user deposits. Another solution could be to not allow the decrease of maxLockingDuration, only allow the increase.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.